23
23
#endif
24
24
25
25
26
- #define TICK_SYNCH () k_sleep(K_MSEC (1))
26
+ #define TICK_SYNCH () k_sleep(K_TICKS (1))
27
27
28
28
#define OS_GET_TIME () k_cycle_get_32()
29
29
@@ -59,35 +59,35 @@ static inline void bench_test_init(void)
59
59
60
60
61
61
/* timestamp for checks */
62
- static int64_t tCheck ;
62
+ static int64_t timestamp_check ;
63
63
64
64
/*
65
65
* Routines are invoked before and after the benchmark and check
66
- * if penchmarking code took less time than necessary for the
66
+ * if benchmarking code took less time than necessary for the
67
67
* high precision timer register overflow.
68
- * Functions modify the tCheck global variable.
68
+ * Functions modify the timestamp_check global variable.
69
69
*/
70
70
static inline void bench_test_start (void )
71
71
{
72
- tCheck = 0 ;
72
+ timestamp_check = 0 ;
73
73
/* before reading time we synchronize to the start of the timer tick */
74
74
TICK_SYNCH ();
75
- tCheck = k_uptime_delta (& tCheck );
75
+ timestamp_check = k_uptime_delta (& timestamp_check );
76
76
}
77
77
78
78
79
79
/* returns 0 if the completed within a second and -1 if not */
80
80
static inline int bench_test_end (void )
81
81
{
82
- tCheck = k_uptime_delta (& tCheck );
82
+ timestamp_check = k_uptime_delta (& timestamp_check );
83
83
84
84
/* Flag an error if the test ran for more than a second.
85
85
* (Note: Existing benchmarks have CONFIG_SYS_CLOCK_TICKS_PER_SEC=1 set,
86
86
* in such configs this check can be an indicator of whether
87
87
* timer tick interrupt overheads too are getting accounted towards
88
88
* benchmark time)
89
89
*/
90
- if (tCheck >= MSEC_PER_SEC ) {
90
+ if (timestamp_check >= MSEC_PER_SEC ) {
91
91
return -1 ;
92
92
}
93
93
return 0 ;
@@ -104,7 +104,7 @@ static inline int high_timer_overflow(void)
104
104
/* Check if the time elapsed in msec is sufficient to trigger an
105
105
* overflow of the high precision timer
106
106
*/
107
- if (tCheck >= (k_cyc_to_ns_floor64 (UINT_MAX ) /
107
+ if (timestamp_check >= (k_cyc_to_ns_floor64 (UINT_MAX ) /
108
108
(NSEC_PER_USEC * USEC_PER_MSEC ))) {
109
109
return -1 ;
110
110
}
0 commit comments