|
16 | 16 | #include "timing_sc.h"
|
17 | 17 | #include <zephyr/tc_util.h>
|
18 | 18 |
|
19 |
| -#define NUM_ITERATIONS 10000 |
20 |
| - |
21 | 19 | #define STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACK_SIZE)
|
22 | 20 |
|
23 | 21 | uint32_t tm_off;
|
@@ -79,77 +77,77 @@ static void test_thread(void *arg1, void *arg2, void *arg3)
|
79 | 77 | TC_START("Time Measurement");
|
80 | 78 | TC_PRINT("Timing results: Clock frequency: %u MHz\n", freq);
|
81 | 79 |
|
82 |
| - timestamp_overhead_init(NUM_ITERATIONS); |
| 80 | + timestamp_overhead_init(CONFIG_BENCHMARK_NUM_ITERATIONS); |
83 | 81 |
|
84 | 82 | /* Preemptive threads context switching */
|
85 |
| - thread_switch_yield(NUM_ITERATIONS, false); |
| 83 | + thread_switch_yield(CONFIG_BENCHMARK_NUM_ITERATIONS, false); |
86 | 84 |
|
87 | 85 | /* Cooperative threads context switching */
|
88 |
| - thread_switch_yield(NUM_ITERATIONS, true); |
| 86 | + thread_switch_yield(CONFIG_BENCHMARK_NUM_ITERATIONS, true); |
89 | 87 |
|
90 |
| - int_to_thread(NUM_ITERATIONS); |
| 88 | + int_to_thread(CONFIG_BENCHMARK_NUM_ITERATIONS); |
91 | 89 |
|
92 | 90 | /* Thread creation, starting, suspending, resuming and aborting. */
|
93 | 91 |
|
94 |
| - thread_ops(NUM_ITERATIONS, 0, 0); |
| 92 | + thread_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, 0, 0); |
95 | 93 | #ifdef CONFIG_USERSPACE
|
96 |
| - thread_ops(NUM_ITERATIONS, 0, K_USER); |
97 |
| - thread_ops(NUM_ITERATIONS, K_USER, K_USER); |
98 |
| - thread_ops(NUM_ITERATIONS, K_USER, 0); |
| 94 | + thread_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, 0, K_USER); |
| 95 | + thread_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER, K_USER); |
| 96 | + thread_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER, 0); |
99 | 97 | #endif
|
100 | 98 |
|
101 |
| - fifo_ops(NUM_ITERATIONS, 0); |
| 99 | + fifo_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, 0); |
102 | 100 | #ifdef CONFIG_USERSPACE
|
103 |
| - fifo_ops(NUM_ITERATIONS, K_USER); |
| 101 | + fifo_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER); |
104 | 102 | #endif
|
105 | 103 |
|
106 |
| - fifo_blocking_ops(NUM_ITERATIONS, 0, 0); |
| 104 | + fifo_blocking_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, 0, 0); |
107 | 105 | #ifdef CONFIG_USERSPACE
|
108 |
| - fifo_blocking_ops(NUM_ITERATIONS, 0, K_USER); |
109 |
| - fifo_blocking_ops(NUM_ITERATIONS, K_USER, 0); |
110 |
| - fifo_blocking_ops(NUM_ITERATIONS, K_USER, K_USER); |
| 106 | + fifo_blocking_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, 0, K_USER); |
| 107 | + fifo_blocking_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER, 0); |
| 108 | + fifo_blocking_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER, K_USER); |
111 | 109 | #endif
|
112 | 110 |
|
113 | 111 |
|
114 |
| - lifo_ops(NUM_ITERATIONS, 0); |
| 112 | + lifo_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, 0); |
115 | 113 | #ifdef CONFIG_USERSPACE
|
116 |
| - lifo_ops(NUM_ITERATIONS, K_USER); |
| 114 | + lifo_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER); |
117 | 115 | #endif
|
118 | 116 |
|
119 |
| - lifo_blocking_ops(NUM_ITERATIONS, 0, 0); |
| 117 | + lifo_blocking_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, 0, 0); |
120 | 118 | #ifdef CONFIG_USERSPACE
|
121 |
| - lifo_blocking_ops(NUM_ITERATIONS, 0, K_USER); |
122 |
| - lifo_blocking_ops(NUM_ITERATIONS, K_USER, 0); |
123 |
| - lifo_blocking_ops(NUM_ITERATIONS, K_USER, K_USER); |
| 119 | + lifo_blocking_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, 0, K_USER); |
| 120 | + lifo_blocking_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER, 0); |
| 121 | + lifo_blocking_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER, K_USER); |
124 | 122 | #endif
|
125 | 123 |
|
126 |
| - event_ops(NUM_ITERATIONS, 0); |
| 124 | + event_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, 0); |
127 | 125 | #ifdef CONFIG_USERSPACE
|
128 |
| - event_ops(NUM_ITERATIONS, K_USER); |
| 126 | + event_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER); |
129 | 127 | #endif
|
130 | 128 |
|
131 |
| - event_blocking_ops(NUM_ITERATIONS, 0, 0); |
| 129 | + event_blocking_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, 0, 0); |
132 | 130 | #ifdef CONFIG_USERSPACE
|
133 |
| - event_blocking_ops(NUM_ITERATIONS, 0, K_USER); |
134 |
| - event_blocking_ops(NUM_ITERATIONS, K_USER, 0); |
135 |
| - event_blocking_ops(NUM_ITERATIONS, K_USER, K_USER); |
| 131 | + event_blocking_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, 0, K_USER); |
| 132 | + event_blocking_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER, 0); |
| 133 | + event_blocking_ops(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER, K_USER); |
136 | 134 | #endif
|
137 | 135 |
|
138 |
| - sema_test_signal(NUM_ITERATIONS, 0); |
| 136 | + sema_test_signal(CONFIG_BENCHMARK_NUM_ITERATIONS, 0); |
139 | 137 | #ifdef CONFIG_USERSPACE
|
140 |
| - sema_test_signal(NUM_ITERATIONS, K_USER); |
| 138 | + sema_test_signal(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER); |
141 | 139 | #endif
|
142 | 140 |
|
143 |
| - sema_context_switch(NUM_ITERATIONS, 0, 0); |
| 141 | + sema_context_switch(CONFIG_BENCHMARK_NUM_ITERATIONS, 0, 0); |
144 | 142 | #ifdef CONFIG_USERSPACE
|
145 |
| - sema_context_switch(NUM_ITERATIONS, 0, K_USER); |
146 |
| - sema_context_switch(NUM_ITERATIONS, K_USER, 0); |
147 |
| - sema_context_switch(NUM_ITERATIONS, K_USER, K_USER); |
| 143 | + sema_context_switch(CONFIG_BENCHMARK_NUM_ITERATIONS, 0, K_USER); |
| 144 | + sema_context_switch(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER, 0); |
| 145 | + sema_context_switch(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER, K_USER); |
148 | 146 | #endif
|
149 | 147 |
|
150 |
| - mutex_lock_unlock(NUM_ITERATIONS, 0); |
| 148 | + mutex_lock_unlock(CONFIG_BENCHMARK_NUM_ITERATIONS, 0); |
151 | 149 | #ifdef CONFIG_USERSPACE
|
152 |
| - mutex_lock_unlock(NUM_ITERATIONS, K_USER); |
| 150 | + mutex_lock_unlock(CONFIG_BENCHMARK_NUM_ITERATIONS, K_USER); |
153 | 151 | #endif
|
154 | 152 |
|
155 | 153 | heap_malloc_free();
|
|
0 commit comments