Debian Codegraph @

src/cyclictest/cyclictest.c

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-2.0-onlycxx . . $ `<file>/src/cyclictest/cyclictest.c`/
2 /*
3 * High resolution timer test software
4 *
5 * (C) 2013 Clark Williams <[email protected]>
6 * (C) 2013 John Kacur <[email protected]>
7 * (C) 2008-2012 Clark Williams <[email protected]>
8 * (C) 2005-2007 Thomas Gleixner <[email protected]>
9 *
10 */
11 #ifdef HAVE_LIBCPUPOWER_SUPPORTcxx . . $ `<built-in>:414:9`!
12 #include <cpuidle.h>
13 #endif /* HAVE_LIBCPUPOWER_SUPPORT */
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <stdint.h>
17 #include <stdarg.h>
18 #include <unistd.h>
19 #include <fcntl.h>
20 #include <getopt.h>
21 #include <pthread.h>
22 #include <signal.h>
23 #include <sched.h>
24 #include <string.h>
25 #include <time.h>
26 #include <errno.h>
27 #include <limits.h>
28
29 #include <sys/stat.h>
30 #include <sys/types.h>
31 #include <sys/time.h>
32 #include <sys/resource.h>
33 #include <sys/utsname.h>
34 #include <sys/mman.h>
35 #include <sys/syscall.h>
36 #include "rt_numa.h"cxx . . $ `<file>/src/cyclictest/rt_numa.h`/
37
38 #include "rt-utils.h"cxx . . $ `<file>/src/include/rt-utils.h`/
39 #include "rt-numa.h"cxx . . $ `<file>/src/include/rt-numa.h`/
40 #include "rt-error.h"cxx . . $ `<file>/src/include/rt-error.h`/
41 #include "histogram.h"cxx . . $ `<file>/src/include/histogram.h`/
42
43 #include <bionic.h>cxx . . $ `<file>/src/include/bionic.h`/
44
45 #define DEFAULT_INTERVALcxx . . $ `src/cyclictest/cyclictest.c:45:9`! 1000
46 #define DEFAULT_DISTANCEcxx . . $ `src/cyclictest/cyclictest.c:46:9`! 500
47
48 #ifndef SCHED_IDLEcxx . . $ `<external>/4872883757279652994/sched.h:35:10`!
49 #define SCHED_IDLE 5
50 #endif
51 #ifndef SCHED_NORMALcxx . . $ `<external>/4872883757279652994/sched.h:32:10`!
52 #define SCHED_NORMAL SCHED_OTHER
53 #endif
54
55 #define sigev_notify_thread_idcxx . . $ `src/cyclictest/cyclictest.c:55:9`! _sigev_un._tid
56
57 #ifdef __UCLIBC__
58 #define MAKE_PROCESS_CPUCLOCK(pid, clock) \
59 ((~(clockid_t) (pid) << 3) | (clockid_t) (clock))
60 #define CPUCLOCK_SCHED 2
61
62 static int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *req,
63 struct timespec *rem)
64 {
65 if (clock_id == CLOCK_THREAD_CPUTIME_ID)
66 return -EINVAL;
67 if (clock_id == CLOCK_PROCESS_CPUTIME_ID)
68 clock_id = MAKE_PROCESS_CPUCLOCK(0, CPUCLOCK_SCHED);
69
70 return syscall(__NR_clock_nanosleep, clock_id, flags, req, rem);
71 }
72
73 int sched_setaffinity(__pid_t __pid, size_t __cpusetsize,
74 __const cpu_set_t *__cpuset)
75 {
76 return -EINVAL;
77 }
78
79 #undef CPU_SET
80 #undef CPU_ZERO
81 #define CPU_SET(cpu, cpusetp)
82 #define CPU_ZERO(cpusetp)
83
84 #else
85 extern int clock_nanosleepcxx . . $ clock_nanosleep(99dc002056e22615).(clockid_tcxx . . $ clockid_t# __clock_id, int __flags,
86 __const struct timespeccxx . . $ timespec# *__req,
87 struct timespeccxx . . $ timespec# *__rem);
88 #endif /* __UCLIBC__ */
89
90 #define HIST_MAXcxx . . $ `src/cyclictest/cyclictest.c:90:9`! 1000000
91
92 #define MODE_CYCLICcxx . . $ `src/cyclictest/cyclictest.c:92:9`! 0
93 #define MODE_CLOCK_NANOSLEEPcxx . . $ `src/cyclictest/cyclictest.c:93:9`! 1
94 #define MODE_SYS_ITIMERcxx . . $ `src/cyclictest/cyclictest.c:94:9`! 2
95 #define MODE_SYS_NANOSLEEPcxx . . $ `src/cyclictest/cyclictest.c:95:9`! 3
96 #define MODE_SYS_OFFSETcxx . . $ `src/cyclictest/cyclictest.c:96:9`! 2
97
98 #define TIMER_RELTIMEcxx . . $ `src/cyclictest/cyclictest.c:98:9`! 0
99
100 /* Must be power of 2 ! */
101 #define VALBUF_SIZEcxx . . $ `src/cyclictest/cyclictest.c:101:9`! 16384
102
103 #if (defined(__i386__) || defined(__x86_64__cxx . . $ `<built-in>:374:9`!))
104 #define ARCH_HAS_SMI_COUNTERcxx . . $ `src/cyclictest/cyclictest.c:104:9`!
105 #endif
106
107 #define MSR_SMI_COUNTcxx . . $ `src/cyclictest/cyclictest.c:107:9`! 0x00000034
108 #define MSR_SMI_COUNT_MASKcxx . . $ `src/cyclictest/cyclictest.c:108:9`! 0xFFFFFFFF
109
110 static char *policynamecxx . . $ policyname(ff224f080444ee45).(int policy);
111
112 /* Struct to transfer parameters to the thread */
113 struct thread_paramcxx . . $ thread_param# {
114 int priocxx . . $ thread_param#prio.;
115 int policycxx . . $ thread_param#policy.;
116 int modecxx . . $ thread_param#mode.;
117 int timermodecxx . . $ thread_param#timermode.;
118 int signalcxx . . $ thread_param#signal.;
119 int clockcxx . . $ thread_param#clock.;
120 unsigned long max_cyclescxx . . $ thread_param#max_cycles.;
121 struct thread_statcxx . . $ thread_stat# *statscxx . . $ thread_param#stats.;
122 int bufmskcxx . . $ thread_param#bufmsk.;
123 unsigned long intervalcxx . . $ thread_param#interval.;
124 int cpucxx . . $ thread_param#cpu.;
125 int nodecxx . . $ thread_param#node.;
126 int tnumcxx . . $ thread_param#tnum.;
127 int msr_fdcxx . . $ thread_param#msr_fd.;
128 };
129
130 /* Struct for statistics */
131 struct thread_statcxx . . $ thread_stat# {
132 unsigned long cyclescxx . . $ thread_stat#cycles.;
133 unsigned long cyclesreadcxx . . $ thread_stat#cyclesread.;
134 long mincxx . . $ thread_stat#min.;
135 long maxcxx . . $ thread_stat#max.;
136 long actcxx . . $ thread_stat#act.;
137 double avgcxx . . $ thread_stat#avg.;
138 long *valuescxx . . $ thread_stat#values.;
139 long *smiscxx . . $ thread_stat#smis.;
140 struct histogramcxx . . $ histogram# *histcxx . . $ thread_stat#hist.;
141 pthread_tcxx . . $ pthread_t# threadcxx . . $ thread_stat#thread.;
142 int threadstartedcxx . . $ thread_stat#threadstarted.;
143 int tidcxx . . $ thread_stat#tid.;
144 long reducecxx . . $ thread_stat#reduce.;
145 long redmaxcxx . . $ thread_stat#redmax.;
146 long cycleofmaxcxx . . $ thread_stat#cycleofmax.;
147 unsigned long smi_countcxx . . $ thread_stat#smi_count.;
148 };
149
150 static pthread_mutex_tcxx . . $ pthread_mutex_t# trigger_lockcxx . . $ trigger_lock. = PTHREAD_MUTEX_INITIALIZERcxx . . $ `<external>/14712363683955484316/pthread.h:90:9`!;
151
152 static int triggercxx . . $ trigger. = 0; /* Record spikes > trigger, 0 means don't record */
153 static int trigger_list_sizecxx . . $ trigger_list_size. = 1024; /* Number of list nodes */
154
155 /* Info to store when the diff is greater than the trigger */
156 struct thread_triggercxx . . $ thread_trigger# {
157 int cpucxx . . $ thread_trigger#cpu.;
158 int tnumcxx . . $ thread_trigger#tnum.; /* thread number */
159 int64_tcxx . . $ int64_t# tscxx . . $ thread_trigger#ts.; /* time-stamp */
160 int diffcxx . . $ thread_trigger#diff.;
161 struct thread_triggercxx . . $ thread_trigger# *nextcxx . . $ thread_trigger#next.;
162 };
163
164 struct thread_triggercxx . . $ thread_trigger# *headcxx . . $ head. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
165 struct thread_triggercxx . . $ thread_trigger# *tailcxx . . $ tail. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
166 struct thread_triggercxx . . $ thread_trigger# *currentcxx . . $ current. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
167 static int spikescxx . . $ spikes.; /* count of the number of spikes */
168
169 static int trigger_initcxx . . $ trigger_init(d1b40a211a1a4e4c).();
170 static void trigger_printcxx . . $ trigger_print(d878ad36e69247c7).();
171 static void trigger_updatecxx . . $ trigger_update(4178c2305174e7b9).(struct thread_paramcxx . . $ thread_param# *par, int diff, int64_tcxx . . $ int64_t# ts);
172
173 static int shutdowncxx . . $ shutdown.;
174 static int tracelimitcxx . . $ tracelimit. = 0;
175 static int trace_markercxx . . $ trace_marker. = 0;
176 static int verbosecxx . . $ verbose. = 0;
177 static int oscope_reductioncxx . . $ oscope_reduction. = 1;
178 static int lockallcxx . . $ lockall. = 0;
179 static int histogramcxx . . $ histogram. = 0;
180 static int histofallcxx . . $ histofall. = 0;
181 static int durationcxx . . $ duration. = 0;
182 static int use_nsecscxx . . $ use_nsecs. = 0;
183 static int refresh_on_maxcxx . . $ refresh_on_max.;
184 static int force_sched_othercxx . . $ force_sched_other.;
185 static int priospreadcxx . . $ priospread. = 0;
186 static int check_clock_resolutioncxx . . $ check_clock_resolution.;
187 static int ct_debugcxx . . $ ct_debug.;
188 static int use_fifocxx . . $ use_fifo. = 0;
189 static pthread_tcxx . . $ pthread_t# fifo_threadidcxx . . $ fifo_threadid.;
190 static int laptopcxx . . $ laptop. = 0;
191 static int power_managementcxx . . $ power_management. = 0;
192 static int use_histfilecxx . . $ use_histfile. = 0;
193
194 #ifdef ARCH_HAS_SMI_COUNTERcxx . . $ `src/cyclictest/cyclictest.c:104:9`!
195 static int smicxx . . $ smi. = 0;
196 #else
197 #define smi 0
198 #endif
199
200 static pthread_cond_tcxx . . $ pthread_cond_t# refresh_on_max_condcxx . . $ refresh_on_max_cond. = PTHREAD_COND_INITIALIZERcxx . . $ `<external>/14712363683955484316/pthread.h:155:9`!;
201 static pthread_mutex_tcxx . . $ pthread_mutex_t# refresh_on_max_lockcxx . . $ refresh_on_max_lock. = PTHREAD_MUTEX_INITIALIZERcxx . . $ `<external>/14712363683955484316/pthread.h:90:9`!;
202
203 static pthread_mutex_tcxx . . $ pthread_mutex_t# break_thread_id_lockcxx . . $ break_thread_id_lock. = PTHREAD_MUTEX_INITIALIZERcxx . . $ `<external>/14712363683955484316/pthread.h:90:9`!;
204 static pid_tcxx . . $ pid_t# break_thread_idcxx . . $ break_thread_id. = 0;
205 static uint64_tcxx . . $ uint64_t# break_thread_valuecxx . . $ break_thread_value. = 0;
206
207 static int alignedcxx . . $ aligned. = 0;
208 static int secalignedcxx . . $ secaligned. = 0;
209 static int offsetcxx . . $ offset. = 0;
210 static pthread_barrier_tcxx . . $ pthread_barrier_t# align_barrcxx . . $ align_barr.;
211 static pthread_barrier_tcxx . . $ pthread_barrier_t# globalt_barrcxx . . $ globalt_barr.;
212 static struct timespeccxx . . $ timespec# globaltcxx . . $ globalt.;
213
214 static char fifopathcxx . . $ fifopath.[MAX_PATHcxx . . $ `src/include/rt-utils.h:9:9`!];
215 static char histfilecxx . . $ histfile.[MAX_PATHcxx . . $ `src/include/rt-utils.h:9:9`!];
216 static char jsonfilecxx . . $ jsonfile.[MAX_PATHcxx . . $ `src/include/rt-utils.h:9:9`!];
217
218 static struct thread_paramcxx . . $ thread_param# **parameterscxx . . $ parameters.;
219 static struct thread_statcxx . . $ thread_stat# **statisticscxx . . $ statistics.;
220 static struct histosetcxx . . $ histoset# hsetcxx . . $ hset.;
221
222 static void print_statcxx . . $ print_stat(9485320f19a6ade5).(FILEcxx . . $ FILE# *fp, struct thread_paramcxx . . $ thread_param# *par, int index, int verbose, int quiet);
223 static void rstat_print_statcxx . . $ rstat_print_stat(d877d5c7c4de44f9).(struct thread_paramcxx . . $ thread_param# *par, int index, int verbose, int quiet);
224 static void rstat_setupcxx . . $ rstat_setup(49f6e7a06ebc5aa8).(void);
225
226 static int latency_target_fdcxx . . $ latency_target_fd. = -1;
227 static int32_tcxx . . $ int32_t# latency_target_valuecxx . . $ latency_target_value. = 0;
228
229 static int deepest_idle_statecxx . . $ deepest_idle_state. = -2;
230
231 static int rstat_ftruncatecxx . . $ rstat_ftruncate(bba9d6e9fb34fad7).(int fd, off_tcxx . . $ off_t# len);
232 static int rstat_fdcxx . . $ rstat_fd. = -1;
233 /* strlen("/cyclictest") + digits in max pid len + '\0' */
234 #define SHM_BUF_SIZEcxx . . $ `src/cyclictest/cyclictest.c:234:9`! 19
235 static char shm_namecxx . . $ shm_name.[SHM_BUF_SIZEcxx . . $ `src/cyclictest/cyclictest.c:234:9`!];
236
237 /* Latency trick
238 * if the file /dev/cpu_dma_latency exists,
239 * open it and write a zero into it. This will tell
240 * the power management system not to transition to
241 * a high cstate (in fact, the system acts like idle=poll)
242 * When the fd to /dev/cpu_dma_latency is closed, the behavior
243 * goes back to the system default.
244 *
245 * Documentation/power/pm_qos_interface.txt
246 */
247 static void set_latency_targetcxx . . $ set_latency_target(49f6e7a06ebc5aa8).(void)
248 {
249 struct statcxx . . $ stat# s;
250 int err;
251
252 if (laptopcxx . . $ laptop.) {
253 warncxx . . $ warn(d5d9ff45db7b5d36).("not setting cpu_dma_latency to save battery power\n");
254 return;
255 }
256
257 if (power_managementcxx . . $ power_management.) {
258 warncxx . . $ warn(d5d9ff45db7b5d36).("not setting cpu_dma_latency from cyclictest\n");
259 return;
260 }
261
262 if (deepest_idle_statecxx . . $ deepest_idle_state. >= -1) {
263 warncxx . . $ warn(d5d9ff45db7b5d36).("not setting cpu_dma_latency, --deepest-idle-state is set instead\n");
264 return;
265 }
266
267 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
268 err = statcxx . . $ stat(a9cd1e23e96f423c).("/dev/cpu_dma_latency", &s);
269 if (err == -1) {
270 err_msg_ncxx . . $ err_msg_n(26800c7917ec8ef2).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!, "WARN: stat /dev/cpu_dma_latency failed");
271 return;
272 }
273
274 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
275 latency_target_fdcxx . . $ latency_target_fd. = opencxx . . $ open(e156e3aa1e5c4ad1).("/dev/cpu_dma_latency", O_RDWRcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:45:9`!);
276 if (latency_target_fdcxx . . $ latency_target_fd. == -1) {
277 err_msg_ncxx . . $ err_msg_n(26800c7917ec8ef2).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!, "WARN: open /dev/cpu_dma_latency");
278 return;
279 }
280
281 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
282 err = writecxx . . $ write(41184a59d38b4f65).(latency_target_fdcxx . . $ latency_target_fd., &latency_target_valuecxx . . $ latency_target_value., 4);
283 if (err < 1) {
284 err_msg_ncxx . . $ err_msg_n(26800c7917ec8ef2).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!, "# error setting cpu_dma_latency to %d!", latency_target_valuecxx . . $ latency_target_value.);
285 closecxx . . $ close(7864480464b09eea).(latency_target_fdcxx . . $ latency_target_fd.);
286 return;
287 }
288 printfcxx . . $ printf(581fddd72a8db8fc).("# /dev/cpu_dma_latency set to %dus\n", latency_target_valuecxx . . $ latency_target_value.);
289 }
290
291 #ifdef HAVE_LIBCPUPOWER_SUPPORTcxx . . $ `<built-in>:414:9`!
292 static unsigned int **saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.;
293 static size_t saved_cpu_idle_disable_state_alloc_ctrcxx . . $ saved_cpu_idle_disable_state_alloc_ctr.;
294
295 /*
296 * save_cpu_idle_state_disable - save disable for all idle states of a cpu
297 *
298 * Saves the current disable of all idle states of a cpu, to be subsequently
299 * restored via restore_cpu_idle_disable_state.
300 *
301 * Return: idle state count on success, negative on error
302 */
303 static int save_cpu_idle_disable_statecxx . . $ save_cpu_idle_disable_state(4c679297bf94b9eb).(unsigned int cpu)
304 {
305 unsigned int nr_states;
306 unsigned int state;
307 int disabled;
308 int nr_cpus;
309
310 nr_states = cpuidle_state_countcxx . . $ cpuidle_state_count(2141b656ce2cc063).(cpu);
311
312 if (nr_states == 0)
313 return 0;
314
315 if (saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
316 nr_cpus = sysconfcxx . . $ sysconf(dc1f09c09fbff20f).(_SC_NPROCESSORS_CONFcxx . . $ `<external>/6393649343499073842/confname.h:251:9`!);
317 saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state. = calloccxx . . $ calloc(63a7bf2941bfcd7a).(nr_cpus, sizeof(unsigned int *));
318 if (!saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.)
319 return -1;
320 }
321
322 saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.[cpu] = calloccxx . . $ calloc(63a7bf2941bfcd7a).(nr_states, sizeof(unsigned int));
323 if (!saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.[cpu])
324 return -1;
325 saved_cpu_idle_disable_state_alloc_ctrcxx . . $ saved_cpu_idle_disable_state_alloc_ctr.++;
326
327 for (state = 0; state < nr_states; state++) {
328 disabled = cpuidle_is_state_disabledcxx . . $ cpuidle_is_state_disabled(21cb2064190e2a90).(cpu, state);
329 if (disabled < 0)
330 return disabled;
331 saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.[cpu][state] = disabled;
332 }
333
334 return nr_states;
335 }
336
337 /*
338 * restore_cpu_idle_disable_state - restore disable for all idle states of a cpu
339 *
340 * Restores the current disable state of all idle states of a cpu that was
341 * previously saved by save_cpu_idle_disable_state.
342 *
343 * Return: idle state count on success, negative on error
344 */
345 static int restore_cpu_idle_disable_statecxx . . $ restore_cpu_idle_disable_state(4c679297bf94b9eb).(unsigned int cpu)
346 {
347 unsigned int nr_states;
348 unsigned int state;
349 int disabled;
350 int result;
351
352 nr_states = cpuidle_state_countcxx . . $ cpuidle_state_count(2141b656ce2cc063).(cpu);
353
354 if (nr_states == 0)
355 return 0;
356
357 if (!saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.)
358 return -1;
359
360 for (state = 0; state < nr_states; state++) {
361 if (!saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.[cpu])
362 return -1;
363 disabled = saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.[cpu][state];
364 result = cpuidle_state_disablecxx . . $ cpuidle_state_disable(64d4c609941711dd).(cpu, state, disabled);
365 if (result < 0)
366 return result;
367 }
368
369 freecxx . . $ free(5d22bdacc48458e8).(saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.[cpu]);
370 saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.[cpu] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
371 saved_cpu_idle_disable_state_alloc_ctrcxx . . $ saved_cpu_idle_disable_state_alloc_ctr.--;
372 if (saved_cpu_idle_disable_state_alloc_ctrcxx . . $ saved_cpu_idle_disable_state_alloc_ctr. == 0) {
373 freecxx . . $ free(5d22bdacc48458e8).(saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.);
374 saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
375 }
376
377 return nr_states;
378 }
379
380 /*
381 * free_cpu_idle_disable_states - free saved idle state disable for all cpus
382 *
383 * Frees the memory used for storing cpu idle state disable for all cpus
384 * and states.
385 *
386 * Normally, the memory is freed automatically in
387 * restore_cpu_idle_disable_state; this is mostly for cleaning up after an
388 * error.
389 */
390 static void free_cpu_idle_disable_statescxx . . $ free_cpu_idle_disable_states(49f6e7a06ebc5aa8).(void)
391 {
392 int cpu;
393 int nr_cpus;
394
395 if (!saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.)
396 return;
397
398 nr_cpus = sysconfcxx . . $ sysconf(dc1f09c09fbff20f).(_SC_NPROCESSORS_CONFcxx . . $ `<external>/6393649343499073842/confname.h:251:9`!);
399
400 for (cpu = 0; cpu < nr_cpus; cpu++) {
401 freecxx . . $ free(5d22bdacc48458e8).(saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.[cpu]);
402 saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.[cpu] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
403 }
404
405 freecxx . . $ free(5d22bdacc48458e8).(saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state.);
406 saved_cpu_idle_disable_statecxx . . $ saved_cpu_idle_disable_state. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
407 }
408
409 /*
410 * set_deepest_cpu_idle_state - limit idle state of cpu
411 *
412 * Disables all idle states deeper than the one given in
413 * deepest_state (assuming states with higher number are deeper).
414 *
415 * This is used to reduce the exit from idle latency. Unlike
416 * set_cpu_dma_latency, it can disable idle states per cpu.
417 *
418 * Return: idle state count on success, negative on error
419 */
420 static int set_deepest_cpu_idle_statecxx . . $ set_deepest_cpu_idle_state(21cb2064190e2a90).(unsigned int cpu, unsigned int deepest_state)
421 {
422 unsigned int nr_states;
423 unsigned int state;
424 int result;
425
426 nr_states = cpuidle_state_countcxx . . $ cpuidle_state_count(2141b656ce2cc063).(cpu);
427
428 for (state = deepest_state + 1; state < nr_states; state++) {
429 result = cpuidle_state_disablecxx . . $ cpuidle_state_disable(64d4c609941711dd).(cpu, state, 1);
430 if (result < 0)
431 return result;
432 }
433
434 return nr_states;
435 }
436
437 static inline int have_libcpupower_supportcxx . . $ have_libcpupower_support(b126dc7c1de90089).(void) { return 1; }
438 #else
439 static inline int save_cpu_idle_disable_state(unsigned int cpu) { return -1; }
440 static inline int restore_cpu_idle_disable_state(unsigned int cpu) { return -1; }
441 static inline void free_cpu_idle_disable_states(void) { }
442 static inline int set_deepest_cpu_idle_state(unsigned int cpu, unsigned int state) { return -1; }
443 static inline int have_libcpupower_support(void) { return 0; }
444 #endif /* HAVE_LIBCPUPOWER_SUPPORT */
445
446 enumcxx . . $ $anonymous_type_27706fe06df571c0_0# {
447 ERROR_GENERALcxx . . $ ERROR_GENERAL. = -1,
448 ERROR_NOTFOUNDcxx . . $ ERROR_NOTFOUND. = -2,
449 };
450
451 /*
452 * Raise the soft priority limit up to prio, if that is less than or equal
453 * to the hard limit
454 * if a call fails, return the error
455 * if successful return 0
456 * if fails, return -1
457 */
458 static int raise_soft_priocxx . . $ raise_soft_prio(6a0ebea8b49ca00a).(int policy, const struct sched_paramcxx . . $ sched_param# *param)
459 {
460 int err;
461 int policy_max; /* max for scheduling policy such as SCHED_FIFO */
462 int soft_max;
463 int hard_max;
464 int prio;
465 struct rlimitcxx . . $ rlimit# rlim;
466
467 prio = param->sched_prioritycxx . . $ `<external>/17522079545615609418/sched.h:47:9`!;
468
469 policy_max = sched_get_priority_maxcxx . . $ sched_get_priority_max(7864480464b09eea).(policy);
470 if (policy_max == -1) {
471 err = errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!;
472 err_msgcxx . . $ err_msg(d5d9ff45db7b5d36).("WARN: no such policy\n");
473 return err;
474 }
475
476 err = getrlimitcxx . . $ getrlimit(89a93d3463732be0).(RLIMIT_RTPRIOcxx . . $ `<external>/1890803886155400780/resource.h:99:9`!, &rlim);
477 if (err) {
478 err = errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!;
479 err_msg_ncxx . . $ err_msg_n(26800c7917ec8ef2).(err, "WARN: getrlimit failed");
480 return err;
481 }
482
483 soft_max = (rlim.rlim_curcxx . . $ rlimit#rlim_cur. == RLIM_INFINITYcxx . . $ `<external>/1890803886155400780/resource.h:115:10`!) ? (unsigned int)policy_max
484 : rlim.rlim_curcxx . . $ rlimit#rlim_cur.;
485 hard_max = (rlim.rlim_maxcxx . . $ rlimit#rlim_max. == RLIM_INFINITYcxx . . $ `<external>/1890803886155400780/resource.h:115:10`!) ? (unsigned int)policy_max
486 : rlim.rlim_maxcxx . . $ rlimit#rlim_max.;
487
488 if (prio > soft_max && prio <= hard_max) {
489 rlim.rlim_curcxx . . $ rlimit#rlim_cur. = prio;
490 err = setrlimitcxx . . $ setrlimit(506c7cfeadecd456).(RLIMIT_RTPRIOcxx . . $ `<external>/1890803886155400780/resource.h:99:9`!, &rlim);
491 if (err) {
492 err = errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!;
493 err_msg_ncxx . . $ err_msg_n(26800c7917ec8ef2).(err, "WARN: setrlimit failed");
494 /* return err; */
495 }
496 } else {
497 err = -1;
498 }
499
500 return err;
501 }
502
503 /*
504 * Check the error status of sched_setscheduler
505 * If an error can be corrected by raising the soft limit priority to
506 * a priority less than or equal to the hard limit, then do so.
507 */
508 static int setschedulercxx . . $ setscheduler(b99e0841b006542f).(pid_tcxx . . $ pid_t# pid, int policy, const struct sched_paramcxx . . $ sched_param# *param)
509 {
510 int err = 0;
511
512 try_again:
513 err = sched_setschedulercxx . . $ sched_setscheduler(b99e0841b006542f).(pid, policy, param);
514 if (err) {
515 err = errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!;
516 if (err == EPERMcxx . . $ `<external>/8987895939074593727/errno-base.h:5:9`!) {
517 int err1;
518 err1 = raise_soft_priocxx . . $ raise_soft_prio(6a0ebea8b49ca00a).(policy, param);
519 if (!err1)
520 goto try_again;
521 }
522 }
523
524 return err;
525 }
526
527 #ifdef ARCH_HAS_SMI_COUNTERcxx . . $ `src/cyclictest/cyclictest.c:104:9`!
528 static int open_msr_filecxx . . $ open_msr_file(7864480464b09eea).(int cpu)
529 {
530 int fd;
531 char pathname[32];
532
533 /* SMI needs thread affinity */
534 sprintfcxx . . $ sprintf(26c8642d26409d6d).(pathname, "/dev/cpu/%d/msr", cpu);
535 fd = opencxx . . $ open(e156e3aa1e5c4ad1).(pathname, O_RDONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:43:9`!);
536 if (fd < 0)
537 warncxx . . $ warn(d5d9ff45db7b5d36).("%s open failed, try chown or chmod +r "
538 "/dev/cpu/*/msr, or run as root\n", pathname);
539
540 return fd;
541 }
542
543 static int get_msrcxx . . $ get_msr(b3b4641221db6c90).(int fd, off_tcxx . . $ off_t# offset, unsigned long long *msr)
544 {
545 ssize_tcxx . . $ ssize_t# retval;
546
547 retval = preadcxx . . $ pread(b119fdc0c07358b4).(fd, msr, sizeof *msr, offset);
548
549 if (retval != sizeof *msr)
550 return 1;
551
552 return 0;
553 }
554
555 static int get_smi_countercxx . . $ get_smi_counter(bd281c3a7451b299).(int fd, unsigned long *counter)
556 {
557 int retval;
558 unsigned long long msr;
559
560 retval = get_msrcxx . . $ get_msr(b3b4641221db6c90).(fd, MSR_SMI_COUNTcxx . . $ `src/cyclictest/cyclictest.c:107:9`!, &msr);
561 if (retval)
562 return retval;
563
564 *counter = (unsigned long) (msr & MSR_SMI_COUNT_MASKcxx . . $ `src/cyclictest/cyclictest.c:108:9`!);
565
566 return 0;
567 }
568
569 #include <cpuid.h>
570
571 /* Guess if the CPU has an SMI counter in the model-specific registers (MSR).
572 *
573 * This is true for Intel x86 CPUs after Nehalem (2008). However, it's not
574 * possible to detect the feature directly, (or at least, turbostat.c doesn't
575 * know how to do it either) so we assume it's true for all x86 CPUs.
576 * Previously, this function had an explicit allowlist, which required updates
577 * every time a new CPU generation was released.
578 */
579 static int has_smi_countercxx . . $ has_smi_counter(b126dc7c1de90089).(void)
580 {
581 unsigned int ebx, ecx, edx, max_level;
582 unsigned int fms, family, model;
583
584 fms = family = model = ebx = ecx = edx = 0;
585
586 __get_cpuidcxx . . $ __get_cpuid(50a1c0b365363ac0).(0, &max_level, &ebx, &ecx, &edx);
587
588 /* check genuine intel */
589 if (!(ebx == 0x756e6547 && edx == 0x49656e69 && ecx == 0x6c65746e))
590 return 0;
591
592 __get_cpuidcxx . . $ __get_cpuid(50a1c0b365363ac0).(1, &fms, &ebx, &ecx, &edx);
593 family = (fms >> 8) & 0xf;
594
595 if (family != 6)
596 return 0;
597
598 /* no MSR */
599 if (!(edx & (1 << 5)))
600 return 0;
601
602 return 1;
603 }
604 #else
605 static int open_msr_file(int cpu)
606 {
607 return -1;
608 }
609
610 static int get_smi_counter(int fd, unsigned long *counter)
611 {
612 return 1;
613 }
614 static int has_smi_counter(void)
615 {
616 return 0;
617 }
618 #endif
619
620 /*
621 * timer thread
622 *
623 * Modes:
624 * - clock_nanosleep based
625 * - cyclic timer based
626 *
627 * Clock:
628 * - CLOCK_MONOTONIC
629 * - CLOCK_REALTIME
630 *
631 */
632 static void *timerthreadcxx . . $ timerthread(9f162e79bfc6c74).(void *param)
633 {
634 struct thread_paramcxx . . $ thread_param# *par = param;
635 struct sched_paramcxx . . $ sched_param# schedp;
636 struct sigeventcxx . . $ sigevent# sigev;
637 sigset_tcxx . . $ sigset_t# sigset;
638 timer_tcxx . . $ timer_t# timer;
639 struct timespeccxx . . $ timespec# now, next, interval, stop = { 0 };
640 struct itimervalcxx . . $ itimerval# itimer;
641 struct itimerspeccxx . . $ itimerspec# tspec;
642 struct thread_statcxx . . $ thread_stat# *stat = par->statscxx . . $ thread_param#stats.;
643 int stopped = 0;
644 cpu_set_tcxx . . $ cpu_set_t# mask;
645 pthread_tcxx . . $ pthread_t# thread;
646 unsigned long smi_now, smi_old = 0;
647
648 /* if we're running in numa mode, set our memory node */
649 if (par->nodecxx . . $ thread_param#node. != -1)
650 rt_numa_set_numa_run_on_nodecxx . . $ rt_numa_set_numa_run_on_node(3e454b8ccf442868).(par->nodecxx . . $ thread_param#node., par->cpucxx . . $ thread_param#cpu.);
651
652 if (par->cpucxx . . $ thread_param#cpu. != -1) {
653 CPU_ZEROcxx . . $ `<external>/17522079545615609418/sched.h:96:10`!(&mask);
654 CPU_SETcxx . . $ `<external>/17522079545615609418/sched.h:92:10`!(par->cpu, &mask);
655 thread = pthread_selfcxx . . $ pthread_self(f708dce9a8856c70).();
656 if (pthread_setaffinity_npcxx . . $ pthread_setaffinity_np(f5c5d8965c9d8dbc).(thread, sizeof(mask), &mask) != 0)
657 warncxx . . $ warn(d5d9ff45db7b5d36).("Could not set CPU affinity to CPU #%d\n",
658 par->cpucxx . . $ thread_param#cpu.);
659 }
660
661 interval.tv_seccxx . . $ timespec#tv_sec. = par->intervalcxx . . $ thread_param#interval. / USEC_PER_SECcxx . . $ `src/include/rt-utils.h:38:9`!;
662 interval.tv_nseccxx . . $ timespec#tv_nsec. = (par->intervalcxx . . $ thread_param#interval. % USEC_PER_SECcxx . . $ `src/include/rt-utils.h:38:9`!) * 1000;
663
664 stat->tidcxx . . $ thread_stat#tid. = gettidcxx . . $ gettid(b126dc7c1de90089).();
665
666 sigemptysetcxx . . $ sigemptyset(f9c066a8ff75ee9d).(&sigset);
667 sigaddsetcxx . . $ sigaddset(4917c6e3ecb7dbd5).(&sigset, par->signalcxx . . $ thread_param#signal.);
668 sigprocmaskcxx . . $ sigprocmask(7504382baa173b1).(SIG_BLOCKcxx . . $ `<external>/16635209305659446502/sigaction.h:79:9`!, &sigset, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
669
670 if (par->modecxx . . $ thread_param#mode. == MODE_CYCLICcxx . . $ `src/cyclictest/cyclictest.c:92:9`!) {
671 sigev.sigev_notifycxx . . $ sigevent#sigev_notify. = SIGEV_THREAD_IDcxx . . $ `<external>/12195310931381790628/sigevent-consts.h:38:9`! | SIGEV_SIGNALcxx . . $ `<external>/12195310931381790628/sigevent-consts.h:30:10`!;
672 sigev.sigev_signocxx . . $ sigevent#sigev_signo. = par->signalcxx . . $ thread_param#signal.;
673 sigev.sigev_notify_thread_idcxx . . $ `src/cyclictest/cyclictest.c:55:9`! = stat->tidcxx . . $ thread_stat#tid.;
674 timer_createcxx . . $ timer_create(4748ea7f55ae8b1b).(par->clockcxx . . $ thread_param#clock., &sigev, &timer);
675 tspec.it_intervalcxx . . $ itimerspec#it_interval. = interval;
676 }
677
678 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&schedp, 0, sizeof(schedp));
679 schedp.sched_prioritycxx . . $ `<external>/17522079545615609418/sched.h:47:9`! = par->priocxx . . $ thread_param#prio.;
680 if (setschedulercxx . . $ setscheduler(b99e0841b006542f).(0, par->policycxx . . $ thread_param#policy., &schedp))
681 fatalcxx . . $ fatal(5313ecf19fd40d4d).("timerthread%d: failed to set priority to %d\n",
682 par->cpucxx . . $ thread_param#cpu., par->priocxx . . $ thread_param#prio.);
683
684 if (smicxx . . $ smi.) {
685 par->msr_fdcxx . . $ thread_param#msr_fd. = open_msr_filecxx . . $ open_msr_file(7864480464b09eea).(par->cpucxx . . $ thread_param#cpu.);
686 if (par->msr_fdcxx . . $ thread_param#msr_fd. < 0)
687 fatalcxx . . $ fatal(5313ecf19fd40d4d).("Could not open MSR interface, errno: %d\n",
688 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!);
689 /* get current smi count to use as base value */
690 if (get_smi_countercxx . . $ get_smi_counter(bd281c3a7451b299).(par->msr_fdcxx . . $ thread_param#msr_fd., &smi_old))
691 fatalcxx . . $ fatal(5313ecf19fd40d4d).("Could not read SMI counter, errno: %d\n",
692 par->cpucxx . . $ thread_param#cpu., errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!);
693 }
694
695 /* Get current time */
696 if (alignedcxx . . $ aligned. || secalignedcxx . . $ secaligned.) {
697 pthread_barrier_waitcxx . . $ pthread_barrier_wait(6183b0e2072457c0).(&globalt_barrcxx . . $ globalt_barr.);
698 if (par->tnumcxx . . $ thread_param#tnum. == 0) {
699 clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(par->clockcxx . . $ thread_param#clock., &globaltcxx . . $ globalt.);
700 if (secalignedcxx . . $ secaligned.) {
701 /* Ensure that the thread start timestamp is not
702 * in the past */
703 if (globaltcxx . . $ globalt..tv_nseccxx . . $ timespec#tv_nsec. > 900000000)
704 globaltcxx . . $ globalt..tv_seccxx . . $ timespec#tv_sec. += 2;
705 else
706 globaltcxx . . $ globalt..tv_seccxx . . $ timespec#tv_sec.++;
707 globaltcxx . . $ globalt..tv_nseccxx . . $ timespec#tv_nsec. = 0;
708 }
709 }
710 pthread_barrier_waitcxx . . $ pthread_barrier_wait(6183b0e2072457c0).(&align_barrcxx . . $ align_barr.);
711 now = globaltcxx . . $ globalt.;
712 if (offsetcxx . . $ offset.) {
713 if (alignedcxx . . $ aligned.)
714 now.tv_nseccxx . . $ timespec#tv_nsec. += offsetcxx . . $ offset. * par->tnumcxx . . $ thread_param#tnum.;
715 else
716 now.tv_nseccxx . . $ timespec#tv_nsec. += offsetcxx . . $ offset.;
717 tsnormcxx . . $ tsnorm(70b8fb3bc03a57b2).(&now);
718 }
719 } else
720 clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(par->clockcxx . . $ thread_param#clock., &now);
721
722 next = now;
723 next.tv_seccxx . . $ timespec#tv_sec. += interval.tv_seccxx . . $ timespec#tv_sec.;
724 next.tv_nseccxx . . $ timespec#tv_nsec. += interval.tv_nseccxx . . $ timespec#tv_nsec.;
725 tsnormcxx . . $ tsnorm(70b8fb3bc03a57b2).(&next);
726
727 if (durationcxx . . $ duration.) {
728 stop = now;
729 stop.tv_seccxx . . $ timespec#tv_sec. += durationcxx . . $ duration.;
730 }
731 if (par->modecxx . . $ thread_param#mode. == MODE_CYCLICcxx . . $ `src/cyclictest/cyclictest.c:92:9`!) {
732 if (par->timermodecxx . . $ thread_param#timermode. == TIMER_ABSTIMEcxx . . $ `<external>/89459239771508533/time.h:69:10`!)
733 tspec.it_valuecxx . . $ itimerspec#it_value. = next;
734 else
735 tspec.it_valuecxx . . $ itimerspec#it_value. = interval;
736 timer_settimecxx . . $ timer_settime(a477ca4c486ba50e).(timer, par->timermodecxx . . $ thread_param#timermode., &tspec, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
737 }
738
739 if (par->modecxx . . $ thread_param#mode. == MODE_SYS_ITIMERcxx . . $ `src/cyclictest/cyclictest.c:94:9`!) {
740 itimer.it_intervalcxx . . $ itimerval#it_interval..tv_seccxx . . $ timeval#tv_sec. = interval.tv_seccxx . . $ timespec#tv_sec.;
741 itimer.it_intervalcxx . . $ itimerval#it_interval..tv_useccxx . . $ timeval#tv_usec. = interval.tv_nseccxx . . $ timespec#tv_nsec. / 1000;
742 itimer.it_valuecxx . . $ itimerval#it_value. = itimer.it_intervalcxx . . $ itimerval#it_interval.;
743 setitimercxx . . $ setitimer(525ba3a5314ccb66).(ITIMER_REALcxx . . $ `<external>/8057359269225398204/time.h:118:9`!, &itimer, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
744 }
745
746 stat->threadstartedcxx . . $ thread_stat#threadstarted.++;
747
748 while (!shutdowncxx . . $ shutdown.) {
749
750 uint64_tcxx . . $ uint64_t# diff;
751 unsigned long diff_smi = 0;
752 int sigs, ret;
753
754 /* Wait for next period */
755 switch (par->modecxx . . $ thread_param#mode.) {
756 case MODE_CYCLICcxx . . $ `src/cyclictest/cyclictest.c:92:9`!:
757 case MODE_SYS_ITIMERcxx . . $ `src/cyclictest/cyclictest.c:94:9`!:
758 if (sigwaitcxx . . $ sigwait(84466af2bbf90658).(&sigset, &sigs) < 0)
759 goto out;
760 break;
761
762 case MODE_CLOCK_NANOSLEEPcxx . . $ `src/cyclictest/cyclictest.c:93:9`!:
763 if (par->timermodecxx . . $ thread_param#timermode. == TIMER_ABSTIMEcxx . . $ `<external>/89459239771508533/time.h:69:10`!) {
764 ret = clock_nanosleepcxx . . $ clock_nanosleep(99dc002056e22615).(par->clockcxx . . $ thread_param#clock., TIMER_ABSTIMEcxx . . $ `<external>/89459239771508533/time.h:69:10`!,
765 &next, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
766 if (ret != 0) {
767 if (ret != EINTRcxx . . $ `<external>/8987895939074593727/errno-base.h:8:9`!)
768 warncxx . . $ warn(d5d9ff45db7b5d36).("clock_nanosleep failed. errno: %d\n", errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!);
769 goto out;
770 }
771 } else {
772 ret = clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(par->clockcxx . . $ thread_param#clock., &now);
773 if (ret != 0) {
774 if (ret != EINTRcxx . . $ `<external>/8987895939074593727/errno-base.h:8:9`!)
775 warncxx . . $ warn(d5d9ff45db7b5d36).("clock_gettime() failed: %s", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
776 goto out;
777 }
778 ret = clock_nanosleepcxx . . $ clock_nanosleep(99dc002056e22615).(par->clockcxx . . $ thread_param#clock.,
779 TIMER_RELTIMEcxx . . $ `src/cyclictest/cyclictest.c:98:9`!, &interval, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
780 if (ret != 0) {
781 if (ret != EINTRcxx . . $ `<external>/8987895939074593727/errno-base.h:8:9`!)
782 warncxx . . $ warn(d5d9ff45db7b5d36).("clock_nanosleep() failed. errno: %d\n", errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!);
783 goto out;
784 }
785 next.tv_seccxx . . $ timespec#tv_sec. = now.tv_seccxx . . $ timespec#tv_sec. + interval.tv_seccxx . . $ timespec#tv_sec.;
786 next.tv_nseccxx . . $ timespec#tv_nsec. = now.tv_nseccxx . . $ timespec#tv_nsec. + interval.tv_nseccxx . . $ timespec#tv_nsec.;
787 tsnormcxx . . $ tsnorm(70b8fb3bc03a57b2).(&next);
788 }
789 break;
790
791 case MODE_SYS_NANOSLEEPcxx . . $ `src/cyclictest/cyclictest.c:95:9`!:
792 ret = clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(par->clockcxx . . $ thread_param#clock., &now);
793 if (ret != 0) {
794 if (ret != EINTRcxx . . $ `<external>/8987895939074593727/errno-base.h:8:9`!)
795 warncxx . . $ warn(d5d9ff45db7b5d36).("clock_gettime() failed: errno %d\n", errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!);
796 goto out;
797 }
798 if (nanosleepcxx . . $ nanosleep(645c6fc2576d4126).(&interval, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
799 if (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! != EINTRcxx . . $ `<external>/8987895939074593727/errno-base.h:8:9`!)
800 warncxx . . $ warn(d5d9ff45db7b5d36).("nanosleep failed. errno: %d\n",
801 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!);
802 goto out;
803 }
804 next.tv_seccxx . . $ timespec#tv_sec. = now.tv_seccxx . . $ timespec#tv_sec. + interval.tv_seccxx . . $ timespec#tv_sec.;
805 next.tv_nseccxx . . $ timespec#tv_nsec. = now.tv_nseccxx . . $ timespec#tv_nsec. + interval.tv_nseccxx . . $ timespec#tv_nsec.;
806 tsnormcxx . . $ tsnorm(70b8fb3bc03a57b2).(&next);
807 break;
808 }
809 ret = clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(par->clockcxx . . $ thread_param#clock., &now);
810 if (ret != 0) {
811 if (ret != EINTRcxx . . $ `<external>/8987895939074593727/errno-base.h:8:9`!)
812 warncxx . . $ warn(d5d9ff45db7b5d36).("clock_gettime() failed. errno: %d\n",
813 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!);
814 goto out;
815 }
816
817 if (smicxx . . $ smi.) {
818 if (get_smi_countercxx . . $ get_smi_counter(bd281c3a7451b299).(par->msr_fdcxx . . $ thread_param#msr_fd., &smi_now)) {
819 warncxx . . $ warn(d5d9ff45db7b5d36).("Could not read SMI counter, errno: %d\n",
820 par->cpucxx . . $ thread_param#cpu., errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!);
821 goto out;
822 }
823 diff_smi = smi_now - smi_old;
824 stat->smi_countcxx . . $ thread_stat#smi_count. += diff_smi;
825 smi_old = smi_now;
826 }
827
828 if (use_nsecscxx . . $ use_nsecs.)
829 diff = calcdiff_nscxx . . $ calcdiff_ns(a7174a6ca78cf3cd).(now, next);
830 else
831 diff = calcdiffcxx . . $ calcdiff(a7174a6ca78cf3cd).(now, next);
832 if (diff < stat->mincxx . . $ thread_stat#min.)
833 stat->mincxx . . $ thread_stat#min. = diff;
834 if (diff > stat->maxcxx . . $ thread_stat#max.) {
835 stat->maxcxx . . $ thread_stat#max. = diff;
836 if (refresh_on_maxcxx . . $ refresh_on_max.)
837 pthread_cond_signalcxx . . $ pthread_cond_signal(98095c34a2b0149d).(&refresh_on_max_condcxx . . $ refresh_on_max_cond.);
838 }
839 stat->avgcxx . . $ thread_stat#avg. += (double) diff;
840
841 if (triggercxx . . $ trigger. && (diff > triggercxx . . $ trigger.))
842 trigger_updatecxx . . $ trigger_update(4178c2305174e7b9).(par, diff, calctimecxx . . $ calctime(e44ff8b8ef2f070d).(now));
843
844 if (durationcxx . . $ duration. && (calcdiffcxx . . $ calcdiff(a7174a6ca78cf3cd).(now, stop) >= 0))
845 shutdowncxx . . $ shutdown.++;
846
847 if (!stopped && tracelimitcxx . . $ tracelimit. && (diff > tracelimitcxx . . $ tracelimit.)) {
848 stopped++;
849 shutdowncxx . . $ shutdown.++;
850 pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&break_thread_id_lockcxx . . $ break_thread_id_lock.);
851 if (break_thread_idcxx . . $ break_thread_id. == 0) {
852 break_thread_idcxx . . $ break_thread_id. = stat->tidcxx . . $ thread_stat#tid.;
853 tracemarkcxx . . $ tracemark(d5d9ff45db7b5d36).("hit latency threshold (%llu > %d)",
854 (unsigned long long) diff, tracelimitcxx . . $ tracelimit.);
855 tracing_stopcxx . . $ tracing_stop(49f6e7a06ebc5aa8).();
856 break_thread_valuecxx . . $ break_thread_value. = diff;
857 }
858 pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&break_thread_id_lockcxx . . $ break_thread_id_lock.);
859 }
860 stat->actcxx . . $ thread_stat#act. = diff;
861
862 if (par->bufmskcxx . . $ thread_param#bufmsk.) {
863 stat->valuescxx . . $ thread_stat#values.[stat->cyclescxx . . $ thread_stat#cycles. & par->bufmskcxx . . $ thread_param#bufmsk.] = diff;
864 if (smicxx . . $ smi.)
865 stat->smiscxx . . $ thread_stat#smis.[stat->cyclescxx . . $ thread_stat#cycles. & par->bufmskcxx . . $ thread_param#bufmsk.] = diff_smi;
866 }
867
868 /* Update the histogram */
869 if (histogramcxx . . $ histogram.)
870 hist_samplecxx . . $ hist_sample(e5685fb6a6b593bd).(stat->histcxx . . $ thread_stat#hist., diff);
871
872 stat->cyclescxx . . $ thread_stat#cycles.++;
873
874 next.tv_seccxx . . $ timespec#tv_sec. += interval.tv_seccxx . . $ timespec#tv_sec.;
875 next.tv_nseccxx . . $ timespec#tv_nsec. += interval.tv_nseccxx . . $ timespec#tv_nsec.;
876 if (par->modecxx . . $ thread_param#mode. == MODE_CYCLICcxx . . $ `src/cyclictest/cyclictest.c:92:9`!) {
877 int overrun_count = timer_getoverruncxx . . $ timer_getoverrun(dedf1e9b1c614a07).(timer);
878 next.tv_seccxx . . $ timespec#tv_sec. += overrun_count * interval.tv_seccxx . . $ timespec#tv_sec.;
879 next.tv_nseccxx . . $ timespec#tv_nsec. += overrun_count * interval.tv_nseccxx . . $ timespec#tv_nsec.;
880 }
881 tsnormcxx . . $ tsnorm(70b8fb3bc03a57b2).(&next);
882
883 while (tsgreatercxx . . $ tsgreater(cb715bf0a026b675).(&now, &next)) {
884 next.tv_seccxx . . $ timespec#tv_sec. += interval.tv_seccxx . . $ timespec#tv_sec.;
885 next.tv_nseccxx . . $ timespec#tv_nsec. += interval.tv_nseccxx . . $ timespec#tv_nsec.;
886 tsnormcxx . . $ tsnorm(70b8fb3bc03a57b2).(&next);
887 }
888
889 if (par->max_cyclescxx . . $ thread_param#max_cycles. && par->max_cyclescxx . . $ thread_param#max_cycles. == stat->cyclescxx . . $ thread_stat#cycles.)
890 break;
891 }
892
893 out:
894 if (refresh_on_maxcxx . . $ refresh_on_max.) {
895 pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&refresh_on_max_lockcxx . . $ refresh_on_max_lock.);
896 /* We could reach here with both shutdown and allstopped unset (0).
897 * Set shutdown with synchronization to notify the main
898 * thread not to be blocked when it should exit.
899 */
900 shutdowncxx . . $ shutdown.++;
901 pthread_cond_signalcxx . . $ pthread_cond_signal(98095c34a2b0149d).(&refresh_on_max_condcxx . . $ refresh_on_max_cond.);
902 pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&refresh_on_max_lockcxx . . $ refresh_on_max_lock.);
903 }
904
905 if (par->modecxx . . $ thread_param#mode. == MODE_CYCLICcxx . . $ `src/cyclictest/cyclictest.c:92:9`!)
906 timer_deletecxx . . $ timer_delete(dedf1e9b1c614a07).(timer);
907
908 if (par->modecxx . . $ thread_param#mode. == MODE_SYS_ITIMERcxx . . $ `src/cyclictest/cyclictest.c:94:9`!) {
909 itimer.it_valuecxx . . $ itimerval#it_value..tv_seccxx . . $ timeval#tv_sec. = 0;
910 itimer.it_valuecxx . . $ itimerval#it_value..tv_useccxx . . $ timeval#tv_usec. = 0;
911 itimer.it_intervalcxx . . $ itimerval#it_interval..tv_seccxx . . $ timeval#tv_sec. = 0;
912 itimer.it_intervalcxx . . $ itimerval#it_interval..tv_useccxx . . $ timeval#tv_usec. = 0;
913 setitimercxx . . $ setitimer(525ba3a5314ccb66).(ITIMER_REALcxx . . $ `<external>/8057359269225398204/time.h:118:9`!, &itimer, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
914 }
915
916 /* close msr file */
917 if (smicxx . . $ smi.)
918 closecxx . . $ close(7864480464b09eea).(par->msr_fdcxx . . $ thread_param#msr_fd.);
919 /* switch to normal */
920 schedp.sched_prioritycxx . . $ `<external>/17522079545615609418/sched.h:47:9`! = 0;
921 sched_setschedulercxx . . $ sched_setscheduler(b99e0841b006542f).(0, SCHED_OTHERcxx . . $ `<external>/4872883757279652994/sched.h:28:9`!, &schedp);
922 stat->threadstartedcxx . . $ thread_stat#threadstarted. = -1;
923
924 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
925 }
926
927
928 /* Print usage information */
929 static void display_helpcxx . . $ display_help(d4f767463ce0a6b3).(int error)
930 {
931 printfcxx . . $ printf(581fddd72a8db8fc).("cyclictest V %1.2f\n", VERSIONcxx . . $ `<built-in>:412:9`!);
932 printfcxx . . $ printf(581fddd72a8db8fc).("Usage:\n"
933 "cyclictest <options>\n\n"
934 "-a [CPUSET] --affinity Run thread #N on processor #N, if possible,\n"
935 " or if CPUSET given, pin threads to that set of\n"
936 " processors in round-robin order.\n"
937 " E.g. -a 2 pins all threads to CPU 2, but\n"
938 " -a 3-5,0 -t 5 will run the first and fifth threads\n"
939 " on CPU 0, the second thread on CPU 3,\n"
940 " the third thread on CPU 4,\n"
941 " and the fourth thread on CPU 5.\n"
942 "-A USEC --aligned=USEC align thread wakeups to a specific offset\n"
943 "-b USEC --breaktrace=USEC send break trace command when latency > USEC\n"
944 "-c CLOCK --clock=CLOCK select clock\n"
945 " 0 = CLOCK_MONOTONIC (default)\n"
946 " 1 = CLOCK_REALTIME\n"
947 " --deepest-idle-state=n\n"
948 " Reduce exit from idle latency by limiting idle state\n"
949 " up to n on used cpus (-1 disables all idle states).\n"
950 " Power management is not suppresed on other cpus.\n"
951 " --default-system Don't attempt to tune the system from cyclictest.\n"
952 " Power management is not suppressed.\n"
953 " This might give poorer results, but will allow you\n"
954 " to discover if you need to tune the system\n"
955 "-d DIST --distance=DIST distance of thread intervals in us, default=500\n"
956 "-D --duration=TIME specify a length for the test run.\n"
957 " Append 'm', 'h', or 'd' to specify minutes, hours or days.\n"
958 "-F --fifo=<path> create a named pipe at path and write stats to it\n"
959 "-h --histogram=US dump a latency histogram to stdout after the run\n"
960 " US is the max latency time to be tracked in microseconds\n"
961 " This option runs all threads at the same priority.\n"
962 "-H --histofall=US same as -h except with an additional summary column\n"
963 " --histfile=<path> dump the latency histogram to <path> instead of stdout\n"
964 "-i INTV --interval=INTV base interval of thread in us default=1000\n"
965 " --json=FILENAME write final results into FILENAME, JSON formatted\n"
966 " --laptop Save battery when running cyclictest\n"
967 " This will give you poorer realtime results\n"
968 " but will not drain your battery so quickly\n"
969 " --latency=PM_QOS power management latency target value\n"
970 " This value is written to /dev/cpu_dma_latency\n"
971 " and affects c-states. The default is 0\n"
972 "-l LOOPS --loops=LOOPS number of loops: default=0(endless)\n"
973 " --mainaffinity=CPUSET\n"
974 " Run the main thread on CPU #N. This only affects\n"
975 " the main thread and not the measurement threads\n"
976 "-m --mlockall lock current and future memory allocations\n"
977 "-M --refresh_on_max delay updating the screen until a new max\n"
978 " latency is hit. Useful for low bandwidth.\n"
979 "-N --nsecs print results in ns instead of us (default us)\n"
980 "-o RED --oscope=RED oscilloscope mode, reduce verbose output by RED\n"
981 "-p PRIO --priority=PRIO priority of highest prio thread\n"
982 " --policy=NAME policy of measurement thread, where NAME may be one\n"
983 " of: other, normal, batch, idle, fifo or rr.\n"
984 " --priospread spread priority levels starting at specified value\n"
985 "-q --quiet print a summary only on exit\n"
986 "-r --relative use relative timer instead of absolute\n"
987 "-R --resolution check clock resolution, calling clock_gettime() many\n"
988 " times. List of clock_gettime() values will be\n"
989 " reported with -X\n"
990 " --secaligned [USEC] align thread wakeups to the next full second\n"
991 " and apply the optional offset\n"
992 "-s --system use sys_nanosleep and sys_setitimer\n"
993 "-S --smp Standard SMP testing: options -a -t and same priority\n"
994 " of all threads\n"
995 " --spike=<trigger> record all spikes > trigger\n"
996 " --spike-nodes=[num of nodes]\n"
997 " These are the maximum number of spikes we can record.\n"
998 " The default is 1024 if not specified\n"
999 #ifdef ARCH_HAS_SMI_COUNTERcxx . . $ `src/cyclictest/cyclictest.c:104:9`!
1000 " --smi Enable SMI counting\n"
1001 #endif
1002 "-t --threads one thread per available processor\n"
1003 "-t [NUM] --threads=NUM number of threads:\n"
1004 " without NUM, threads = max_cpus\n"
1005 " without -t default = 1\n"
1006 " --tracemark write a trace mark when -b latency is exceeded\n"
1007 "-u --unbuffered force unbuffered output for live processing\n"
1008 "-v --verbose output values on stdout for statistics\n"
1009 " format: n:c:v n=tasknum c=count v=value in us\n"
1010 " --dbg_cyclictest print info useful for debugging cyclictest\n"
1011 "-x --posix_timers use POSIX timers instead of clock_nanosleep.\n"
1012 );
1013 if (error)
1014 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!);
1015 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!);
1016 }
1017
1018 static int use_nanosleepcxx . . $ use_nanosleep. = MODE_CLOCK_NANOSLEEPcxx . . $ `src/cyclictest/cyclictest.c:93:9`!;
1019 static int timermodecxx . . $ timermode. = TIMER_ABSTIMEcxx . . $ `<external>/89459239771508533/time.h:69:10`!;
1020 static int use_systemcxx . . $ use_system.;
1021 static int prioritycxx . . $ priority.;
1022 static int policycxx . . $ policy. = SCHED_OTHERcxx . . $ `<external>/4872883757279652994/sched.h:28:9`!; /* default policy if not specified */
1023 static int num_threadscxx . . $ num_threads. = 1;
1024 static int max_cyclescxx . . $ max_cycles.;
1025 static int clockselcxx . . $ clocksel. = 0;
1026 static int quietcxx . . $ quiet.;
1027 static int intervalcxx . . $ interval. = DEFAULT_INTERVALcxx . . $ `src/cyclictest/cyclictest.c:45:9`!;
1028 static int distancecxx . . $ distance. = -1;
1029 static struct bitmaskcxx . . $ bitmask# *affinity_maskcxx . . $ affinity_mask. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1030 static struct bitmaskcxx . . $ bitmask# *main_affinity_maskcxx . . $ main_affinity_mask. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1031 static int smpcxx . . $ smp. = 0;
1032 static int setaffinitycxx . . $ setaffinity. = AFFINITY_UNSPECIFIEDcxx . . $ AFFINITY_UNSPECIFIED.;
1033
1034 static int clocksourcescxx . . $ clocksources.[] = {
1035 CLOCK_MONOTONICcxx . . $ `<external>/89459239771508533/time.h:48:10`!,
1036 CLOCK_REALTIMEcxx . . $ `<external>/89459239771508533/time.h:46:10`!,
1037 };
1038
1039 static void handlepolicycxx . . $ handlepolicy(fda57c8427c60377).(char *polname)
1040 {
1041 if (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(polname, "other", 5) == 0)
1042 policycxx . . $ policy. = SCHED_OTHERcxx . . $ `<external>/4872883757279652994/sched.h:28:9`!;
1043 else if (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(polname, "batch", 5) == 0)
1044 policycxx . . $ policy. = SCHED_BATCHcxx . . $ `<external>/4872883757279652994/sched.h:33:10`!;
1045 else if (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(polname, "idle", 4) == 0)
1046 policycxx . . $ policy. = SCHED_IDLEcxx . . $ `<external>/4872883757279652994/sched.h:35:10`!;
1047 else if (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(polname, "fifo", 4) == 0)
1048 policycxx . . $ policy. = SCHED_FIFOcxx . . $ `<external>/4872883757279652994/sched.h:29:9`!;
1049 else if (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(polname, "rr", 2) == 0)
1050 policycxx . . $ policy. = SCHED_RRcxx . . $ `<external>/4872883757279652994/sched.h:30:9`!;
1051 else /* default policy if we don't recognize the request */
1052 policycxx . . $ policy. = SCHED_OTHERcxx . . $ `<external>/4872883757279652994/sched.h:28:9`!;
1053 }
1054
1055 static char *policynamecxx . . $ policyname(ff224f080444ee45).(int policy)
1056 {
1057 char *policystr = "";
1058
1059 switch(policy) {
1060 case SCHED_OTHERcxx . . $ `<external>/4872883757279652994/sched.h:28:9`!:
1061 policystr = "other";
1062 break;
1063 case SCHED_FIFOcxx . . $ `<external>/4872883757279652994/sched.h:29:9`!:
1064 policystr = "fifo";
1065 break;
1066 case SCHED_RRcxx . . $ `<external>/4872883757279652994/sched.h:30:9`!:
1067 policystr = "rr";
1068 break;
1069 case SCHED_BATCHcxx . . $ `<external>/4872883757279652994/sched.h:33:10`!:
1070 policystr = "batch";
1071 break;
1072 case SCHED_IDLEcxx . . $ `<external>/4872883757279652994/sched.h:35:10`!:
1073 policystr = "idle";
1074 break;
1075 }
1076 return policystr;
1077 }
1078
1079
1080 enum option_valuescxx . . $ option_values# {
1081 OPT_AFFINITYcxx . . $ OPT_AFFINITY.=1, OPT_BREAKTRACEcxx . . $ OPT_BREAKTRACE., OPT_CLOCKcxx . . $ OPT_CLOCK.,
1082 OPT_DEFAULT_SYSTEMcxx . . $ OPT_DEFAULT_SYSTEM., OPT_DISTANCEcxx . . $ OPT_DISTANCE., OPT_DURATIONcxx . . $ OPT_DURATION., OPT_LATENCYcxx . . $ OPT_LATENCY.,
1083 OPT_FIFOcxx . . $ OPT_FIFO., OPT_HISTOGRAMcxx . . $ OPT_HISTOGRAM., OPT_HISTOFALLcxx . . $ OPT_HISTOFALL., OPT_HISTFILEcxx . . $ OPT_HISTFILE.,
1084 OPT_INTERVALcxx . . $ OPT_INTERVAL., OPT_JSONcxx . . $ OPT_JSON., OPT_MAINAFFINITYcxx . . $ OPT_MAINAFFINITY., OPT_LOOPScxx . . $ OPT_LOOPS., OPT_MLOCKALLcxx . . $ OPT_MLOCKALL.,
1085 OPT_REFRESHcxx . . $ OPT_REFRESH., OPT_NANOSLEEPcxx . . $ OPT_NANOSLEEP., OPT_NSECScxx . . $ OPT_NSECS., OPT_OSCOPEcxx . . $ OPT_OSCOPE., OPT_PRIORITYcxx . . $ OPT_PRIORITY.,
1086 OPT_QUIETcxx . . $ OPT_QUIET., OPT_PRIOSPREADcxx . . $ OPT_PRIOSPREAD., OPT_RELATIVEcxx . . $ OPT_RELATIVE., OPT_RESOLUTIONcxx . . $ OPT_RESOLUTION.,
1087 OPT_SYSTEMcxx . . $ OPT_SYSTEM., OPT_SMPcxx . . $ OPT_SMP., OPT_THREADScxx . . $ OPT_THREADS., OPT_TRIGGERcxx . . $ OPT_TRIGGER.,
1088 OPT_TRIGGER_NODEScxx . . $ OPT_TRIGGER_NODES., OPT_UNBUFFEREDcxx . . $ OPT_UNBUFFERED., OPT_NUMAcxx . . $ OPT_NUMA., OPT_VERBOSEcxx . . $ OPT_VERBOSE.,
1089 OPT_DBGCYCLICcxx . . $ OPT_DBGCYCLIC., OPT_POLICYcxx . . $ OPT_POLICY., OPT_HELPcxx . . $ OPT_HELP., OPT_NUMOPTScxx . . $ OPT_NUMOPTS.,
1090 OPT_ALIGNEDcxx . . $ OPT_ALIGNED., OPT_SECALIGNEDcxx . . $ OPT_SECALIGNED., OPT_LAPTOPcxx . . $ OPT_LAPTOP., OPT_SMIcxx . . $ OPT_SMI.,
1091 OPT_TRACEMARKcxx . . $ OPT_TRACEMARK., OPT_POSIX_TIMERScxx . . $ OPT_POSIX_TIMERS., OPT_DEEPEST_IDLE_STATEcxx . . $ OPT_DEEPEST_IDLE_STATE.,
1092 };
1093
1094 /* Process commandline options */
1095 static void process_optionscxx . . $ process_options(4e6df296d283b65d).(int argc, char *argv[], int max_cpus)
1096 {
1097 int error = 0;
1098 int option_affinity = 0;
1099
1100 for (;;) {
1101 int option_index = 0;
1102 /*
1103 * Options for getopt
1104 * Ordered alphabetically by single letter name
1105 */
1106 static struct optioncxx . . $ option# long_options[] = {
1107 {"affinity", optional_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:64:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_AFFINITYcxx . . $ OPT_AFFINITY.},
1108 {"aligned", optional_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:64:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_ALIGNEDcxx . . $ OPT_ALIGNED. },
1109 {"breaktrace", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_BREAKTRACEcxx . . $ OPT_BREAKTRACE. },
1110 {"clock", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_CLOCKcxx . . $ OPT_CLOCK. },
1111 {"default-system", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_DEFAULT_SYSTEMcxx . . $ OPT_DEFAULT_SYSTEM. },
1112 {"distance", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_DISTANCEcxx . . $ OPT_DISTANCE. },
1113 {"duration", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_DURATIONcxx . . $ OPT_DURATION. },
1114 {"latency", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_LATENCYcxx . . $ OPT_LATENCY. },
1115 {"fifo", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_FIFOcxx . . $ OPT_FIFO. },
1116 {"histogram", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_HISTOGRAMcxx . . $ OPT_HISTOGRAM. },
1117 {"histofall", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_HISTOFALLcxx . . $ OPT_HISTOFALL. },
1118 {"histfile", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_HISTFILEcxx . . $ OPT_HISTFILE. },
1119 {"interval", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_INTERVALcxx . . $ OPT_INTERVAL. },
1120 {"json", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_JSONcxx . . $ OPT_JSON. },
1121 {"laptop", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_LAPTOPcxx . . $ OPT_LAPTOP. },
1122 {"loops", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_LOOPScxx . . $ OPT_LOOPS. },
1123 {"mainaffinity", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_MAINAFFINITYcxx . . $ OPT_MAINAFFINITY.},
1124 {"mlockall", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_MLOCKALLcxx . . $ OPT_MLOCKALL. },
1125 {"refresh_on_max", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_REFRESHcxx . . $ OPT_REFRESH. },
1126 {"nsecs", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_NSECScxx . . $ OPT_NSECS. },
1127 {"oscope", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_OSCOPEcxx . . $ OPT_OSCOPE. },
1128 {"priority", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_PRIORITYcxx . . $ OPT_PRIORITY. },
1129 {"quiet", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_QUIETcxx . . $ OPT_QUIET. },
1130 {"priospread", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_PRIOSPREADcxx . . $ OPT_PRIOSPREAD. },
1131 {"relative", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_RELATIVEcxx . . $ OPT_RELATIVE. },
1132 {"resolution", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_RESOLUTIONcxx . . $ OPT_RESOLUTION. },
1133 {"secaligned", optional_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:64:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_SECALIGNEDcxx . . $ OPT_SECALIGNED. },
1134 {"system", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_SYSTEMcxx . . $ OPT_SYSTEM. },
1135 {"smi", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_SMIcxx . . $ OPT_SMI. },
1136 {"smp", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_SMPcxx . . $ OPT_SMP. },
1137 {"spike", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_TRIGGERcxx . . $ OPT_TRIGGER. },
1138 {"spike-nodes", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_TRIGGER_NODEScxx . . $ OPT_TRIGGER_NODES. },
1139 {"threads", optional_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:64:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_THREADScxx . . $ OPT_THREADS. },
1140 {"tracemark", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_TRACEMARKcxx . . $ OPT_TRACEMARK. },
1141 {"unbuffered", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_UNBUFFEREDcxx . . $ OPT_UNBUFFERED. },
1142 {"verbose", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_VERBOSEcxx . . $ OPT_VERBOSE. },
1143 {"dbg_cyclictest", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_DBGCYCLICcxx . . $ OPT_DBGCYCLIC. },
1144 {"policy", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_POLICYcxx . . $ OPT_POLICY. },
1145 {"help", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_HELPcxx . . $ OPT_HELP. },
1146 {"posix_timers", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_POSIX_TIMERScxx . . $ OPT_POSIX_TIMERS. },
1147 {"deepest-idle-state", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_DEEPEST_IDLE_STATEcxx . . $ OPT_DEEPEST_IDLE_STATE. },
1148 {NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0 },
1149 };
1150 int c = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "a::A::b:c:d:D:F:h:H:i:l:MNo:p:mqrRsSt::uvx",
1151 long_options, &option_index);
1152 if (c == -1)
1153 break;
1154 switch (c) {
1155 case 'a':
1156 case OPT_AFFINITYcxx . . $ OPT_AFFINITY.:
1157 option_affinity = 1;
1158 /* smp sets AFFINITY_USEALL in OPT_SMP */
1159 if (smpcxx . . $ smp.)
1160 break;
1161 numacxx . . $ numa. = numa_initializecxx . . $ numa_initialize(b126dc7c1de90089).();
1162 if (optargcxx . . $ optarg.) {
1163 parse_cpumaskcxx . . $ parse_cpumask(3a199e04db700bfb).(optargcxx . . $ optarg., max_cpus, &affinity_maskcxx . . $ affinity_mask.);
1164 setaffinitycxx . . $ setaffinity. = AFFINITY_SPECIFIEDcxx . . $ AFFINITY_SPECIFIED.;
1165 } else if (optindcxx . . $ optind. < argc &&
1166 (atoicxx . . $ atoi(5c4306d8553b3696).(argv[optindcxx . . $ optind.]) ||
1167 argv[optindcxx . . $ optind.][0] == '0' ||
1168 argv[optindcxx . . $ optind.][0] == '!' ||
1169 argv[optindcxx . . $ optind.][0] == '+' ||
1170 argv[optindcxx . . $ optind.][0] == 'a')) {
1171 parse_cpumaskcxx . . $ parse_cpumask(3a199e04db700bfb).(argv[optindcxx . . $ optind.], max_cpus, &affinity_maskcxx . . $ affinity_mask.);
1172 setaffinitycxx . . $ setaffinity. = AFFINITY_SPECIFIEDcxx . . $ AFFINITY_SPECIFIED.;
1173 } else {
1174 setaffinitycxx . . $ setaffinity. = AFFINITY_USEALLcxx . . $ AFFINITY_USEALL.;
1175 }
1176
1177 if (setaffinitycxx . . $ setaffinity. == AFFINITY_SPECIFIEDcxx . . $ AFFINITY_SPECIFIED. && !affinity_maskcxx . . $ affinity_mask.)
1178 display_helpcxx . . $ display_help(d4f767463ce0a6b3).(1);
1179 if (verbosecxx . . $ verbose. && affinity_maskcxx . . $ affinity_mask.)
1180 printfcxx . . $ printf(581fddd72a8db8fc).("Using %u cpus.\n",
1181 numa_bitmask_weightcxx . . $ numa_bitmask_weight(4b55de75830e9378).(affinity_maskcxx . . $ affinity_mask.));
1182 break;
1183 case 'A':
1184 case OPT_ALIGNEDcxx . . $ OPT_ALIGNED.:
1185 alignedcxx . . $ aligned. = 1;
1186 if (optargcxx . . $ optarg. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
1187 offsetcxx . . $ offset. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.) * 1000;
1188 else if (optindcxx . . $ optind. < argc && atoicxx . . $ atoi(5c4306d8553b3696).(argv[optindcxx . . $ optind.]))
1189 offsetcxx . . $ offset. = atoicxx . . $ atoi(5c4306d8553b3696).(argv[optindcxx . . $ optind.]) * 1000;
1190 else
1191 offsetcxx . . $ offset. = 0;
1192 break;
1193 case 'b':
1194 case OPT_BREAKTRACEcxx . . $ OPT_BREAKTRACE.:
1195 tracelimitcxx . . $ tracelimit. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.); break;
1196 case 'c':
1197 case OPT_CLOCKcxx . . $ OPT_CLOCK.:
1198 clockselcxx . . $ clocksel. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.); break;
1199 case OPT_DEFAULT_SYSTEMcxx . . $ OPT_DEFAULT_SYSTEM.:
1200 power_managementcxx . . $ power_management. = 1; break;
1201 case 'd':
1202 case OPT_DISTANCEcxx . . $ OPT_DISTANCE.:
1203 distancecxx . . $ distance. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.); break;
1204 case 'D':
1205 case OPT_DURATIONcxx . . $ OPT_DURATION.:
1206 durationcxx . . $ duration. = parse_time_stringcxx . . $ parse_time_string(1ef8e6ec083aabb9).(optargcxx . . $ optarg.); break;
1207 case 'F':
1208 case OPT_FIFOcxx . . $ OPT_FIFO.:
1209 use_fifocxx . . $ use_fifo. = 1;
1210 strncpycxx . . $ strncpy(255158a415b673b0).(fifopathcxx . . $ fifopath., optargcxx . . $ optarg., strnlencxx . . $ strnlen(ac5a385650b4bde5).(optargcxx . . $ optarg., MAX_PATHcxx . . $ `src/include/rt-utils.h:9:9`!-1));
1211 break;
1212 case 'H':
1213 case OPT_HISTOFALLcxx . . $ OPT_HISTOFALL.:
1214 histofallcxx . . $ histofall. = 1; /* fall through */
1215 case 'h':
1216 case OPT_HISTOGRAMcxx . . $ OPT_HISTOGRAM.:
1217 histogramcxx . . $ histogram. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.);
1218 if (!histogramcxx . . $ histogram.)
1219 display_helpcxx . . $ display_help(d4f767463ce0a6b3).(1);
1220 break;
1221 case OPT_HISTFILEcxx . . $ OPT_HISTFILE.:
1222 use_histfilecxx . . $ use_histfile. = 1;
1223 strncpycxx . . $ strncpy(255158a415b673b0).(histfilecxx . . $ histfile., optargcxx . . $ optarg., strnlencxx . . $ strnlen(ac5a385650b4bde5).(optargcxx . . $ optarg., MAX_PATHcxx . . $ `src/include/rt-utils.h:9:9`!-1));
1224 break;
1225 case 'i':
1226 case OPT_INTERVALcxx . . $ OPT_INTERVAL.:
1227 intervalcxx . . $ interval. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.); break;
1228 case OPT_JSONcxx . . $ OPT_JSON.:
1229 strncpycxx . . $ strncpy(255158a415b673b0).(jsonfilecxx . . $ jsonfile., optargcxx . . $ optarg., strnlencxx . . $ strnlen(ac5a385650b4bde5).(optargcxx . . $ optarg., MAX_PATHcxx . . $ `src/include/rt-utils.h:9:9`!-1));
1230 break;
1231 case 'l':
1232 case OPT_LOOPScxx . . $ OPT_LOOPS.:
1233 max_cyclescxx . . $ max_cycles. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.); break;
1234 case OPT_MAINAFFINITYcxx . . $ OPT_MAINAFFINITY.:
1235 if (optargcxx . . $ optarg.) {
1236 parse_cpumaskcxx . . $ parse_cpumask(3a199e04db700bfb).(optargcxx . . $ optarg., max_cpus, &main_affinity_maskcxx . . $ main_affinity_mask.);
1237 } else if (optindcxx . . $ optind. < argc &&
1238 (atoicxx . . $ atoi(5c4306d8553b3696).(argv[optindcxx . . $ optind.]) ||
1239 argv[optindcxx . . $ optind.][0] == '0' ||
1240 argv[optindcxx . . $ optind.][0] == '!')) {
1241 parse_cpumaskcxx . . $ parse_cpumask(3a199e04db700bfb).(argv[optindcxx . . $ optind.], max_cpus, &main_affinity_maskcxx . . $ main_affinity_mask.);
1242 }
1243 break;
1244 case 'm':
1245 case OPT_MLOCKALLcxx . . $ OPT_MLOCKALL.:
1246 lockallcxx . . $ lockall. = 1; break;
1247 case 'M':
1248 case OPT_REFRESHcxx . . $ OPT_REFRESH.:
1249 refresh_on_maxcxx . . $ refresh_on_max. = 1; break;
1250 case 'N':
1251 case OPT_NSECScxx . . $ OPT_NSECS.:
1252 use_nsecscxx . . $ use_nsecs. = 1; break;
1253 case 'o':
1254 case OPT_OSCOPEcxx . . $ OPT_OSCOPE.:
1255 oscope_reductioncxx . . $ oscope_reduction. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.); break;
1256 case 'p':
1257 case OPT_PRIORITYcxx . . $ OPT_PRIORITY.:
1258 prioritycxx . . $ priority. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.);
1259 if (policycxx . . $ policy. != SCHED_FIFOcxx . . $ `<external>/4872883757279652994/sched.h:29:9`! && policycxx . . $ policy. != SCHED_RRcxx . . $ `<external>/4872883757279652994/sched.h:30:9`!)
1260 policycxx . . $ policy. = SCHED_FIFOcxx . . $ `<external>/4872883757279652994/sched.h:29:9`!;
1261 break;
1262 case 'q':
1263 case OPT_QUIETcxx . . $ OPT_QUIET.:
1264 quietcxx . . $ quiet. = 1; break;
1265 case 'r':
1266 case OPT_RELATIVEcxx . . $ OPT_RELATIVE.:
1267 timermodecxx . . $ timermode. = TIMER_RELTIMEcxx . . $ `src/cyclictest/cyclictest.c:98:9`!; break;
1268 case 'R':
1269 case OPT_RESOLUTIONcxx . . $ OPT_RESOLUTION.:
1270 check_clock_resolutioncxx . . $ check_clock_resolution. = 1; break;
1271 case OPT_SECALIGNEDcxx . . $ OPT_SECALIGNED.:
1272 secalignedcxx . . $ secaligned. = 1;
1273 if (optargcxx . . $ optarg. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
1274 offsetcxx . . $ offset. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.) * 1000;
1275 else if (optindcxx . . $ optind. < argc && atoicxx . . $ atoi(5c4306d8553b3696).(argv[optindcxx . . $ optind.]))
1276 offsetcxx . . $ offset. = atoicxx . . $ atoi(5c4306d8553b3696).(argv[optindcxx . . $ optind.]) * 1000;
1277 else
1278 offsetcxx . . $ offset. = 0;
1279 break;
1280 case 's':
1281 case OPT_SYSTEMcxx . . $ OPT_SYSTEM.:
1282 use_systemcxx . . $ use_system. = MODE_SYS_OFFSETcxx . . $ `src/cyclictest/cyclictest.c:96:9`!; break;
1283 case 'S':
1284 case OPT_SMPcxx . . $ OPT_SMP.: /* SMP testing */
1285 if (numacxx . . $ numa.)
1286 fatalcxx . . $ fatal(5313ecf19fd40d4d).("numa and smp options are mutually exclusive\n");
1287 smpcxx . . $ smp. = 1;
1288 num_threadscxx . . $ num_threads. = -1; /* update after parsing */
1289 setaffinitycxx . . $ setaffinity. = AFFINITY_USEALLcxx . . $ AFFINITY_USEALL.;
1290 break;
1291 case 't':
1292 case OPT_THREADScxx . . $ OPT_THREADS.:
1293 if (smpcxx . . $ smp.) {
1294 warncxx . . $ warn(d5d9ff45db7b5d36).("-t ignored due to smp mode\n");
1295 break;
1296 }
1297 if (optargcxx . . $ optarg. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
1298 num_threadscxx . . $ num_threads. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.);
1299 else if (optindcxx . . $ optind. < argc && atoicxx . . $ atoi(5c4306d8553b3696).(argv[optindcxx . . $ optind.]))
1300 num_threadscxx . . $ num_threads. = atoicxx . . $ atoi(5c4306d8553b3696).(argv[optindcxx . . $ optind.]);
1301 else
1302 num_threadscxx . . $ num_threads. = -1; /* update after parsing */
1303 break;
1304 case OPT_TRIGGERcxx . . $ OPT_TRIGGER.:
1305 triggercxx . . $ trigger. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.);
1306 break;
1307 case OPT_TRIGGER_NODEScxx . . $ OPT_TRIGGER_NODES.:
1308 if (triggercxx . . $ trigger.)
1309 trigger_list_sizecxx . . $ trigger_list_size. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.);
1310 break;
1311 case 'u':
1312 case OPT_UNBUFFEREDcxx . . $ OPT_UNBUFFERED.:
1313 setvbufcxx . . $ setvbuf(4da3ba8c983f31bc).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, _IONBFcxx . . $ `<external>/232824719582829767/stdio.h:96:9`!, 0); break;
1314 case 'v':
1315 case OPT_VERBOSEcxx . . $ OPT_VERBOSE.: verbosecxx . . $ verbose. = 1; break;
1316 case 'x':
1317 case OPT_POSIX_TIMERScxx . . $ OPT_POSIX_TIMERS.:
1318 use_nanosleepcxx . . $ use_nanosleep. = MODE_CYCLICcxx . . $ `src/cyclictest/cyclictest.c:92:9`!; break;
1319 case '?':
1320 case OPT_HELPcxx . . $ OPT_HELP.:
1321 display_helpcxx . . $ display_help(d4f767463ce0a6b3).(0); break;
1322
1323 /* long only options */
1324 case OPT_PRIOSPREADcxx . . $ OPT_PRIOSPREAD.:
1325 priospreadcxx . . $ priospread. = 1; break;
1326 case OPT_LATENCYcxx . . $ OPT_LATENCY.:
1327 /* power management latency target value */
1328 /* note: default is 0 (zero) */
1329 latency_target_valuecxx . . $ latency_target_value. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.);
1330 if (latency_target_valuecxx . . $ latency_target_value. < 0)
1331 latency_target_valuecxx . . $ latency_target_value. = 0;
1332 break;
1333 case OPT_POLICYcxx . . $ OPT_POLICY.:
1334 handlepolicycxx . . $ handlepolicy(fda57c8427c60377).(optargcxx . . $ optarg.); break;
1335 case OPT_DBGCYCLICcxx . . $ OPT_DBGCYCLIC.:
1336 ct_debugcxx . . $ ct_debug. = 1; break;
1337 case OPT_LAPTOPcxx . . $ OPT_LAPTOP.:
1338 laptopcxx . . $ laptop. = 1; break;
1339 case OPT_SMIcxx . . $ OPT_SMI.:
1340 #ifdef ARCH_HAS_SMI_COUNTERcxx . . $ `src/cyclictest/cyclictest.c:104:9`!
1341 smicxx . . $ smi. = 1;
1342 #else
1343 fatal("--smi is not available on your arch\n");
1344 #endif
1345 break;
1346 case OPT_TRACEMARKcxx . . $ OPT_TRACEMARK.:
1347 trace_markercxx . . $ trace_marker. = 1; break;
1348 case OPT_DEEPEST_IDLE_STATEcxx . . $ OPT_DEEPEST_IDLE_STATE.:
1349 deepest_idle_statecxx . . $ deepest_idle_state. = atoicxx . . $ atoi(5c4306d8553b3696).(optargcxx . . $ optarg.);
1350 break;
1351 }
1352 }
1353
1354 if ((use_systemcxx . . $ use_system. == MODE_SYS_OFFSETcxx . . $ `src/cyclictest/cyclictest.c:96:9`!) && (use_nanosleepcxx . . $ use_nanosleep. == MODE_CYCLICcxx . . $ `src/cyclictest/cyclictest.c:92:9`!)) {
1355 warncxx . . $ warn(d5d9ff45db7b5d36).("The system option requires clock_nanosleep\n");
1356 warncxx . . $ warn(d5d9ff45db7b5d36).("and is not compatible with posix_timers\n");
1357 warncxx . . $ warn(d5d9ff45db7b5d36).("Using clock_nanosleep\n");
1358 use_nanosleepcxx . . $ use_nanosleep. = MODE_CLOCK_NANOSLEEPcxx . . $ `src/cyclictest/cyclictest.c:93:9`!;
1359 }
1360
1361 /* if smp wasn't requested, test for numa automatically */
1362 if (!smpcxx . . $ smp.) {
1363 numacxx . . $ numa. = numa_initializecxx . . $ numa_initialize(b126dc7c1de90089).();
1364 }
1365
1366 if (option_affinity) {
1367 if (smpcxx . . $ smp.)
1368 warncxx . . $ warn(d5d9ff45db7b5d36).("-a ignored due to smp mode\n");
1369 }
1370
1371 if (smicxx . . $ smi.) {
1372 if (setaffinitycxx . . $ setaffinity. == AFFINITY_UNSPECIFIEDcxx . . $ AFFINITY_UNSPECIFIED.)
1373 fatalcxx . . $ fatal(5313ecf19fd40d4d).("SMI counter relies on thread affinity\n");
1374
1375 if (!has_smi_countercxx . . $ has_smi_counter(b126dc7c1de90089).())
1376 fatalcxx . . $ fatal(5313ecf19fd40d4d).("SMI counter is not supported "
1377 "on this processor\n");
1378 }
1379
1380 if (clockselcxx . . $ clocksel. < 0 || clockselcxx . . $ clocksel. > ARRAY_SIZEcxx . . $ `src/include/rt-utils.h:11:9`!(clocksources))
1381 error = 1;
1382
1383 if (oscope_reductioncxx . . $ oscope_reduction. < 1)
1384 error = 1;
1385
1386 if (oscope_reductioncxx . . $ oscope_reduction. > 1 && !verbosecxx . . $ verbose.) {
1387 warncxx . . $ warn(d5d9ff45db7b5d36).("-o option only meaningful, if verbose\n");
1388 error = 1;
1389 }
1390
1391 if (histogramcxx . . $ histogram. < 0)
1392 error = 1;
1393
1394 if (histogramcxx . . $ histogram. > HIST_MAXcxx . . $ `src/cyclictest/cyclictest.c:90:9`!)
1395 histogramcxx . . $ histogram. = HIST_MAXcxx . . $ `src/cyclictest/cyclictest.c:90:9`!;
1396
1397 if (histogramcxx . . $ histogram. && distancecxx . . $ distance. != -1)
1398 warncxx . . $ warn(d5d9ff45db7b5d36).("distance is ignored and set to 0, if histogram enabled\n");
1399 if (distancecxx . . $ distance. == -1)
1400 distancecxx . . $ distance. = DEFAULT_DISTANCEcxx . . $ `src/cyclictest/cyclictest.c:46:9`!;
1401
1402 if (prioritycxx . . $ priority. < 0 || prioritycxx . . $ priority. > 99)
1403 error = 1;
1404
1405 if (num_threadscxx . . $ num_threads. == -1)
1406 num_threadscxx . . $ num_threads. = get_available_cpuscxx . . $ get_available_cpus(e325be287bc55a3e).(affinity_maskcxx . . $ affinity_mask.);
1407
1408 if (priospreadcxx . . $ priospread. && prioritycxx . . $ priority. == 0) {
1409 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "defaulting realtime priority to %d\n",
1410 num_threadscxx . . $ num_threads.+1);
1411 prioritycxx . . $ priority. = num_threadscxx . . $ num_threads.+1;
1412 }
1413
1414 if (prioritycxx . . $ priority. && (policycxx . . $ policy. != SCHED_FIFOcxx . . $ `<external>/4872883757279652994/sched.h:29:9`! && policycxx . . $ policy. != SCHED_RRcxx . . $ `<external>/4872883757279652994/sched.h:30:9`!)) {
1415 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "policy and priority don't match: setting policy to SCHED_FIFO\n");
1416 policycxx . . $ policy. = SCHED_FIFOcxx . . $ `<external>/4872883757279652994/sched.h:29:9`!;
1417 }
1418
1419 if ((policycxx . . $ policy. == SCHED_FIFOcxx . . $ `<external>/4872883757279652994/sched.h:29:9`! || policycxx . . $ policy. == SCHED_RRcxx . . $ `<external>/4872883757279652994/sched.h:30:9`!) && prioritycxx . . $ priority. == 0) {
1420 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "defaulting realtime priority to %d\n",
1421 num_threadscxx . . $ num_threads.+1);
1422 prioritycxx . . $ priority. = num_threadscxx . . $ num_threads.+1;
1423 }
1424
1425 if (num_threadscxx . . $ num_threads. < 1)
1426 error = 1;
1427
1428 if (alignedcxx . . $ aligned. && secalignedcxx . . $ secaligned.)
1429 error = 1;
1430
1431 if (alignedcxx . . $ aligned. || secalignedcxx . . $ secaligned.) {
1432 pthread_barrier_initcxx . . $ pthread_barrier_init(4180f681c7d0b92f).(&globalt_barrcxx . . $ globalt_barr., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, num_threadscxx . . $ num_threads.);
1433 pthread_barrier_initcxx . . $ pthread_barrier_init(4180f681c7d0b92f).(&align_barrcxx . . $ align_barr., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, num_threadscxx . . $ num_threads.);
1434 }
1435 if (error) {
1436 if (affinity_maskcxx . . $ affinity_mask.)
1437 rt_bitmask_freecxx . . $ rt_bitmask_free(d7c6455decaee94d).(affinity_maskcxx . . $ affinity_mask.);
1438 display_helpcxx . . $ display_help(d4f767463ce0a6b3).(1);
1439 }
1440 }
1441
1442 static int check_timercxx . . $ check_timer(b126dc7c1de90089).(void)
1443 {
1444 struct timespeccxx . . $ timespec# ts;
1445
1446 if (clock_getrescxx . . $ clock_getres(65aaefb2502b4987).(CLOCK_MONOTONICcxx . . $ `<external>/89459239771508533/time.h:48:10`!, &ts))
1447 return 1;
1448
1449 return (ts.tv_seccxx . . $ timespec#tv_sec. != 0 || ts.tv_nseccxx . . $ timespec#tv_nsec. != 1);
1450 }
1451
1452 static void sighandcxx . . $ sighand(d4f767463ce0a6b3).(int sig)
1453 {
1454 if (sig == SIGUSR1cxx . . $ `<external>/1457673850468744829/signum-arch.h:49:9`!) {
1455 int i;
1456 int oldquiet = quietcxx . . $ quiet.;
1457
1458 quietcxx . . $ quiet. = 0;
1459 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "#---------------------------\n");
1460 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "# cyclictest current status:\n");
1461 for (i = 0; i < num_threadscxx . . $ num_threads.; i++)
1462 print_statcxx . . $ print_stat(9485320f19a6ade5).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, parameterscxx . . $ parameters.[i], i, 0, 0);
1463 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "#---------------------------\n");
1464 quietcxx . . $ quiet. = oldquiet;
1465 return;
1466 } else if (sig == SIGUSR2cxx . . $ `<external>/1457673850468744829/signum-arch.h:50:9`!) {
1467 int i;
1468 int oldquiet = quietcxx . . $ quiet.;
1469
1470 if (rstat_fdcxx . . $ rstat_fd. == -1) {
1471 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR: rstat_fd not valid\n");
1472 return;
1473 }
1474 rstat_ftruncatecxx . . $ rstat_ftruncate(bba9d6e9fb34fad7).(rstat_fdcxx . . $ rstat_fd., 0);
1475 quietcxx . . $ quiet. = 0;
1476 dprintfcxx . . $ dprintf(811d273381043e7b).(rstat_fdcxx . . $ rstat_fd., "#---------------------------\n");
1477 dprintfcxx . . $ dprintf(811d273381043e7b).(rstat_fdcxx . . $ rstat_fd., "# cyclictest current status:\n");
1478 for (i = 0; i < num_threadscxx . . $ num_threads.; i++)
1479 rstat_print_statcxx . . $ rstat_print_stat(d877d5c7c4de44f9).(parameterscxx . . $ parameters.[i], i, 0, 0);
1480 dprintfcxx . . $ dprintf(811d273381043e7b).(rstat_fdcxx . . $ rstat_fd., "#---------------------------\n");
1481 quietcxx . . $ quiet. = oldquiet;
1482 return;
1483 }
1484 shutdowncxx . . $ shutdown. = 1;
1485 if (refresh_on_maxcxx . . $ refresh_on_max.)
1486 pthread_cond_signalcxx . . $ pthread_cond_signal(98095c34a2b0149d).(&refresh_on_max_condcxx . . $ refresh_on_max_cond.);
1487 }
1488
1489 static void print_tidscxx . . $ print_tids(11f7a138fefa52c7).(struct thread_paramcxx . . $ thread_param# *par[], int nthreads)
1490 {
1491 int i;
1492
1493 printfcxx . . $ printf(581fddd72a8db8fc).("# Thread Ids:");
1494 for (i = 0; i < nthreads; i++)
1495 printfcxx . . $ printf(581fddd72a8db8fc).(" %05d", par[i]->statscxx . . $ thread_param#stats.->tidcxx . . $ thread_stat#tid.);
1496 printfcxx . . $ printf(581fddd72a8db8fc).("\n");
1497 }
1498
1499 static void print_histcxx . . $ print_hist(11f7a138fefa52c7).(struct thread_paramcxx . . $ thread_param# *par[], int nthreads)
1500 {
1501 int i, j;
1502 unsigned long maxmax, alloverflows;
1503 FILEcxx . . $ FILE# *fd;
1504
1505 if (use_histfilecxx . . $ use_histfile.) {
1506 fd = fopencxx . . $ fopen(82ec0787cd37e0a3).(histfilecxx . . $ histfile., "w");
1507 if (!fd) {
1508 perrorcxx . . $ perror(85c52e162fed56f9).("opening histogram file:");
1509 return;
1510 }
1511 } else {
1512 fd = stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!;
1513 }
1514
1515 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "# Histogram\n");
1516 for (i = 0; i < histogramcxx . . $ histogram.; i++) {
1517 unsigned long flags = 0;
1518 char buf[64];
1519
1520 snprintfcxx . . $ snprintf(ea502d73e74c754c).(buf, sizeof(buf), "%06d ", i);
1521
1522 if (histofallcxx . . $ histofall.)
1523 flags |= HSET_PRINT_SUMcxx . . $ `src/include/histogram.h:33:9`!;
1524 hset_print_bucketcxx . . $ hset_print_bucket(31a571358aba96cf).(&hsetcxx . . $ hset., fd, buf, i, flags);
1525 }
1526 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "# Min Latencies:");
1527 for (j = 0; j < nthreads; j++)
1528 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, " %05lu", par[j]->statscxx . . $ thread_param#stats.->mincxx . . $ thread_stat#min.);
1529 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "\n");
1530 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "# Avg Latencies:");
1531 for (j = 0; j < nthreads; j++)
1532 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, " %05lu", par[j]->statscxx . . $ thread_param#stats.->cyclescxx . . $ thread_stat#cycles. ?
1533 (long)(par[j]->statscxx . . $ thread_param#stats.->avgcxx . . $ thread_stat#avg./par[j]->statscxx . . $ thread_param#stats.->cyclescxx . . $ thread_stat#cycles.) : 0);
1534 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "\n");
1535 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "# Max Latencies:");
1536 maxmax = 0;
1537 for (j = 0; j < nthreads; j++) {
1538 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, " %05lu", par[j]->statscxx . . $ thread_param#stats.->maxcxx . . $ thread_stat#max.);
1539 if (par[j]->statscxx . . $ thread_param#stats.->maxcxx . . $ thread_stat#max. > maxmax)
1540 maxmax = par[j]->statscxx . . $ thread_param#stats.->maxcxx . . $ thread_stat#max.;
1541 }
1542 if (histofallcxx . . $ histofall. && nthreads > 1)
1543 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, " %05lu", maxmax);
1544 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "\n");
1545 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "# Histogram Overflows:");
1546 alloverflows = 0;
1547 for (j = 0; j < nthreads; j++) {
1548 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, " %05lu", par[j]->statscxx . . $ thread_param#stats.->histcxx . . $ thread_stat#hist.->oflow_countcxx . . $ histogram#oflow_count.);
1549 alloverflows += par[j]->statscxx . . $ thread_param#stats.->histcxx . . $ thread_stat#hist.->oflow_countcxx . . $ histogram#oflow_count.;
1550 }
1551 if (histofallcxx . . $ histofall. && nthreads > 1)
1552 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, " %05lu", alloverflows);
1553 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "\n");
1554
1555 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "# Histogram Overflow at cycle number:\n");
1556 for (i = 0; i < nthreads; i++) {
1557 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "# Thread %d: ", i);
1558 hist_print_oflowscxx . . $ hist_print_oflows(6acc875be05641a4).(par[i]->statscxx . . $ thread_param#stats.->histcxx . . $ thread_stat#hist., fd);
1559 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "\n");
1560 }
1561 if (smicxx . . $ smi.) {
1562 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "# SMIs:");
1563 for (i = 0; i < nthreads; i++)
1564 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, " %05lu", par[i]->statscxx . . $ thread_param#stats.->smi_countcxx . . $ thread_stat#smi_count.);
1565 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "\n");
1566 }
1567
1568 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fd, "\n");
1569
1570 if (use_histfilecxx . . $ use_histfile.)
1571 fclosecxx . . $ fclose(89bc1efcdac0ca22).(fd);
1572 }
1573
1574 static void print_statcxx . . $ print_stat(9485320f19a6ade5).(FILEcxx . . $ FILE# *fp, struct thread_paramcxx . . $ thread_param# *par, int index, int verbose, int quiet)
1575 {
1576 struct thread_statcxx . . $ thread_stat# *stat = par->statscxx . . $ thread_param#stats.;
1577
1578 if (!verbose) {
1579 if (quiet != 1) {
1580 char *fmt;
1581 if (use_nsecscxx . . $ use_nsecs.)
1582 fmt = "T:%2d (%5d) P:%2d I:%ld C:%7lu "
1583 "Min:%7ld Act:%8ld Avg:%8ld Max:%8ld";
1584 else
1585 fmt = "T:%2d (%5d) P:%2d I:%ld C:%7lu "
1586 "Min:%7ld Act:%5ld Avg:%5ld Max:%8ld";
1587
1588 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, fmt, index, stat->tidcxx . . $ thread_stat#tid., par->priocxx . . $ thread_param#prio.,
1589 par->intervalcxx . . $ thread_param#interval., stat->cyclescxx . . $ thread_stat#cycles., stat->mincxx . . $ thread_stat#min.,
1590 stat->actcxx . . $ thread_stat#act., stat->cyclescxx . . $ thread_stat#cycles. ?
1591 (long)(stat->avgcxx . . $ thread_stat#avg./stat->cyclescxx . . $ thread_stat#cycles.) : 0, stat->maxcxx . . $ thread_stat#max.);
1592
1593 if (smicxx . . $ smi.)
1594 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, " SMI:%8ld", stat->smi_countcxx . . $ thread_stat#smi_count.);
1595
1596 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, "\n");
1597 }
1598 } else {
1599 while (stat->cyclescxx . . $ thread_stat#cycles. != stat->cyclesreadcxx . . $ thread_stat#cyclesread.) {
1600 unsigned long diff_smi;
1601 long diff = stat->valuescxx . . $ thread_stat#values.
1602 [stat->cyclesreadcxx . . $ thread_stat#cyclesread. & par->bufmskcxx . . $ thread_param#bufmsk.];
1603
1604 if (smicxx . . $ smi.)
1605 diff_smi = stat->smiscxx . . $ thread_stat#smis.
1606 [stat->cyclesreadcxx . . $ thread_stat#cyclesread. & par->bufmskcxx . . $ thread_param#bufmsk.];
1607
1608 if (diff > stat->redmaxcxx . . $ thread_stat#redmax.) {
1609 stat->redmaxcxx . . $ thread_stat#redmax. = diff;
1610 stat->cycleofmaxcxx . . $ thread_stat#cycleofmax. = stat->cyclesreadcxx . . $ thread_stat#cyclesread.;
1611 }
1612 if (++stat->reducecxx . . $ thread_stat#reduce. == oscope_reductioncxx . . $ oscope_reduction.) {
1613 if (!smicxx . . $ smi.)
1614 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, "%8d:%8lu:%8ld\n", index,
1615 stat->cycleofmaxcxx . . $ thread_stat#cycleofmax., stat->redmaxcxx . . $ thread_stat#redmax.);
1616 else
1617 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, "%8d:%8lu:%8ld%8ld\n",
1618 index, stat->cycleofmaxcxx . . $ thread_stat#cycleofmax.,
1619 stat->redmaxcxx . . $ thread_stat#redmax., diff_smi);
1620
1621 stat->reducecxx . . $ thread_stat#reduce. = 0;
1622 stat->redmaxcxx . . $ thread_stat#redmax. = 0;
1623 }
1624 stat->cyclesreadcxx . . $ thread_stat#cyclesread.++;
1625 }
1626 }
1627 }
1628
1629 static void rstat_print_statcxx . . $ rstat_print_stat(d877d5c7c4de44f9).(struct thread_paramcxx . . $ thread_param# *par, int index, int verbose, int quiet)
1630 {
1631 struct thread_statcxx . . $ thread_stat# *stat = par->statscxx . . $ thread_param#stats.;
1632 int fd = rstat_fdcxx . . $ rstat_fd.;
1633
1634 if (!verbose) {
1635 if (quiet != 1) {
1636 char *fmt;
1637 if (use_nsecscxx . . $ use_nsecs.)
1638 fmt = "T:%2d (%5d) P:%2d I:%ld C:%7lu "
1639 "Min:%7ld Act:%8ld Avg:%8ld Max:%8ld";
1640 else
1641 fmt = "T:%2d (%5d) P:%2d I:%ld C:%7lu "
1642 "Min:%7ld Act:%5ld Avg:%5ld Max:%8ld";
1643
1644 dprintfcxx . . $ dprintf(811d273381043e7b).(fd, fmt, index, stat->tidcxx . . $ thread_stat#tid., par->priocxx . . $ thread_param#prio.,
1645 par->intervalcxx . . $ thread_param#interval., stat->cyclescxx . . $ thread_stat#cycles., stat->mincxx . . $ thread_stat#min.,
1646 stat->actcxx . . $ thread_stat#act., stat->cyclescxx . . $ thread_stat#cycles. ?
1647 (long)(stat->avgcxx . . $ thread_stat#avg./stat->cyclescxx . . $ thread_stat#cycles.) : 0, stat->maxcxx . . $ thread_stat#max.);
1648
1649 if (smicxx . . $ smi.)
1650 dprintfcxx . . $ dprintf(811d273381043e7b).(fd, " SMI:%8ld", stat->smi_countcxx . . $ thread_stat#smi_count.);
1651
1652 dprintfcxx . . $ dprintf(811d273381043e7b).(fd, "\n");
1653 }
1654 } else {
1655 while (stat->cyclescxx . . $ thread_stat#cycles. != stat->cyclesreadcxx . . $ thread_stat#cyclesread.) {
1656 unsigned long diff_smi;
1657 long diff = stat->valuescxx . . $ thread_stat#values.
1658 [stat->cyclesreadcxx . . $ thread_stat#cyclesread. & par->bufmskcxx . . $ thread_param#bufmsk.];
1659
1660 if (smicxx . . $ smi.)
1661 diff_smi = stat->smiscxx . . $ thread_stat#smis.
1662 [stat->cyclesreadcxx . . $ thread_stat#cyclesread. & par->bufmskcxx . . $ thread_param#bufmsk.];
1663
1664 if (diff > stat->redmaxcxx . . $ thread_stat#redmax.) {
1665 stat->redmaxcxx . . $ thread_stat#redmax. = diff;
1666 stat->cycleofmaxcxx . . $ thread_stat#cycleofmax. = stat->cyclesreadcxx . . $ thread_stat#cyclesread.;
1667 }
1668 if (++stat->reducecxx . . $ thread_stat#reduce. == oscope_reductioncxx . . $ oscope_reduction.) {
1669 if (!smicxx . . $ smi.)
1670 dprintfcxx . . $ dprintf(811d273381043e7b).(fd, "%8d:%8lu:%8ld\n", index,
1671 stat->cycleofmaxcxx . . $ thread_stat#cycleofmax., stat->redmaxcxx . . $ thread_stat#redmax.);
1672 else
1673 dprintfcxx . . $ dprintf(811d273381043e7b).(fd, "%8d:%8lu:%8ld%8ld\n",
1674 index, stat->cycleofmaxcxx . . $ thread_stat#cycleofmax.,
1675 stat->redmaxcxx . . $ thread_stat#redmax., diff_smi);
1676
1677 stat->reducecxx . . $ thread_stat#reduce. = 0;
1678 stat->redmaxcxx . . $ thread_stat#redmax. = 0;
1679 }
1680 stat->cyclesreadcxx . . $ thread_stat#cyclesread.++;
1681 }
1682 }
1683 }
1684
1685
1686 /*
1687 * thread that creates a named fifo and hands out run stats when someone
1688 * reads from the fifo.
1689 */
1690 static void *fifothreadcxx . . $ fifothread(9f162e79bfc6c74).(void *param)
1691 {
1692 int ret;
1693 int fd;
1694 FILEcxx . . $ FILE# *fp;
1695 int i;
1696
1697 unlinkcxx . . $ unlink(5c4306d8553b3696).(fifopathcxx . . $ fifopath.);
1698 ret = mkfifocxx . . $ mkfifo(1df18506ef0a631b).(fifopathcxx . . $ fifopath., 0666);
1699 if (ret) {
1700 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Error creating fifo %s: %s\n", fifopathcxx . . $ fifopath., strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
1701 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1702 }
1703 while (!shutdowncxx . . $ shutdown.) {
1704 fd = opencxx . . $ open(e156e3aa1e5c4ad1).(fifopathcxx . . $ fifopath., O_WRONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:44:9`!|O_NONBLOCKcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:62:10`!);
1705 if (fd < 0) {
1706 usleepcxx . . $ usleep(4c679297bf94b9eb).(500000);
1707 continue;
1708 }
1709 fp = fdopencxx . . $ fdopen(8f4e2d7350ebd077).(fd, "w");
1710 for (i=0; i < num_threadscxx . . $ num_threads.; i++)
1711 print_statcxx . . $ print_stat(9485320f19a6ade5).(fp, parameterscxx . . $ parameters.[i], i, 0, 0);
1712 fclosecxx . . $ fclose(89bc1efcdac0ca22).(fp);
1713 usleepcxx . . $ usleep(4c679297bf94b9eb).(250);
1714 }
1715 unlinkcxx . . $ unlink(5c4306d8553b3696).(fifopathcxx . . $ fifopath.);
1716 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1717 }
1718
1719 static int trigger_initcxx . . $ trigger_init(d1b40a211a1a4e4c).()
1720 {
1721 int i;
1722 int size = trigger_list_sizecxx . . $ trigger_list_size.;
1723 struct thread_triggercxx . . $ thread_trigger# *trig = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1724 for(i=0; i<size; i++) {
1725 trig = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct thread_triggercxx . . $ thread_trigger#));
1726 if (trig != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
1727 if (headcxx . . $ head. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
1728 headcxx . . $ head. = trig;
1729 tailcxx . . $ tail. = trig;
1730 } else {
1731 tailcxx . . $ tail.->nextcxx . . $ thread_trigger#next. = trig;
1732 tailcxx . . $ tail. = trig;
1733 }
1734 trig->tnumcxx . . $ thread_trigger#tnum. = i;
1735 trig->nextcxx . . $ thread_trigger#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1736 } else {
1737 return -1;
1738 }
1739 }
1740 currentcxx . . $ current. = headcxx . . $ head.;
1741 return 0;
1742 }
1743
1744 static void trigger_printcxx . . $ trigger_print(d878ad36e69247c7).()
1745 {
1746 struct thread_triggercxx . . $ thread_trigger# *trig = headcxx . . $ head.;
1747 char *fmt = "T:%2d Spike:%8ld: TS: %12ld\n";
1748
1749 if (currentcxx . . $ current. == headcxx . . $ head.)
1750 return;
1751 printfcxx . . $ printf(581fddd72a8db8fc).("\n");
1752 while (trig->nextcxx . . $ thread_trigger#next. != currentcxx . . $ current.) {
1753 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, fmt, trig->tnumcxx . . $ thread_trigger#tnum., trig->diffcxx . . $ thread_trigger#diff., trig->tscxx . . $ thread_trigger#ts.);
1754 trig = trig->nextcxx . . $ thread_trigger#next.;
1755 }
1756 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, fmt, trig->tnumcxx . . $ thread_trigger#tnum., trig->diffcxx . . $ thread_trigger#diff., trig->tscxx . . $ thread_trigger#ts.);
1757 printfcxx . . $ printf(581fddd72a8db8fc).("spikes = %d\n\n", spikescxx . . $ spikes.);
1758 }
1759
1760 static void trigger_updatecxx . . $ trigger_update(4178c2305174e7b9).(struct thread_paramcxx . . $ thread_param# *par, int diff, int64_tcxx . . $ int64_t# ts)
1761 {
1762 pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&trigger_lockcxx . . $ trigger_lock.);
1763 if (currentcxx . . $ current. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
1764 currentcxx . . $ current.->tnumcxx . . $ thread_trigger#tnum. = par->tnumcxx . . $ thread_param#tnum.;
1765 currentcxx . . $ current.->tscxx . . $ thread_trigger#ts. = ts;
1766 currentcxx . . $ current.->diffcxx . . $ thread_trigger#diff. = diff;
1767 currentcxx . . $ current. = currentcxx . . $ current.->nextcxx . . $ thread_trigger#next.;
1768 }
1769 spikescxx . . $ spikes.++;
1770 pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&trigger_lockcxx . . $ trigger_lock.);
1771 }
1772
1773 /* Running status shared memory open */
1774 static int rstat_shm_opencxx . . $ rstat_shm_open(b126dc7c1de90089).(void)
1775 {
1776 int fd;
1777 pid_tcxx . . $ pid_t# pid;
1778
1779 pid = getpidcxx . . $ getpid(b126dc7c1de90089).();
1780
1781 snprintfcxx . . $ snprintf(ea502d73e74c754c).(shm_namecxx . . $ shm_name., SHM_BUF_SIZEcxx . . $ `src/cyclictest/cyclictest.c:234:9`!, "%s%d", "/cyclictest", pid);
1782
1783 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
1784 fd = shm_unlinkcxx . . $ shm_unlink(5c4306d8553b3696).(shm_namecxx . . $ shm_name.);
1785
1786 if ((fd == -1) && (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! != ENOENTcxx . . $ `<external>/8987895939074593727/errno-base.h:6:9`!)) {
1787 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR: shm_unlink %s\n", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
1788 return fd;
1789 }
1790
1791 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 9;
1792 fd = shm_opencxx . . $ shm_open(ac5e327aedb29b06).(shm_namecxx . . $ shm_name., O_RDWRcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:45:9`!|O_CREATcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:47:10`!|O_EXCLcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:50:10`!, S_IRUSRcxx . . $ `<external>/531885356569766532/stat.h:168:9`!|S_IWUSRcxx . . $ `<external>/531885356569766532/stat.h:169:9`!|S_IRGRPcxx . . $ `<external>/531885356569766532/stat.h:180:9`!|S_IWGRPcxx . . $ `<external>/531885356569766532/stat.h:181:9`!|S_IROTHcxx . . $ `<external>/531885356569766532/stat.h:186:9`!|S_IWOTHcxx . . $ `<external>/531885356569766532/stat.h:187:9`!);
1793 if (fd == -1)
1794 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR: shm_open %s\n", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
1795
1796 rstat_fdcxx . . $ rstat_fd. = fd;
1797
1798 return fd;
1799 }
1800
1801 static int rstat_ftruncatecxx . . $ rstat_ftruncate(bba9d6e9fb34fad7).(int fd, off_tcxx . . $ off_t# len)
1802 {
1803 int err;
1804
1805 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
1806 err = ftruncatecxx . . $ ftruncate(bba9d6e9fb34fad7).(fd, len);
1807 if (err)
1808 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ftruncate error %s\n", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
1809
1810 return err;
1811 }
1812
1813 static void *rstat_mmapcxx . . $ rstat_mmap(d1680a912d714170).(int fd)
1814 {
1815 void *mptr;
1816
1817 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
1818 mptr = mmapcxx . . $ mmap(ff06c1c904cdf0e2).(0, _SC_PAGE_SIZEcxx . . $ `<external>/6393649343499073842/confname.h:135:9`!, PROT_READcxx . . $ `<external>/17226767460805440860/mman-linux.h:32:9`!|PROT_WRITEcxx . . $ `<external>/17226767460805440860/mman-linux.h:33:9`!, MAP_SHAREDcxx . . $ `<external>/17226767460805440860/mman-linux.h:42:9`!, fd, 0);
1819
1820 if (mptr == (void*)-1)
1821 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR: mmap, %s\n", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
1822
1823 return mptr;
1824 }
1825
1826 static int rstat_mlockcxx . . $ rstat_mlock(dedf1e9b1c614a07).(void *mptr)
1827 {
1828 int err;
1829
1830 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
1831 err = mlockcxx . . $ mlock(a10e65277395b633).(mptr, _SC_PAGE_SIZEcxx . . $ `<external>/6393649343499073842/confname.h:135:9`!);
1832 if (err == -1)
1833 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR, mlock %s\n", strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
1834
1835 return err;
1836 }
1837
1838 static void rstat_setupcxx . . $ rstat_setup(49f6e7a06ebc5aa8).(void)
1839 {
1840 int res;
1841 void *mptr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1842
1843 int sfd = rstat_shm_opencxx . . $ rstat_shm_open(b126dc7c1de90089).();
1844 if (sfd < 0)
1845 goto rstat_err;
1846
1847 res = rstat_ftruncatecxx . . $ rstat_ftruncate(bba9d6e9fb34fad7).(sfd, _SC_PAGE_SIZEcxx . . $ `<external>/6393649343499073842/confname.h:135:9`!);
1848 if (res)
1849 goto rstat_err1;
1850
1851 mptr = rstat_mmapcxx . . $ rstat_mmap(d1680a912d714170).(sfd);
1852 if (mptr == MAP_FAILEDcxx . . $ `<external>/6724834311684550606/mman.h:44:9`!)
1853 goto rstat_err1;
1854
1855 res = rstat_mlockcxx . . $ rstat_mlock(dedf1e9b1c614a07).(mptr);
1856 if (res)
1857 goto rstat_err2;
1858
1859 return;
1860
1861 rstat_err2:
1862 munmapcxx . . $ munmap(c0a5f96701d3f89).(mptr, _SC_PAGE_SIZEcxx . . $ `<external>/6393649343499073842/confname.h:135:9`!);
1863 rstat_err1:
1864 closecxx . . $ close(7864480464b09eea).(sfd);
1865 shm_unlinkcxx . . $ shm_unlink(5c4306d8553b3696).(shm_namecxx . . $ shm_name.);
1866 rstat_err:
1867 rstat_fdcxx . . $ rstat_fd. = -1;
1868 return;
1869 }
1870
1871 static void write_statscxx . . $ write_stats(2fd218767557b4b8).(FILEcxx . . $ FILE# *f, void *data)
1872 {
1873 struct thread_paramcxx . . $ thread_param# **par = parameterscxx . . $ parameters.;
1874 int i;
1875 struct thread_statcxx . . $ thread_stat# *s;
1876
1877 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"num_threads\": %d,\n", num_threadscxx . . $ num_threads.);
1878 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"resolution_in_ns\": %u,\n", use_nsecscxx . . $ use_nsecs.);
1879 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"thread\": {\n");
1880 for (i = 0; i < num_threadscxx . . $ num_threads.; i++) {
1881 s = par[i]->statscxx . . $ thread_param#stats.;
1882 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"%u\": {\n", i);
1883 if (s->histcxx . . $ thread_stat#hist.) {
1884 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"histogram\": {");
1885 hist_print_jsoncxx . . $ hist_print_json(6acc875be05641a4).(s->histcxx . . $ thread_stat#hist., f);
1886 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " },\n");
1887 }
1888 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"cycles\": %ld,\n", s->cyclescxx . . $ thread_stat#cycles.);
1889 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"min\": %ld,\n", s->mincxx . . $ thread_stat#min.);
1890 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"max\": %ld,\n", s->maxcxx . . $ thread_stat#max.);
1891 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"avg\": %.2f,\n", s->avgcxx . . $ thread_stat#avg./s->cyclescxx . . $ thread_stat#cycles.);
1892 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"cpu\": %d,\n", par[i]->cpucxx . . $ thread_param#cpu.);
1893 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"node\": %d\n", par[i]->nodecxx . . $ thread_param#node.);
1894 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " }%s\n", i == num_threadscxx . . $ num_threads. - 1 ? "" : ",");
1895 }
1896 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " }\n");
1897 }
1898
1899 static void set_main_thread_affinitycxx . . $ set_main_thread_affinity(d7c6455decaee94d).(struct bitmaskcxx . . $ bitmask# *cpumask)
1900 {
1901 int res;
1902
1903 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
1904 res = numa_sched_setaffinitycxx . . $ numa_sched_setaffinity(cf9f0dd4c417177b).(getpidcxx . . $ getpid(b126dc7c1de90089).(), cpumask);
1905 if (res != 0)
1906 warncxx . . $ warn(d5d9ff45db7b5d36).("Couldn't setaffinity in main thread: %s\n",
1907 strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
1908 }
1909
1910 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv)
1911 {
1912 sigset_tcxx . . $ sigset_t# sigset;
1913 int signum = SIGALRMcxx . . $ `<external>/11773118241360591791/signum-generic.h:61:9`!;
1914 int mode;
1915 int cpu;
1916 int max_cpus = sysconfcxx . . $ sysconf(dc1f09c09fbff20f).(_SC_NPROCESSORS_CONFcxx . . $ `<external>/6393649343499073842/confname.h:251:9`!);
1917 int online_cpus = sysconfcxx . . $ sysconf(dc1f09c09fbff20f).(_SC_NPROCESSORS_ONLNcxx . . $ `<external>/6393649343499073842/confname.h:253:9`!);
1918 int i, ret = -1;
1919 int status;
1920
1921 rt_initcxx . . $ rt_init(c759356ac01a31e7).(argc, argv);
1922 process_optionscxx . . $ process_options(4e6df296d283b65d).(argc, argv, max_cpus);
1923
1924 if (check_privscxx . . $ check_privs(b126dc7c1de90089).())
1925 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!);
1926
1927 if (verbosecxx . . $ verbose.) {
1928 printfcxx . . $ printf(581fddd72a8db8fc).("Max CPUs = %d\n", max_cpus);
1929 printfcxx . . $ printf(581fddd72a8db8fc).("Online CPUs = %d\n", online_cpus);
1930 }
1931
1932 if (affinity_maskcxx . . $ affinity_mask. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) {
1933 set_main_thread_affinitycxx . . $ set_main_thread_affinity(d7c6455decaee94d).(affinity_maskcxx . . $ affinity_mask.);
1934 if (verbosecxx . . $ verbose.)
1935 printfcxx . . $ printf(581fddd72a8db8fc).("Using %u cpus.\n",
1936 numa_bitmask_weightcxx . . $ numa_bitmask_weight(4b55de75830e9378).(affinity_maskcxx . . $ affinity_mask.));
1937 }
1938
1939 if (triggercxx . . $ trigger.) {
1940 int retval;
1941 retval = trigger_initcxx . . $ trigger_init(d1b40a211a1a4e4c).();
1942 if (retval != 0) {
1943 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "trigger_init() failed\n");
1944 exitcxx . . $ exit(3ca292c338df9bb3).(EXIT_FAILUREcxx . . $ `<external>/10696550936717951914/stdlib.h:92:9`!);
1945 }
1946 }
1947
1948 /* lock all memory (prevent swapping) */
1949 if (lockallcxx . . $ lockall.)
1950 if (mlockallcxx . . $ mlockall(7864480464b09eea).(MCL_CURRENTcxx . . $ `<external>/17226767460805440860/mman-linux.h:131:10`!|MCL_FUTUREcxx . . $ `<external>/17226767460805440860/mman-linux.h:132:10`!) == -1) {
1951 perrorcxx . . $ perror(85c52e162fed56f9).("mlockall");
1952 goto out;
1953 }
1954
1955 /* use the /dev/cpu_dma_latency trick if it's there */
1956 set_latency_targetcxx . . $ set_latency_target(49f6e7a06ebc5aa8).();
1957
1958 if (deepest_idle_statecxx . . $ deepest_idle_state. >= -1) {
1959 if (!have_libcpupower_supportcxx . . $ have_libcpupower_support(b126dc7c1de90089).()) {
1960 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "cyclictest built without libcpupower, --deepest-idle-state is not supported\n");
1961 goto out;
1962 }
1963
1964 for (i = 0; i < max_cpus; i++) {
1965 if (affinity_maskcxx . . $ affinity_mask. && !numa_bitmask_isbitsetcxx . . $ numa_bitmask_isbitset(9048e51cedd65d8e).(affinity_maskcxx . . $ affinity_mask., i))
1966 continue;
1967 if (save_cpu_idle_disable_statecxx . . $ save_cpu_idle_disable_state(4c679297bf94b9eb).(i) < 0) {
1968 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Could not save cpu idle state.\n");
1969 goto out;
1970 }
1971 if (set_deepest_cpu_idle_statecxx . . $ set_deepest_cpu_idle_state(21cb2064190e2a90).(i, deepest_idle_statecxx . . $ deepest_idle_state.) < 0) {
1972 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Could not set deepest cpu idle state.\n");
1973 goto out;
1974 }
1975 }
1976 }
1977
1978 if (tracelimitcxx . . $ tracelimit. && trace_markercxx . . $ trace_marker.)
1979 enable_trace_markcxx . . $ enable_trace_mark(49f6e7a06ebc5aa8).();
1980
1981 if (check_timercxx . . $ check_timer(b126dc7c1de90089).())
1982 warncxx . . $ warn(d5d9ff45db7b5d36).("High resolution timers not available\n");
1983
1984 if (check_clock_resolutioncxx . . $ check_clock_resolution.) {
1985 int clock;
1986 uint64_tcxx . . $ uint64_t# diff;
1987 int k;
1988 uint64_tcxx . . $ uint64_t# min_non_zero_diff = UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`!;
1989 struct timespeccxx . . $ timespec# now;
1990 struct timespeccxx . . $ timespec# prev;
1991 uint64_tcxx . . $ uint64_t# reported_resolution = UINT64_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:119:10`!;
1992 struct timespeccxx . . $ timespec# res;
1993 struct timespeccxx . . $ timespec# *time;
1994 int times;
1995
1996 clock = clocksourcescxx . . $ clocksources.[clockselcxx . . $ clocksel.];
1997
1998 if (clock_getrescxx . . $ clock_getres(65aaefb2502b4987).(clock, &res))
1999 warncxx . . $ warn(d5d9ff45db7b5d36).("clock_getres failed");
2000 else
2001 reported_resolution = (NSEC_PER_SECcxx . . $ `src/include/rt-utils.h:39:9`! * res.tv_seccxx . . $ timespec#tv_sec.) + res.tv_nseccxx . . $ timespec#tv_nsec.;
2002
2003
2004 /*
2005 * Calculate how many calls to clock_gettime are needed.
2006 * Then call it that many times.
2007 * Goal is to collect timestamps for ~ 0.001 sec.
2008 * This will reliably capture resolution <= 500 usec.
2009 */
2010 times = 1000;
2011 clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(clock, &prev);
2012 for (k=0; k < times; k++)
2013 clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(clock, &now);
2014
2015 diff = calcdiff_nscxx . . $ calcdiff_ns(a7174a6ca78cf3cd).(now, prev);
2016 if (diff == 0) {
2017 /*
2018 * No clock rollover occurred.
2019 * Use the default value for times.
2020 */
2021 times = -1;
2022 } else {
2023 int call_time;
2024 call_time = diff / times; /* duration 1 call */
2025 times = NSEC_PER_SECcxx . . $ `src/include/rt-utils.h:39:9`! / call_time; /* calls per second */
2026 times /= 1000; /* calls per msec */
2027 if (times < 1000)
2028 times = 1000;
2029 }
2030 /* sanity check */
2031 if ((times <= 0) || (times > 100000))
2032 times = 100000;
2033
2034 time = calloccxx . . $ calloc(63a7bf2941bfcd7a).(times, sizeof(*time));
2035
2036 for (k=0; k < times; k++)
2037 clock_gettimecxx . . $ clock_gettime(65aaefb2502b4987).(clock, &time[k]);
2038
2039 infocxx . . $ info(26800c7917ec8ef2).(ct_debugcxx . . $ ct_debug., "For %d consecutive calls to clock_gettime():\n", times);
2040 infocxx . . $ info(26800c7917ec8ef2).(ct_debugcxx . . $ ct_debug., "time, delta time (nsec)\n");
2041
2042 prev = time[0];
2043 for (k=1; k < times; k++) {
2044
2045 diff = calcdiff_nscxx . . $ calcdiff_ns(a7174a6ca78cf3cd).(time[k], prev);
2046 prev = time[k];
2047
2048 if (diff && (diff < min_non_zero_diff))
2049 min_non_zero_diff = diff;
2050
2051 infocxx . . $ info(26800c7917ec8ef2).(ct_debugcxx . . $ ct_debug., "%ld.%06ld %5llu\n",
2052 time[k].tv_seccxx . . $ timespec#tv_sec., time[k].tv_nseccxx . . $ timespec#tv_nsec.,
2053 (unsigned long long)diff);
2054 }
2055
2056 freecxx . . $ free(5d22bdacc48458e8).(time);
2057
2058
2059 if (verbosecxx . . $ verbose. ||
2060 (min_non_zero_diff && (min_non_zero_diff > reported_resolution))) {
2061 /*
2062 * Measured clock resolution includes the time to call
2063 * clock_gettime(), so it will be slightly larger than
2064 * actual resolution.
2065 */
2066 warncxx . . $ warn(d5d9ff45db7b5d36).("reported clock resolution: %llu nsec\n",
2067 (unsigned long long)reported_resolution);
2068 warncxx . . $ warn(d5d9ff45db7b5d36).("measured clock resolution approximately: %llu nsec\n",
2069 (unsigned long long)min_non_zero_diff);
2070 }
2071
2072 }
2073
2074
2075 mode = use_nanosleepcxx . . $ use_nanosleep. + use_systemcxx . . $ use_system.;
2076
2077 sigemptysetcxx . . $ sigemptyset(f9c066a8ff75ee9d).(&sigset);
2078 sigaddsetcxx . . $ sigaddset(4917c6e3ecb7dbd5).(&sigset, signum);
2079 sigprocmaskcxx . . $ sigprocmask(7504382baa173b1).(SIG_BLOCKcxx . . $ `<external>/16635209305659446502/sigaction.h:79:9`!, &sigset, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2080
2081 signalcxx . . $ signal(c2d516773f91faf8).(SIGINTcxx . . $ `<external>/11773118241360591791/signum-generic.h:48:9`!, sighandcxx . . $ sighand(d4f767463ce0a6b3).);
2082 signalcxx . . $ signal(c2d516773f91faf8).(SIGTERMcxx . . $ `<external>/11773118241360591791/signum-generic.h:53:9`!, sighandcxx . . $ sighand(d4f767463ce0a6b3).);
2083 signalcxx . . $ signal(c2d516773f91faf8).(SIGUSR1cxx . . $ `<external>/1457673850468744829/signum-arch.h:49:9`!, sighandcxx . . $ sighand(d4f767463ce0a6b3).);
2084 signalcxx . . $ signal(c2d516773f91faf8).(SIGUSR2cxx . . $ `<external>/1457673850468744829/signum-arch.h:50:9`!, sighandcxx . . $ sighand(d4f767463ce0a6b3).);
2085
2086 /* Set-up shm */
2087 rstat_setupcxx . . $ rstat_setup(49f6e7a06ebc5aa8).();
2088
2089 if (histogramcxx . . $ histogram. && hset_initcxx . . $ hset_init(f7593c26bdc66446).(&hsetcxx . . $ hset., num_threadscxx . . $ num_threads., 1, histogramcxx . . $ histogram., histogramcxx . . $ histogram.))
2090 fatalcxx . . $ fatal(5313ecf19fd40d4d).("failed to allocate histogram of size %d for %d threads\n",
2091 histogramcxx . . $ histogram., num_threadscxx . . $ num_threads.);
2092
2093 parameterscxx . . $ parameters. = calloccxx . . $ calloc(63a7bf2941bfcd7a).(num_threadscxx . . $ num_threads., sizeof(struct thread_paramcxx . . $ thread_param# *));
2094 if (!parameterscxx . . $ parameters.)
2095 goto out;
2096 statisticscxx . . $ statistics. = calloccxx . . $ calloc(63a7bf2941bfcd7a).(num_threadscxx . . $ num_threads., sizeof(struct thread_statcxx . . $ thread_stat# *));
2097 if (!statisticscxx . . $ statistics.)
2098 goto outpar;
2099
2100 for (i = 0; i < num_threadscxx . . $ num_threads.; i++) {
2101 pthread_attr_tcxx . . $ pthread_attr_t# attr;
2102 int node;
2103 struct thread_paramcxx . . $ thread_param# *par;
2104 struct thread_statcxx . . $ thread_stat# *stat;
2105
2106 status = pthread_attr_initcxx . . $ pthread_attr_init(26f1688c57ac69c9).(&attr);
2107 if (status != 0)
2108 fatalcxx . . $ fatal(5313ecf19fd40d4d).("error from pthread_attr_init for thread %d: %s\n", i, strerrorcxx . . $ strerror(ff224f080444ee45).(status));
2109
2110 switch (setaffinitycxx . . $ setaffinity.) {
2111 case AFFINITY_UNSPECIFIEDcxx . . $ AFFINITY_UNSPECIFIED.: cpu = -1; break;
2112 case AFFINITY_SPECIFIEDcxx . . $ AFFINITY_SPECIFIED.:
2113 cpu = cpu_for_thread_spcxx . . $ cpu_for_thread_sp(5778b5fee399886d).(i, max_cpus, affinity_maskcxx . . $ affinity_mask.);
2114 if (verbosecxx . . $ verbose.)
2115 printfcxx . . $ printf(581fddd72a8db8fc).("Thread %d using cpu %d.\n", i, cpu);
2116 break;
2117 case AFFINITY_USEALLcxx . . $ AFFINITY_USEALL.:
2118 cpu = cpu_for_thread_uacxx . . $ cpu_for_thread_ua(9b79fb6aee4c0440).(i, max_cpus);
2119 break;
2120 default: cpu = -1;
2121 }
2122
2123 node = -1;
2124 if (numacxx . . $ numa.) {
2125 void *stack;
2126 void *currstk;
2127 size_t stksize;
2128 int node_cpu = cpu;
2129
2130 if (node_cpu == -1)
2131 node_cpu = cpu_for_thread_uacxx . . $ cpu_for_thread_ua(9b79fb6aee4c0440).(i, max_cpus);
2132
2133 /* find the memory node associated with the cpu i */
2134 node = rt_numa_numa_node_of_cpucxx . . $ rt_numa_numa_node_of_cpu(7864480464b09eea).(node_cpu);
2135
2136 /* get the stack size set for this thread */
2137 if (pthread_attr_getstackcxx . . $ pthread_attr_getstack(28fe872e3b3ca5a0).(&attr, &currstk, &stksize))
2138 fatalcxx . . $ fatal(5313ecf19fd40d4d).("failed to get stack size for thread %d\n", i);
2139
2140 /* if the stack size is zero, set a default */
2141 if (stksize == 0)
2142 stksize = PTHREAD_STACK_MINcxx . . $ `<external>/11267432835508762835/pthread_stack_min-dynamic.h:26:12`! * 2;
2143
2144 /* allocate memory for a stack on appropriate node */
2145 stack = rt_numa_numa_alloc_onnodecxx . . $ rt_numa_numa_alloc_onnode(dfdaf3847145fa8e).(stksize, node, node_cpu);
2146
2147 /* touch the stack pages to pre-fault them in */
2148 memsetcxx . . $ memset(d1de1e4fb215f1c6).(stack, 0, stksize);
2149
2150 /* set the thread's stack */
2151 if (pthread_attr_setstackcxx . . $ pthread_attr_setstack(d7601e7aeb569100).(&attr, stack, stksize))
2152 fatalcxx . . $ fatal(5313ecf19fd40d4d).("failed to set stack addr for thread %d to 0x%x\n",
2153 i, stack+stksize);
2154 }
2155
2156 /* allocate the thread's parameter block */
2157 parameterscxx . . $ parameters.[i] = par = threadalloccxx . . $ threadalloc(18cbab4a1db6709c).(sizeof(struct thread_paramcxx . . $ thread_param#), node);
2158 if (par == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2159 fatalcxx . . $ fatal(5313ecf19fd40d4d).("error allocating thread_param struct for thread %d\n", i);
2160 memsetcxx . . $ memset(d1de1e4fb215f1c6).(par, 0, sizeof(struct thread_paramcxx . . $ thread_param#));
2161
2162 /* allocate the thread's statistics block */
2163 statisticscxx . . $ statistics.[i] = stat = threadalloccxx . . $ threadalloc(18cbab4a1db6709c).(sizeof(struct thread_statcxx . . $ thread_stat#), node);
2164 if (stat == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2165 fatalcxx . . $ fatal(5313ecf19fd40d4d).("error allocating thread status struct for thread %d\n", i);
2166 memsetcxx . . $ memset(d1de1e4fb215f1c6).(stat, 0, sizeof(struct thread_statcxx . . $ thread_stat#));
2167
2168 if (histogramcxx . . $ histogram.)
2169 stat->histcxx . . $ thread_stat#hist. = &hsetcxx . . $ hset..histoscxx . . $ histoset#histos.[i];
2170
2171 if (verbosecxx . . $ verbose.) {
2172 int bufsize = VALBUF_SIZEcxx . . $ `src/cyclictest/cyclictest.c:101:9`! * sizeof(long);
2173 stat->valuescxx . . $ thread_stat#values. = threadalloccxx . . $ threadalloc(18cbab4a1db6709c).(bufsize, node);
2174 if (!stat->valuescxx . . $ thread_stat#values.)
2175 goto outall;
2176 memsetcxx . . $ memset(d1de1e4fb215f1c6).(stat->valuescxx . . $ thread_stat#values., 0, bufsize);
2177 par->bufmskcxx . . $ thread_param#bufmsk. = VALBUF_SIZEcxx . . $ `src/cyclictest/cyclictest.c:101:9`! - 1;
2178 if (smicxx . . $ smi.) {
2179 stat->smiscxx . . $ thread_stat#smis. = threadalloccxx . . $ threadalloc(18cbab4a1db6709c).(bufsize, node);
2180 if (!stat->smiscxx . . $ thread_stat#smis.)
2181 goto outall;
2182 memsetcxx . . $ memset(d1de1e4fb215f1c6).(stat->smiscxx . . $ thread_stat#smis., 0, bufsize);
2183 }
2184 }
2185
2186 par->priocxx . . $ thread_param#prio. = prioritycxx . . $ priority.;
2187 if (prioritycxx . . $ priority. && (policycxx . . $ policy. == SCHED_FIFOcxx . . $ `<external>/4872883757279652994/sched.h:29:9`! || policycxx . . $ policy. == SCHED_RRcxx . . $ `<external>/4872883757279652994/sched.h:30:9`!))
2188 par->policycxx . . $ thread_param#policy. = policycxx . . $ policy.;
2189 else {
2190 par->policycxx . . $ thread_param#policy. = SCHED_OTHERcxx . . $ `<external>/4872883757279652994/sched.h:28:9`!;
2191 force_sched_othercxx . . $ force_sched_other. = 1;
2192 }
2193 if (priospreadcxx . . $ priospread.)
2194 prioritycxx . . $ priority.--;
2195 par->clockcxx . . $ thread_param#clock. = clocksourcescxx . . $ clocksources.[clockselcxx . . $ clocksel.];
2196 par->modecxx . . $ thread_param#mode. = mode;
2197 par->timermodecxx . . $ thread_param#timermode. = timermodecxx . . $ timermode.;
2198 par->signalcxx . . $ thread_param#signal. = signum;
2199 par->intervalcxx . . $ thread_param#interval. = intervalcxx . . $ interval.;
2200 if (!histogramcxx . . $ histogram.) /* same interval on CPUs */
2201 intervalcxx . . $ interval. += distancecxx . . $ distance.;
2202 if (verbosecxx . . $ verbose.)
2203 printfcxx . . $ printf(581fddd72a8db8fc).("Thread %d Interval: %d\n", i, intervalcxx . . $ interval.);
2204
2205 par->max_cyclescxx . . $ thread_param#max_cycles. = max_cyclescxx . . $ max_cycles.;
2206 par->statscxx . . $ thread_param#stats. = stat;
2207 par->nodecxx . . $ thread_param#node. = node;
2208 par->tnumcxx . . $ thread_param#tnum. = i;
2209 par->cpucxx . . $ thread_param#cpu. = cpu;
2210
2211 stat->mincxx . . $ thread_stat#min. = 1000000;
2212 stat->maxcxx . . $ thread_stat#max. = 0;
2213 stat->avgcxx . . $ thread_stat#avg. = 0.0;
2214 stat->threadstartedcxx . . $ thread_stat#threadstarted. = 1;
2215 stat->smi_countcxx . . $ thread_stat#smi_count. = 0;
2216 status = pthread_createcxx . . $ pthread_create(2141a84bcac899e5).(&stat->threadcxx . . $ thread_stat#thread., &attr, timerthreadcxx . . $ timerthread(9f162e79bfc6c74)., par);
2217 if (status)
2218 fatalcxx . . $ fatal(5313ecf19fd40d4d).("failed to create thread %d: %s\n", i, strerrorcxx . . $ strerror(ff224f080444ee45).(status));
2219
2220 }
2221 /* Restrict the main pid to the affinity specified by the user */
2222 if (main_affinity_maskcxx . . $ main_affinity_mask. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
2223 set_main_thread_affinitycxx . . $ set_main_thread_affinity(d7c6455decaee94d).(main_affinity_maskcxx . . $ main_affinity_mask.);
2224
2225 if (use_fifocxx . . $ use_fifo.) {
2226 status = pthread_createcxx . . $ pthread_create(2141a84bcac899e5).(&fifo_threadidcxx . . $ fifo_threadid., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, fifothreadcxx . . $ fifothread(9f162e79bfc6c74)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2227 if (status)
2228 fatalcxx . . $ fatal(5313ecf19fd40d4d).("failed to create fifo thread: %s\n", strerrorcxx . . $ strerror(ff224f080444ee45).(status));
2229 }
2230
2231 while (!shutdowncxx . . $ shutdown.) {
2232 char lavg[256];
2233 int fd, len, allstopped = 0;
2234 static char *policystr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
2235 static char *slash = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
2236 static char *policystr2;
2237
2238 if (!policystr)
2239 policystr = policynamecxx . . $ policyname(ff224f080444ee45).(policycxx . . $ policy.);
2240
2241 if (!slash) {
2242 if (force_sched_othercxx . . $ force_sched_other.) {
2243 slash = "/";
2244 policystr2 = policynamecxx . . $ policyname(ff224f080444ee45).(SCHED_OTHERcxx . . $ `<external>/4872883757279652994/sched.h:28:9`!);
2245 } else
2246 slash = policystr2 = "";
2247 }
2248 if (!verbosecxx . . $ verbose. && !quietcxx . . $ quiet.) {
2249 fd = opencxx . . $ open(e156e3aa1e5c4ad1).("/proc/loadavg", O_RDONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:43:9`!, 0666);
2250 len = readcxx . . $ read(7e34d0a36f355389).(fd, &lavg, 255);
2251 closecxx . . $ close(7864480464b09eea).(fd);
2252 lavg[len-1] = 0x0;
2253 printfcxx . . $ printf(581fddd72a8db8fc).("policy: %s%s%s: loadavg: %s \n\n",
2254 policystr, slash, policystr2, lavg);
2255 }
2256
2257 for (i = 0; i < num_threadscxx . . $ num_threads.; i++) {
2258
2259 print_statcxx . . $ print_stat(9485320f19a6ade5).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, parameterscxx . . $ parameters.[i], i, verbosecxx . . $ verbose., quietcxx . . $ quiet.);
2260 if (max_cyclescxx . . $ max_cycles. && statisticscxx . . $ statistics.[i]->cyclescxx . . $ thread_stat#cycles. >= max_cyclescxx . . $ max_cycles.)
2261 allstopped++;
2262 }
2263
2264 usleepcxx . . $ usleep(4c679297bf94b9eb).(10000);
2265 if (shutdowncxx . . $ shutdown. || allstopped)
2266 break;
2267 if (!verbosecxx . . $ verbose. && !quietcxx . . $ quiet.)
2268 printfcxx . . $ printf(581fddd72a8db8fc).("\033[%dA", num_threadscxx . . $ num_threads. + 2);
2269
2270 if (refresh_on_maxcxx . . $ refresh_on_max.) {
2271 pthread_mutex_lockcxx . . $ pthread_mutex_lock(d89ae235521888f9).(&refresh_on_max_lockcxx . . $ refresh_on_max_lock.);
2272 if (!shutdowncxx . . $ shutdown.)
2273 pthread_cond_waitcxx . . $ pthread_cond_wait(6145be15a5d9db5d).(&refresh_on_max_condcxx . . $ refresh_on_max_cond.,
2274 &refresh_on_max_lockcxx . . $ refresh_on_max_lock.);
2275 pthread_mutex_unlockcxx . . $ pthread_mutex_unlock(d89ae235521888f9).(&refresh_on_max_lockcxx . . $ refresh_on_max_lock.);
2276 }
2277 }
2278 ret = EXIT_SUCCESScxx . . $ `<external>/10696550936717951914/stdlib.h:93:9`!;
2279
2280 outall:
2281 shutdowncxx . . $ shutdown. = 1;
2282 usleepcxx . . $ usleep(4c679297bf94b9eb).(50000);
2283
2284 if (!verbosecxx . . $ verbose. && !quietcxx . . $ quiet. && refresh_on_maxcxx . . $ refresh_on_max.)
2285 printfcxx . . $ printf(581fddd72a8db8fc).("\033[%dB", num_threadscxx . . $ num_threads. + 2);
2286
2287 if (strlencxx . . $ strlen(751346f8406fd082).(jsonfilecxx . . $ jsonfile.) != 0)
2288 rt_write_jsoncxx . . $ rt_write_json(969c696bbc9a09ad).(jsonfilecxx . . $ jsonfile., ret, write_statscxx . . $ write_stats(2fd218767557b4b8)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2289
2290 if (quietcxx . . $ quiet.)
2291 quietcxx . . $ quiet. = 2;
2292 for (i = 0; i < num_threadscxx . . $ num_threads.; i++) {
2293 if (statisticscxx . . $ statistics.[i]->threadstartedcxx . . $ thread_stat#threadstarted. > 0)
2294 pthread_killcxx . . $ pthread_kill(4292610292d2867f).(statisticscxx . . $ statistics.[i]->threadcxx . . $ thread_stat#thread., SIGTERMcxx . . $ `<external>/11773118241360591791/signum-generic.h:53:9`!);
2295 if (statisticscxx . . $ statistics.[i]->threadstartedcxx . . $ thread_stat#threadstarted.) {
2296 pthread_joincxx . . $ pthread_join(269902cf949f12c5).(statisticscxx . . $ statistics.[i]->threadcxx . . $ thread_stat#thread., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
2297 if (quietcxx . . $ quiet. && !histogramcxx . . $ histogram.)
2298 print_statcxx . . $ print_stat(9485320f19a6ade5).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, parameterscxx . . $ parameters.[i], i, 0, 0);
2299 }
2300 if (statisticscxx . . $ statistics.[i]->valuescxx . . $ thread_stat#values.)
2301 threadfreecxx . . $ threadfree(936bb941186e2394).(statisticscxx . . $ statistics.[i]->valuescxx . . $ thread_stat#values., VALBUF_SIZEcxx . . $ `src/cyclictest/cyclictest.c:101:9`!*sizeof(long), parameterscxx . . $ parameters.[i]->nodecxx . . $ thread_param#node.);
2302 }
2303
2304 if (triggercxx . . $ trigger.)
2305 trigger_printcxx . . $ trigger_print(d878ad36e69247c7).();
2306
2307 if (histogramcxx . . $ histogram.)
2308 print_histcxx . . $ print_hist(11f7a138fefa52c7).(parameterscxx . . $ parameters., num_threadscxx . . $ num_threads.);
2309
2310 if (tracelimitcxx . . $ tracelimit.) {
2311 print_tidscxx . . $ print_tids(11f7a138fefa52c7).(parameterscxx . . $ parameters., num_threadscxx . . $ num_threads.);
2312 if (break_thread_idcxx . . $ break_thread_id.) {
2313 printfcxx . . $ printf(581fddd72a8db8fc).("# Break thread: %d\n", break_thread_idcxx . . $ break_thread_id.);
2314 printfcxx . . $ printf(581fddd72a8db8fc).("# Break value: %llu\n", (unsigned long long)break_thread_valuecxx . . $ break_thread_value.);
2315 }
2316 }
2317
2318
2319 for (i=0; i < num_threadscxx . . $ num_threads.; i++) {
2320 if (!statisticscxx . . $ statistics.[i])
2321 continue;
2322 threadfreecxx . . $ threadfree(936bb941186e2394).(statisticscxx . . $ statistics.[i], sizeof(struct thread_statcxx . . $ thread_stat#), parameterscxx . . $ parameters.[i]->nodecxx . . $ thread_param#node.);
2323 }
2324
2325 outpar:
2326 for (i = 0; i < num_threadscxx . . $ num_threads.; i++) {
2327 if (!parameterscxx . . $ parameters.[i])
2328 continue;
2329 threadfreecxx . . $ threadfree(936bb941186e2394).(parameterscxx . . $ parameters.[i], sizeof(struct thread_paramcxx . . $ thread_param#), parameterscxx . . $ parameters.[i]->nodecxx . . $ thread_param#node.);
2330 }
2331 out:
2332 /* close any tracer file descriptors */
2333 disable_trace_markcxx . . $ disable_trace_mark(49f6e7a06ebc5aa8).();
2334
2335 /* unlock everything */
2336 if (lockallcxx . . $ lockall.)
2337 munlockallcxx . . $ munlockall(b126dc7c1de90089).();
2338
2339 /* close the latency_target_fd if it's open */
2340 if (latency_target_fdcxx . . $ latency_target_fd. >= 0)
2341 closecxx . . $ close(7864480464b09eea).(latency_target_fdcxx . . $ latency_target_fd.);
2342
2343 /* restore and free cpu idle disable states */
2344 if (deepest_idle_statecxx . . $ deepest_idle_state. >= -1) {
2345 for (i = 0; i < max_cpus; i++) {
2346 if (affinity_maskcxx . . $ affinity_mask. && !numa_bitmask_isbitsetcxx . . $ numa_bitmask_isbitset(9048e51cedd65d8e).(affinity_maskcxx . . $ affinity_mask., i))
2347 continue;
2348 restore_cpu_idle_disable_statecxx . . $ restore_cpu_idle_disable_state(4c679297bf94b9eb).(i);
2349 }
2350 }
2351 free_cpu_idle_disable_statescxx . . $ free_cpu_idle_disable_states(49f6e7a06ebc5aa8).();
2352
2353 if (affinity_maskcxx . . $ affinity_mask.)
2354 rt_bitmask_freecxx . . $ rt_bitmask_free(d7c6455decaee94d).(affinity_maskcxx . . $ affinity_mask.);
2355
2356 /* Remove running status shared memory file if it exists */
2357 if (rstat_fdcxx . . $ rstat_fd. >= 0)
2358 shm_unlinkcxx . . $ shm_unlink(5c4306d8553b3696).(shm_namecxx . . $ shm_name.);
2359
2360 hset_destroycxx . . $ hset_destroy(33dbd104c143235e).(&hsetcxx . . $ hset.);
2361 exitcxx . . $ exit(3ca292c338df9bb3).(ret);
2362 }