Skip to content

Commit 6f72938

Browse files
nashifMaureenHelm
authored andcommitted
tests: timestamp: minor cleanup
Minor cleanup and fixes. Signed-off-by: Anas Nashif <[email protected]>
1 parent e90a4bb commit 6f72938

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

subsys/testsuite/include/timestamp.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#endif
2424

2525

26-
#define TICK_SYNCH() k_sleep(K_MSEC(1))
26+
#define TICK_SYNCH() k_sleep(K_TICKS(1))
2727

2828
#define OS_GET_TIME() k_cycle_get_32()
2929

@@ -59,35 +59,35 @@ static inline void bench_test_init(void)
5959

6060

6161
/* timestamp for checks */
62-
static int64_t tCheck;
62+
static int64_t timestamp_check;
6363

6464
/*
6565
* 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
6767
* high precision timer register overflow.
68-
* Functions modify the tCheck global variable.
68+
* Functions modify the timestamp_check global variable.
6969
*/
7070
static inline void bench_test_start(void)
7171
{
72-
tCheck = 0;
72+
timestamp_check = 0;
7373
/* before reading time we synchronize to the start of the timer tick */
7474
TICK_SYNCH();
75-
tCheck = k_uptime_delta(&tCheck);
75+
timestamp_check = k_uptime_delta(&timestamp_check);
7676
}
7777

7878

7979
/* returns 0 if the completed within a second and -1 if not */
8080
static inline int bench_test_end(void)
8181
{
82-
tCheck = k_uptime_delta(&tCheck);
82+
timestamp_check = k_uptime_delta(&timestamp_check);
8383

8484
/* Flag an error if the test ran for more than a second.
8585
* (Note: Existing benchmarks have CONFIG_SYS_CLOCK_TICKS_PER_SEC=1 set,
8686
* in such configs this check can be an indicator of whether
8787
* timer tick interrupt overheads too are getting accounted towards
8888
* benchmark time)
8989
*/
90-
if (tCheck >= MSEC_PER_SEC) {
90+
if (timestamp_check >= MSEC_PER_SEC) {
9191
return -1;
9292
}
9393
return 0;
@@ -104,7 +104,7 @@ static inline int high_timer_overflow(void)
104104
/* Check if the time elapsed in msec is sufficient to trigger an
105105
* overflow of the high precision timer
106106
*/
107-
if (tCheck >= (k_cyc_to_ns_floor64(UINT_MAX) /
107+
if (timestamp_check >= (k_cyc_to_ns_floor64(UINT_MAX) /
108108
(NSEC_PER_USEC * USEC_PER_MSEC))) {
109109
return -1;
110110
}

tests/benchmarks/sys_kernel/src/syskernel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void begin_test(void)
4444
{
4545
/*
4646
* Invoke bench_test_start in order to be able to use
47-
* tCheck static variable.
47+
* timestamp_check static variable.
4848
*/
4949
bench_test_start();
5050
}
@@ -61,7 +61,7 @@ void begin_test(void)
6161
int check_result(int i, uint32_t t)
6262
{
6363
/*
64-
* bench_test_end checks tCheck static variable.
64+
* bench_test_end checks timestamp_check static variable.
6565
* bench_test_start modifies it
6666
*/
6767
if (bench_test_end() != 0) {

0 commit comments

Comments
 (0)