Module: xenomai-jki
Branch: for-forge
Commit: 9fc1ce1503044c62f6f153c8a05bc592eb21dd5a
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=9fc1ce1503044c62f6f153c8a05bc592eb21dd5a

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Fri Nov  8 19:04:11 2013 +0100

clocktest: Update to new clocks and clock encoding scheme

Add -E command line option to specify an extension clock more
conveniently. CLOCK_HOST_REALTIME is not selected by "-E -C 42". Also
add decoding of CLOCK_MONOTONIC_RAW.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 testsuite/clocktest/clocktest.c |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/testsuite/clocktest/clocktest.c b/testsuite/clocktest/clocktest.c
index 3a34998..cea8de3 100644
--- a/testsuite/clocktest/clocktest.c
+++ b/testsuite/clocktest/clocktest.c
@@ -246,13 +246,18 @@ int main(int argc, char *argv[])
        int i;
        int c;
        int d = 0;
+       int ext = 0;
 
-       while ((c = getopt(argc, argv, "C:T:D")) != EOF)
+       while ((c = getopt(argc, argv, "C:ET:D")) != EOF)
                switch (c) {
                case 'C':
                        clock_id = atoi(optarg);
                        break;
 
+               case 'E':
+                       ext = 1;
+                       break;
+
                case 'T':
                        alarm(atoi(optarg));
                        break;
@@ -264,6 +269,7 @@ int main(int argc, char *argv[])
                default:
                        fprintf(stderr, "usage: clocktest [options]\n"
                                "  [-C <clock_id>]              # tested clock, 
default=%d (CLOCK_REALTIME)\n"
+                               "  [-E]                         # -C specifies 
extension clock\n"
                                "  [-T <test_duration_seconds>] # default=0, so 
^C to end\n"
                                "  [-D]                         # print extra 
diagnostics for CLOCK_HOST_REALTIME\n",
                                CLOCK_REALTIME);
@@ -276,6 +282,8 @@ int main(int argc, char *argv[])
 
        init_lock(&lock);
 
+       if (ext)
+               clock_id = __COBALT_CLOCK_CODE(clock_id);
        if (d && clock_id == CLOCK_HOST_REALTIME)
                show_hostrt_diagnostics();
 
@@ -292,7 +300,8 @@ int main(int argc, char *argv[])
                               (void *)(long)i);
        }
 
-       printf("== Tested clock: %d (", clock_id);
+       printf("== Tested %sclock: %d (", ext ? "extension " : "",
+              __COBALT_CLOCK_INDEX(clock_id));
        switch (clock_id) {
        case CLOCK_REALTIME:
                printf("CLOCK_REALTIME");
@@ -302,6 +311,10 @@ int main(int argc, char *argv[])
                printf("CLOCK_MONOTONIC");
                break;
 
+       case CLOCK_MONOTONIC_RAW:
+               printf("CLOCK_MONOTONIC_RAW");
+               break;
+
        case CLOCK_HOST_REALTIME:
                printf("CLOCK_HOST_REALTIME");
                break;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to