Commit 7d8ea99
fix(benchmarks): use get_host_us_time() from native_sim timer_model.c
All previous approaches (clock_gettime, syscall, k_uptime, nsi_host_*)
returned 0 because native_sim intercepts them all at the binary level and
maps them to the simulated Zephyr clock (which doesn't advance during
CPU-bound loops).
get_host_us_time() is defined in timer_model.c (the native_sim hardware
timer model, compiled into the same binary) and calls CLOCK_MONOTONIC_RAW
directly from the OS timer model layer, BEFORE any Zephyr-level intercept.
It is the function native_sim itself uses to obtain real host time for
real-time mode synchronization -- it cannot be intercepted.
Returns µs * 1000 for nanosecond output.
Co-Authored-By: Oz <oz-agent@warp.dev>1 parent e3b40ba commit 7d8ea99
2 files changed
Lines changed: 8 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 27 | + | |
34 | 28 | | |
35 | 29 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 30 | + | |
39 | 31 | | |
40 | 32 | | |
41 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
27 | 26 | | |
28 | 27 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 28 | + | |
32 | 29 | | |
33 | 30 | | |
34 | 31 | | |
| |||
0 commit comments