Skip to content

Commit 911182c

Browse files
peter-mitsisaescolar
authored andcommitted
tests: latency_measure: Change reporting strings
Changes the summary lines used in the latency_measure benchmark so that they follow a consistent pattern. OBJECT action.<brief details about action> This makes it easier to locate results belonging to a particular object group. It also has the benefit to keep results colocated should the output be sorted by an external tool. Signed-off-by: Peter Mitsis <[email protected]>
1 parent 6291a57 commit 911182c

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

tests/benchmarks/latency_measure/src/heap_malloc_free.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ void heap_malloc_free(void)
6363
notes = "Memory heap too small--increase it.";
6464
}
6565

66-
PRINT_STATS_AVG("Average time for heap malloc", sum_malloc, count,
66+
PRINT_STATS_AVG("HEAP malloc.immediate", sum_malloc, count,
6767
failed, notes);
68-
PRINT_STATS_AVG("Average time for heap free", sum_free, count,
68+
PRINT_STATS_AVG("HEAP free.immediate", sum_free, count,
6969
failed, notes);
7070

7171
timing_stop();

tests/benchmarks/latency_measure/src/int_to_thread.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ int int_to_thread(uint32_t num_iterations)
174174

175175
sum -= timestamp_overhead_adjustment(0, 0);
176176

177-
PRINT_STATS_AVG("Switch from ISR back to interrupted thread",
177+
PRINT_STATS_AVG("ISR resume.interrupted.thread.kernel",
178178
(uint32_t)sum, num_iterations, false, "");
179179

180180
/* ************** */
@@ -183,7 +183,7 @@ int int_to_thread(uint32_t num_iterations)
183183

184184
sum -= timestamp_overhead_adjustment(0, 0);
185185

186-
PRINT_STATS_AVG("Switch from ISR to another thread (kernel)",
186+
PRINT_STATS_AVG("ISR resume.different.thread.kernel",
187187
(uint32_t)sum, num_iterations, false, "");
188188

189189
/* ************** */
@@ -193,7 +193,7 @@ int int_to_thread(uint32_t num_iterations)
193193

194194
sum -= timestamp_overhead_adjustment(0, K_USER);
195195

196-
PRINT_STATS_AVG("Switch from ISR to another thread (user)",
196+
PRINT_STATS_AVG("ISR resume.different.thread.user",
197197
(uint32_t)sum, num_iterations, false, "");
198198
#endif
199199

tests/benchmarks/latency_measure/src/mutex_lock_unlock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ int mutex_lock_unlock(uint32_t num_iterations, uint32_t options)
9494
k_sem_give(&pause_sem);
9595

9696
snprintf(description, sizeof(description),
97-
"Lock a mutex from %s thread",
97+
"MUTEX lock.immediate.recursive.%s",
9898
(options & K_USER) == K_USER ? "user" : "kernel");
9999
PRINT_STATS_AVG(description, (uint32_t)cycles, num_iterations,
100100
false, "");
101101

102102
cycles = timestamp.cycles;
103103

104104
snprintf(description, sizeof(description),
105-
"Unlock a mutex from %s thread",
105+
"MUTEX unlock.immediate.recursive.%s",
106106
(options & K_USER) == K_USER ? "user" : "kernel");
107107
PRINT_STATS_AVG(description, (uint32_t)cycles, num_iterations,
108108
false, "");

tests/benchmarks/latency_measure/src/sema_test_signal_release.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void sema_context_switch(uint32_t num_iterations,
139139
cycles -= timestamp_overhead_adjustment(start_options, alt_options);
140140

141141
snprintf(description, sizeof(description),
142-
"Take a semaphore (context switch %c -> %c)",
142+
"SEMAPHORE take.blocking.(%c -> %c)",
143143
((start_options & K_USER) == K_USER) ? 'U' : 'K',
144144
((alt_options & K_USER) == K_USER) ? 'U' : 'K');
145145
PRINT_STATS_AVG(description, (uint32_t)cycles,
@@ -155,7 +155,7 @@ void sema_context_switch(uint32_t num_iterations,
155155
cycles -= timestamp_overhead_adjustment(start_options, alt_options);
156156

157157
snprintf(description, sizeof(description),
158-
"Give a semaphore (context switch %c -> %c)",
158+
"SEMAPHORE give.wake+ctx.(%c -> %c)",
159159
((alt_options & K_USER) == K_USER) ? 'U' : 'K',
160160
((start_options & K_USER) == K_USER) ? 'U' : 'K');
161161
PRINT_STATS_AVG(description, (uint32_t)cycles,
@@ -255,7 +255,7 @@ int sema_test_signal(uint32_t num_iterations, uint32_t options)
255255
cycles = timestamp.cycles;
256256

257257
snprintf(description, sizeof(description),
258-
"Give a semaphore (no waiters) from %s thread",
258+
"SEMAPHORE give.immediate.%s",
259259
(options & K_USER) == K_USER ? "user" : "kernel");
260260

261261
PRINT_STATS_AVG(description, (uint32_t)cycles,
@@ -274,7 +274,7 @@ int sema_test_signal(uint32_t num_iterations, uint32_t options)
274274
cycles = timestamp.cycles;
275275

276276
snprintf(description, sizeof(description),
277-
"Take a semaphore (no blocking) from %s thread",
277+
"SEMAPHORE take.immediate.%s",
278278
(options & K_USER) == K_USER ? "user" : "kernel");
279279

280280
PRINT_STATS_AVG(description, (uint32_t)cycles,

tests/benchmarks/latency_measure/src/thread.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ int thread_ops(uint32_t num_iterations, uint32_t start_options, uint32_t alt_opt
248248
/* Only report stats if <start_thread> created <alt_thread> */
249249

250250
snprintf(description, sizeof(description),
251-
"Create %s thread from %s thread",
251+
"THREAD create.%s.from.%s",
252252
(alt_options & K_USER) != 0 ? "user" : "kernel",
253253
(start_options & K_USER) != 0 ? "user" : "kernel");
254254

@@ -261,7 +261,7 @@ int thread_ops(uint32_t num_iterations, uint32_t start_options, uint32_t alt_opt
261261
k_sem_give(&pause_sem);
262262

263263
snprintf(description, sizeof(description),
264-
"Start %s thread from %s thread",
264+
"THREAD start.%s.from.%s",
265265
(alt_options & K_USER) != 0 ? "user" : "kernel",
266266
(start_options & K_USER) != 0 ? "user" : "kernel");
267267

@@ -273,7 +273,7 @@ int thread_ops(uint32_t num_iterations, uint32_t start_options, uint32_t alt_opt
273273
k_sem_give(&pause_sem);
274274

275275
snprintf(description, sizeof(description),
276-
"Suspend %s thread from %s thread",
276+
"THREAD suspend.%s.from.%s",
277277
(alt_options & K_USER) != 0 ? "user" : "kernel",
278278
(start_options & K_USER) != 0 ? "user" : "kernel");
279279

@@ -285,7 +285,7 @@ int thread_ops(uint32_t num_iterations, uint32_t start_options, uint32_t alt_opt
285285
k_sem_give(&pause_sem);
286286

287287
snprintf(description, sizeof(description),
288-
"Resume %s thread from %s thread",
288+
"THREAD resume.%s.from.%s",
289289
(alt_options & K_USER) != 0 ? "user" : "kernel",
290290
(start_options & K_USER) != 0 ? "user" : "kernel");
291291

@@ -297,7 +297,7 @@ int thread_ops(uint32_t num_iterations, uint32_t start_options, uint32_t alt_opt
297297
k_sem_give(&pause_sem);
298298

299299
snprintf(description, sizeof(description),
300-
"Abort %s thread from %s thread",
300+
"THREAD abort.%s.from.%s",
301301
(alt_options & K_USER) != 0 ? "user" : "kernel",
302302
(start_options & K_USER) != 0 ? "user" : "kernel");
303303

tests/benchmarks/latency_measure/src/thread_switch_yield.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static void thread_switch_yield_common(const char *description,
131131
sum -= timestamp_overhead_adjustment(start_options, alt_options);
132132

133133
snprintf(summary, sizeof(summary),
134-
"%s (%c -> %c)",
134+
"%s.(%c -> %c)",
135135
description,
136136
(start_options & K_USER) == K_USER ? 'U' : 'K',
137137
(alt_options & K_USER) == K_USER ? 'U' : 'K');
@@ -148,8 +148,8 @@ void thread_switch_yield(uint32_t num_iterations, bool is_cooperative)
148148
: k_thread_priority_get(k_current_get()) - 1;
149149

150150
snprintf(description, sizeof(description),
151-
"%s threads ctx switch via k_yield",
152-
is_cooperative ? "Cooperative" : "Preemptive");
151+
"THREAD yield.%s.ctx",
152+
is_cooperative ? "cooperative" : "preemptive");
153153

154154
/* Kernel -> Kernel */
155155
thread_switch_yield_common(description, num_iterations, 0, 0,

0 commit comments

Comments
 (0)