OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <time.h> | 9 #include <time.h> |
| 10 #include <sys/time.h> |
10 | 11 |
11 #define DEFERRED_STRINGIFY(symbol) #symbol | 12 #define DEFERRED_STRINGIFY(symbol) #symbol |
12 #define SHOW(symbol) \ | 13 #define SHOW(symbol) \ |
13 do { \ | 14 do { \ |
14 printf("Current definition for %s is \"%s\".\n", \ | 15 printf("Current definition for %s is \"%s\".\n", \ |
15 #symbol, DEFERRED_STRINGIFY(symbol)); \ | 16 #symbol, DEFERRED_STRINGIFY(symbol)); \ |
16 } while (0) | 17 } while (0) |
17 | 18 |
18 void ShowCurrentDefinitions(void) { | 19 void ShowCurrentDefinitions(void) { |
19 SHOW(CLOCK_REALTIME); | 20 SHOW(CLOCK_REALTIME); |
(...skipping 26 matching lines...) Expand all Loading... |
46 int errs = 0; | 47 int errs = 0; |
47 | 48 |
48 ShowCurrentDefinitions(); | 49 ShowCurrentDefinitions(); |
49 | 50 |
50 errs += TimeTest(clock_getres, CLOCK_REALTIME, | 51 errs += TimeTest(clock_getres, CLOCK_REALTIME, |
51 "clock_getres on realtime clock failed", | 52 "clock_getres on realtime clock failed", |
52 "Realtime clock resolution"); | 53 "Realtime clock resolution"); |
53 errs += TimeTest(clock_getres, CLOCK_MONOTONIC, | 54 errs += TimeTest(clock_getres, CLOCK_MONOTONIC, |
54 "clock_getres on monotonic clock failed", | 55 "clock_getres on monotonic clock failed", |
55 "Monotonic clock resolution"); | 56 "Monotonic clock resolution"); |
| 57 errs += TimeTest(clock_getres, CLOCK_PROCESS_CPUTIME_ID, |
| 58 "clock_getres on process CPU-time clock failed", |
| 59 "Process CPU-time clock resolution"); |
| 60 errs += TimeTest(clock_getres, CLOCK_THREAD_CPUTIME_ID, |
| 61 "clock_getres on thread CPU-time clock failed", |
| 62 "Thread CPU-time clock resolution"); |
56 errs += TimeTest(clock_gettime, CLOCK_REALTIME, | 63 errs += TimeTest(clock_gettime, CLOCK_REALTIME, |
57 "clock_gettime on realtime clock failed", | 64 "clock_gettime on realtime clock failed", |
58 "Realtime clock value"); | 65 "Realtime clock value"); |
59 errs += TimeTest(clock_gettime, CLOCK_MONOTONIC, | 66 errs += TimeTest(clock_gettime, CLOCK_MONOTONIC, |
60 "clock_gettime on monotonic clock failed", | 67 "clock_gettime on monotonic clock failed", |
61 "Monotonic clock value"); | 68 "Monotonic clock value"); |
| 69 errs += TimeTest(clock_gettime, CLOCK_PROCESS_CPUTIME_ID, |
| 70 "clock_gettime on process CPU-time clock failed", |
| 71 "Process CPU-time clock value"); |
| 72 errs += TimeTest(clock_gettime, CLOCK_THREAD_CPUTIME_ID, |
| 73 "clock_gettime on thread CPU-time clock failed", |
| 74 "Thread CPU-time clock value"); |
62 return errs; | 75 return errs; |
63 } | 76 } |
OLD | NEW |