Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015 Cisco and/or its affiliates. |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | * you may not use this file except in compliance with the License. |
| 5 | * You may obtain a copy of the License at: |
| 6 | * |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | * |
| 9 | * Unless required by applicable law or agreed to in writing, software |
| 10 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | * See the License for the specific language governing permissions and |
| 13 | * limitations under the License. |
| 14 | */ |
| 15 | /* |
| 16 | Copyright (c) 2001, 2002, 2003 Eliot Dresselhaus |
| 17 | |
| 18 | Permission is hereby granted, free of charge, to any person obtaining |
| 19 | a copy of this software and associated documentation files (the |
| 20 | "Software"), to deal in the Software without restriction, including |
| 21 | without limitation the rights to use, copy, modify, merge, publish, |
| 22 | distribute, sublicense, and/or sell copies of the Software, and to |
| 23 | permit persons to whom the Software is furnished to do so, subject to |
| 24 | the following conditions: |
| 25 | |
| 26 | The above copyright notice and this permission notice shall be |
| 27 | included in all copies or substantial portions of the Software. |
| 28 | |
| 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 30 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 31 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 32 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 33 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 34 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 35 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 36 | */ |
| 37 | |
| 38 | #ifndef included_time_h |
| 39 | #define included_time_h |
| 40 | |
| 41 | #include <vppinfra/clib.h> |
Dave Barach | c25048b | 2020-01-29 18:05:24 -0500 | [diff] [blame] | 42 | #include <vppinfra/format.h> |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 43 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 44 | typedef struct |
| 45 | { |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 46 | /* Total run time in clock cycles |
| 47 | since clib_time_init call. */ |
| 48 | u64 total_cpu_time; |
| 49 | |
| 50 | /* Last recorded time stamp. */ |
| 51 | u64 last_cpu_time; |
| 52 | |
| 53 | /* CPU clock frequency. */ |
| 54 | f64 clocks_per_second; |
| 55 | |
| 56 | /* 1 / cpu clock frequency: conversion factor |
| 57 | from clock cycles into seconds. */ |
| 58 | f64 seconds_per_clock; |
| 59 | |
| 60 | /* Time stamp of call to clib_time_init call. */ |
| 61 | u64 init_cpu_time; |
Dave Barach | c25048b | 2020-01-29 18:05:24 -0500 | [diff] [blame] | 62 | f64 init_reference_time; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 63 | |
| 64 | u64 last_verify_cpu_time; |
| 65 | |
| 66 | /* Same but for reference time (if present). */ |
| 67 | f64 last_verify_reference_time; |
| 68 | |
| 69 | u32 log2_clocks_per_second, log2_clocks_per_frequency_verify; |
Dave Barach | c25048b | 2020-01-29 18:05:24 -0500 | [diff] [blame] | 70 | |
| 71 | /* Damping constant */ |
| 72 | f64 damping_constant; |
| 73 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 74 | } clib_time_t; |
| 75 | |
Dave Barach | c25048b | 2020-01-29 18:05:24 -0500 | [diff] [blame] | 76 | format_function_t format_clib_time; |
| 77 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 78 | /* Return CPU time stamp as 64bit number. */ |
| 79 | #if defined(__x86_64__) || defined(i386) |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 80 | always_inline u64 |
| 81 | clib_cpu_time_now (void) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 82 | { |
| 83 | u32 a, d; |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 84 | asm volatile ("rdtsc":"=a" (a), "=d" (d)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 85 | return (u64) a + ((u64) d << (u64) 32); |
| 86 | } |
| 87 | |
| 88 | #elif defined (__powerpc64__) |
| 89 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 90 | always_inline u64 |
| 91 | clib_cpu_time_now (void) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 92 | { |
| 93 | u64 t; |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 94 | asm volatile ("mftb %0":"=r" (t)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 95 | return t; |
| 96 | } |
| 97 | |
| 98 | #elif defined (__SPU__) |
| 99 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 100 | always_inline u64 |
| 101 | clib_cpu_time_now (void) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 102 | { |
| 103 | #ifdef _XLC |
| 104 | return spu_rdch (0x8); |
| 105 | #else |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 106 | return 0 /* __builtin_si_rdch (0x8) FIXME */ ; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 107 | #endif |
| 108 | } |
| 109 | |
| 110 | #elif defined (__powerpc__) |
| 111 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 112 | always_inline u64 |
| 113 | clib_cpu_time_now (void) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 114 | { |
| 115 | u32 hi1, hi2, lo; |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 116 | asm volatile ("1:\n" |
| 117 | "mftbu %[hi1]\n" |
| 118 | "mftb %[lo]\n" |
| 119 | "mftbu %[hi2]\n" |
| 120 | "cmpw %[hi1],%[hi2]\n" |
| 121 | "bne 1b\n":[hi1] "=r" (hi1),[hi2] "=r" (hi2),[lo] "=r" (lo)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 122 | return (u64) lo + ((u64) hi2 << (u64) 32); |
| 123 | } |
| 124 | |
Brian Brooks | c0379ae | 2018-01-09 16:39:07 -0600 | [diff] [blame] | 125 | #elif defined (__aarch64__) |
| 126 | always_inline u64 |
| 127 | clib_cpu_time_now (void) |
| 128 | { |
| 129 | u64 vct; |
| 130 | /* User access to cntvct_el0 is enabled in Linux kernel since 3.12. */ |
| 131 | asm volatile ("mrs %0, cntvct_el0":"=r" (vct)); |
| 132 | return vct; |
| 133 | } |
| 134 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 135 | #elif defined (__arm__) |
Christophe Fontaine | 9341a1f | 2016-05-13 07:07:28 +0000 | [diff] [blame] | 136 | #if defined(__ARM_ARCH_8A__) |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 137 | always_inline u64 |
| 138 | clib_cpu_time_now (void) /* We may run arm64 in aarch32 mode, to leverage 64bit counter */ |
Christophe Fontaine | fef15b4 | 2016-04-09 12:38:49 +0900 | [diff] [blame] | 139 | { |
| 140 | u64 tsc; |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 141 | asm volatile ("mrrc p15, 0, %Q0, %R0, c9":"=r" (tsc)); |
Christophe Fontaine | fef15b4 | 2016-04-09 12:38:49 +0900 | [diff] [blame] | 142 | return tsc; |
| 143 | } |
Christophe Fontaine | 9341a1f | 2016-05-13 07:07:28 +0000 | [diff] [blame] | 144 | #elif defined(__ARM_ARCH_7A__) |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 145 | always_inline u64 |
| 146 | clib_cpu_time_now (void) |
Christophe Fontaine | 9341a1f | 2016-05-13 07:07:28 +0000 | [diff] [blame] | 147 | { |
| 148 | u32 tsc; |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 149 | asm volatile ("mrc p15, 0, %0, c9, c13, 0":"=r" (tsc)); |
| 150 | return (u64) tsc; |
Christophe Fontaine | 9341a1f | 2016-05-13 07:07:28 +0000 | [diff] [blame] | 151 | } |
Christophe Fontaine | fef15b4 | 2016-04-09 12:38:49 +0900 | [diff] [blame] | 152 | #else |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 153 | always_inline u64 |
| 154 | clib_cpu_time_now (void) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 155 | { |
| 156 | u32 lo; |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 157 | asm volatile ("mrc p15, 0, %[lo], c15, c12, 1":[lo] "=r" (lo)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 158 | return (u64) lo; |
| 159 | } |
Christophe Fontaine | fef15b4 | 2016-04-09 12:38:49 +0900 | [diff] [blame] | 160 | #endif |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 161 | |
| 162 | #elif defined (__xtensa__) |
| 163 | |
| 164 | /* Stub for now. */ |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 165 | always_inline u64 |
| 166 | clib_cpu_time_now (void) |
| 167 | { |
| 168 | return 0; |
| 169 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 170 | |
| 171 | #elif defined (__TMS320C6X__) |
| 172 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 173 | always_inline u64 |
| 174 | clib_cpu_time_now (void) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 175 | { |
| 176 | u32 l, h; |
| 177 | |
| 178 | asm volatile (" dint\n" |
| 179 | " mvc .s2 TSCL,%0\n" |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 180 | " mvc .s2 TSCH,%1\n" " rint\n":"=b" (l), "=b" (h)); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 181 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 182 | return ((u64) h << 32) | l; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 183 | } |
| 184 | |
Carl Smith | 28d4271 | 2018-07-26 15:45:28 +1200 | [diff] [blame] | 185 | #elif defined(_mips) && __mips == 64 |
| 186 | |
| 187 | always_inline u64 |
| 188 | clib_cpu_time_now (void) |
| 189 | { |
| 190 | u64 result; |
| 191 | asm volatile ("rdhwr %0,$31\n":"=r" (result)); |
| 192 | return result; |
| 193 | } |
| 194 | |
Damjan Marion | 6eb0f84 | 2021-10-31 19:04:33 +0100 | [diff] [blame] | 195 | #elif defined(__riscv) |
| 196 | |
| 197 | always_inline u64 |
| 198 | clib_cpu_time_now (void) |
| 199 | { |
| 200 | u64 result; |
| 201 | asm volatile("rdcycle %0\n" : "=r"(result)); |
| 202 | return result; |
| 203 | } |
Dave Barach | 61efa14 | 2016-01-22 08:23:09 -0500 | [diff] [blame] | 204 | #else |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 205 | #error "don't know how to read CPU time stamp" |
| 206 | |
| 207 | #endif |
| 208 | |
| 209 | void clib_time_verify_frequency (clib_time_t * c); |
| 210 | |
Florin Coras | a8e71c8 | 2019-10-22 19:01:39 -0700 | [diff] [blame] | 211 | /* Define it as the type returned by clib_time_now */ |
| 212 | typedef f64 clib_time_type_t; |
| 213 | typedef u64 clib_us_time_t; |
| 214 | |
| 215 | #define CLIB_US_TIME_PERIOD (1e-6) |
| 216 | #define CLIB_US_TIME_FREQ (1.0/CLIB_US_TIME_PERIOD) |
| 217 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 218 | always_inline f64 |
| 219 | clib_time_now_internal (clib_time_t * c, u64 n) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 220 | { |
| 221 | u64 l = c->last_cpu_time; |
| 222 | u64 t = c->total_cpu_time; |
Dave Barach | e52d8d8 | 2019-12-01 08:59:03 -0500 | [diff] [blame] | 223 | f64 rv; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 224 | t += n - l; |
| 225 | c->total_cpu_time = t; |
| 226 | c->last_cpu_time = n; |
Dave Barach | e52d8d8 | 2019-12-01 08:59:03 -0500 | [diff] [blame] | 227 | rv = t * c->seconds_per_clock; |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 228 | if (PREDICT_FALSE |
| 229 | ((c->last_cpu_time - |
| 230 | c->last_verify_cpu_time) >> c->log2_clocks_per_frequency_verify)) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 231 | clib_time_verify_frequency (c); |
Dave Barach | e52d8d8 | 2019-12-01 08:59:03 -0500 | [diff] [blame] | 232 | return rv; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 233 | } |
| 234 | |
John Lo | 7f358b3 | 2018-04-28 01:19:24 -0400 | [diff] [blame] | 235 | /* Maximum f64 value as max clib_time */ |
| 236 | #define CLIB_TIME_MAX (1.7976931348623157e+308) |
| 237 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 238 | always_inline f64 |
| 239 | clib_time_now (clib_time_t * c) |
| 240 | { |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 241 | return clib_time_now_internal (c, clib_cpu_time_now ()); |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 242 | } |
| 243 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 244 | always_inline void |
| 245 | clib_cpu_time_wait (u64 dt) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 246 | { |
| 247 | u64 t_end = clib_cpu_time_now () + dt; |
| 248 | while (clib_cpu_time_now () < t_end) |
| 249 | ; |
| 250 | } |
| 251 | |
| 252 | void clib_time_init (clib_time_t * c); |
| 253 | |
| 254 | #ifdef CLIB_UNIX |
| 255 | |
| 256 | #include <time.h> |
| 257 | #include <sys/time.h> |
| 258 | #include <sys/resource.h> |
| 259 | #include <unistd.h> |
| 260 | #include <sys/syscall.h> |
| 261 | |
| 262 | /* Use 64bit floating point to represent time offset from epoch. */ |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 263 | always_inline f64 |
| 264 | unix_time_now (void) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 265 | { |
Damjan Marion | 4dffd1c | 2018-09-03 12:30:36 +0200 | [diff] [blame] | 266 | struct timespec ts; |
| 267 | #ifdef __MACH__ |
| 268 | clock_gettime (CLOCK_REALTIME, &ts); |
| 269 | #else |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 270 | /* clock_gettime without indirect syscall uses GLIBC wrappers which |
| 271 | we don't want. Just the bare metal, please. */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 272 | syscall (SYS_clock_gettime, CLOCK_REALTIME, &ts); |
Damjan Marion | 4dffd1c | 2018-09-03 12:30:36 +0200 | [diff] [blame] | 273 | #endif |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 274 | return ts.tv_sec + 1e-9 * ts.tv_nsec; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | /* As above but integer number of nano-seconds. */ |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 278 | always_inline u64 |
| 279 | unix_time_now_nsec (void) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 280 | { |
| 281 | struct timespec ts; |
Damjan Marion | 4dffd1c | 2018-09-03 12:30:36 +0200 | [diff] [blame] | 282 | #ifdef __MACH__ |
| 283 | clock_gettime (CLOCK_REALTIME, &ts); |
| 284 | #else |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 285 | syscall (SYS_clock_gettime, CLOCK_REALTIME, &ts); |
Damjan Marion | 4dffd1c | 2018-09-03 12:30:36 +0200 | [diff] [blame] | 286 | #endif |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 287 | return 1e9 * ts.tv_sec + ts.tv_nsec; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 288 | } |
| 289 | |
Ole Troan | ed92925 | 2017-06-13 21:15:40 +0200 | [diff] [blame] | 290 | always_inline void |
| 291 | unix_time_now_nsec_fraction (u32 * sec, u32 * nsec) |
| 292 | { |
| 293 | struct timespec ts; |
Damjan Marion | 4dffd1c | 2018-09-03 12:30:36 +0200 | [diff] [blame] | 294 | #ifdef __MACH__ |
| 295 | clock_gettime (CLOCK_REALTIME, &ts); |
| 296 | #else |
Ole Troan | ed92925 | 2017-06-13 21:15:40 +0200 | [diff] [blame] | 297 | syscall (SYS_clock_gettime, CLOCK_REALTIME, &ts); |
Damjan Marion | 4dffd1c | 2018-09-03 12:30:36 +0200 | [diff] [blame] | 298 | #endif |
Ole Troan | ed92925 | 2017-06-13 21:15:40 +0200 | [diff] [blame] | 299 | *sec = ts.tv_sec; |
| 300 | *nsec = ts.tv_nsec; |
| 301 | } |
| 302 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 303 | always_inline f64 |
| 304 | unix_usage_now (void) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 305 | { |
| 306 | struct rusage u; |
| 307 | getrusage (RUSAGE_SELF, &u); |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 308 | return u.ru_utime.tv_sec + 1e-6 * u.ru_utime.tv_usec |
| 309 | + u.ru_stime.tv_sec + 1e-6 * u.ru_stime.tv_usec; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 310 | } |
| 311 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 312 | always_inline void |
| 313 | unix_sleep (f64 dt) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 314 | { |
Dave Barach | b9f2cf0 | 2017-10-17 13:13:42 -0400 | [diff] [blame] | 315 | struct timespec ts, tsrem; |
| 316 | ts.tv_sec = dt; |
| 317 | ts.tv_nsec = 1e9 * (dt - (f64) ts.tv_sec); |
| 318 | |
| 319 | while (nanosleep (&ts, &tsrem) < 0) |
| 320 | ts = tsrem; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 321 | } |
| 322 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 323 | #else /* ! CLIB_UNIX */ |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 324 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 325 | always_inline f64 |
| 326 | unix_time_now (void) |
| 327 | { |
| 328 | return 0; |
| 329 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 330 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 331 | always_inline u64 |
| 332 | unix_time_now_nsec (void) |
| 333 | { |
| 334 | return 0; |
| 335 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 336 | |
Ole Troan | ed92925 | 2017-06-13 21:15:40 +0200 | [diff] [blame] | 337 | always_inline void |
| 338 | unix_time_now_nsec_fraction (u32 * sec, u32 * nsec) |
| 339 | { |
| 340 | } |
| 341 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 342 | always_inline f64 |
| 343 | unix_usage_now (void) |
| 344 | { |
| 345 | return 0; |
| 346 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 347 | |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 348 | always_inline void |
| 349 | unix_sleep (f64 dt) |
| 350 | { |
| 351 | } |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 352 | |
| 353 | #endif |
| 354 | |
| 355 | #endif /* included_time_h */ |
Dave Barach | c379999 | 2016-08-15 11:12:27 -0400 | [diff] [blame] | 356 | |
| 357 | /* |
| 358 | * fd.io coding-style-patch-verification: ON |
| 359 | * |
| 360 | * Local Variables: |
| 361 | * eval: (c-set-style "gnu") |
| 362 | * End: |
| 363 | */ |