| 1 | // SPDX-License-Identifier: GPL-3.0-onlycxx . . $ `<file>/src/oslat/oslat.c`/ |
| 2 | /* |
| 3 | * oslat - OS latency detector |
| 4 | * |
| 5 | * Copyright 2020 Red Hat Inc. |
| 6 | * |
| 7 | * Authors: Peter Xu <[email protected]> |
| 8 | * |
| 9 | * Some of the utility code based on sysjitter-1.3: |
| 10 | * Copyright 2010-2015 David Riddoch <[email protected]> |
| 11 | */ |
| 12 | |
| 13 | #include <assert.h> |
| 14 | #include <inttypes.h> |
| 15 | #include <ctype.h> |
| 16 | #include <stdio.h> |
| 17 | #include <stdlib.h> |
| 18 | #include <stdint.h> |
| 19 | #include <stdarg.h> |
| 20 | #include <unistd.h> |
| 21 | #include <fcntl.h> |
| 22 | #include <getopt.h> |
| 23 | #include <pthread.h> |
| 24 | #include <signal.h> |
| 25 | #include <sched.h> |
| 26 | #include <string.h> |
| 27 | #include <time.h> |
| 28 | #include <errno.h> |
| 29 | #include <numa.h> |
| 30 | #include <math.h> |
| 31 | #include <limits.h> |
| 32 | #include <stdbool.h> |
| 33 | |
| 34 | #include <sys/prctl.h> |
| 35 | #include <sys/stat.h> |
| 36 | #include <sys/sysinfo.h> |
| 37 | #include <sys/types.h> |
| 38 | #include <sys/time.h> |
| 39 | #include <sys/resource.h> |
| 40 | #include <sys/utsname.h> |
| 41 | #include <sys/mman.h> |
| 42 | #include <sys/syscall.h> |
| 43 | |
| 44 | #include <linux/unistd.h> |
| 45 | |
| 46 | #include "rt-utils.h"cxx . . $ `<file>/src/include/rt-utils.h`/ |
| 47 | #include "rt-numa.h"cxx . . $ `<file>/src/include/rt-numa.h`/ |
| 48 | #include "rt-error.h"cxx . . $ `<file>/src/include/rt-error.h`/ |
| 49 | |
| 50 | #ifdef __GNUC__cxx . . $ `<built-in>:8:9`! |
| 51 | # define atomic_inccxx . . $ `src/oslat/oslat.c:51:10`!(ptr) __sync_add_and_fetch((ptr), 1) |
| 52 | # if defined(__x86_64__cxx . . $ `<built-in>:374:9`!) |
| 53 | # define relaxcxx . . $ `src/oslat/oslat.c:53:11`!() __asm__ __volatile__("pause" ::: "memory") |
| 54 | static inline void frccxx . . $ frc(386f4d2be08c489b).(uint64_tcxx . . $ uint64_t# *pval) |
| 55 | { |
| 56 | uint32_tcxx . . $ uint32_t# low, high; |
| 57 | /* See rdtsc_ordered() of Linux */ |
| 58 | __asm__ __volatile__("lfence"); |
| 59 | __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)); |
| 60 | *pval = ((uint64_tcxx . . $ uint64_t#) high << 32) | low; |
| 61 | } |
| 62 | # elif defined(__i386__) |
| 63 | # define relax() __asm__ __volatile__("pause" ::: "memory") |
| 64 | static inline void frc(uint64_t *pval) |
| 65 | { |
| 66 | __asm__ __volatile__("rdtsc" : "=A" (*pval)); |
| 67 | } |
| 68 | # elif defined(__PPC64__) |
| 69 | # define relax() do { } while (0) |
| 70 | static inline void frc(uint64_t *pval) |
| 71 | { |
| 72 | __asm__ __volatile__("mfspr %0, 268\n" : "=r" (*pval)); |
| 73 | } |
| 74 | # elif defined(__aarch64__) |
| 75 | # define relax() __asm__ __volatile("yield" : : : "memory") |
| 76 | |
| 77 | #define arch_measure_counter_mhz |
| 78 | static unsigned int measure_counter_mhz(void) |
| 79 | { |
| 80 | unsigned int val; |
| 81 | |
| 82 | __asm__ __volatile__("mrs %0, cntfrq_el0" : "=r" (val)); |
| 83 | |
| 84 | return val / 1e6; |
| 85 | } |
| 86 | |
| 87 | static inline void frc(uint64_t *pval) |
| 88 | { |
| 89 | /* |
| 90 | * This isb() is required to prevent that the counter value |
| 91 | * is speculated. |
| 92 | */ |
| 93 | __asm__ __volatile__("isb" : : : "memory"); |
| 94 | __asm__ __volatile__("mrs %0, cntvct_el0" : "=r" (*pval) :: "memory"); |
| 95 | /* |
| 96 | * This isb() is required to prevent the processor from accessing |
| 97 | * memory appearing in program order after the read of the counter |
| 98 | * before the counter has been read. Which would skew the counter value |
| 99 | * to a later point than intended. |
| 100 | */ |
| 101 | __asm__ __volatile__("isb" : : : "memory"); |
| 102 | |
| 103 | } |
| 104 | # else |
| 105 | # define relax() do { } while (0) |
| 106 | # define frc(x) |
| 107 | # define FRC_MISSING |
| 108 | # endif |
| 109 | #else |
| 110 | # error Need to add support for this compiler. |
| 111 | #endif |
| 112 | |
| 113 | typedef uint64_tcxx . . $ uint64_t# stamp_tcxx . . $ stamp_t#; /* timestamp */ |
| 114 | typedef uint64_tcxx . . $ uint64_t# cycles_tcxx . . $ cycles_t#; /* number of cycles */ |
| 115 | |
| 116 | #define truecxx . . $ `src/oslat/oslat.c:116:10`! 1 |
| 117 | #define falsecxx . . $ `src/oslat/oslat.c:117:10`! 0 |
| 118 | |
| 119 | enum commandcxx . . $ command# { |
| 120 | WAITcxx . . $ WAIT., |
| 121 | GOcxx . . $ GO., |
| 122 | STOPcxx . . $ STOP. |
| 123 | }; |
| 124 | |
| 125 | enum workload_typecxx . . $ workload_type# { |
| 126 | WORKLOAD_NONEcxx . . $ WORKLOAD_NONE. = 0, |
| 127 | WORKLOAD_MEMMOVEcxx . . $ WORKLOAD_MEMMOVE., |
| 128 | WORKLOAD_NUMcxx . . $ WORKLOAD_NUM., |
| 129 | }; |
| 130 | |
| 131 | /* This workload needs pre-allocated memory */ |
| 132 | #define WORK_NEED_MEMcxx . . $ `src/oslat/oslat.c:132:10`! (1UL << 0) |
| 133 | |
| 134 | typedef void (*workload_fncxx . . $ workload_fn#)(char *src, char *dst, size_t size); |
| 135 | |
| 136 | struct workloadcxx . . $ workload# { |
| 137 | const char *w_namecxx . . $ workload#w_name.; |
| 138 | uint64_tcxx . . $ uint64_t# w_flagscxx . . $ workload#w_flags.; |
| 139 | workload_fncxx . . $ workload_fn# w_fncxx . . $ workload#w_fn.; |
| 140 | }; |
| 141 | |
| 142 | /* We'll have buckets 1us, 2us, ..., (BUCKET_SIZE) us. */ |
| 143 | #define BUCKET_SIZEcxx . . $ `src/oslat/oslat.c:143:10`! (32) |
| 144 | |
| 145 | /* Default size of the workloads per thread (in bytes, which is 16KB) */ |
| 146 | #define WORKLOAD_MEM_SIZEcxx . . $ `src/oslat/oslat.c:146:10`! (16UL << 10) |
| 147 | |
| 148 | /* By default, no workload */ |
| 149 | #define WORKLOAD_DEFAULTcxx . . $ `src/oslat/oslat.c:149:10`! WORKLOAD_NONE |
| 150 | |
| 151 | struct threadcxx . . $ thread# { |
| 152 | int core_icxx . . $ thread#core_i.; |
| 153 | pthread_tcxx . . $ pthread_t# thread_idcxx . . $ thread#thread_id.; |
| 154 | |
| 155 | /* NOTE! this is also how many ticks per us */ |
| 156 | unsigned int counter_mhzcxx . . $ thread#counter_mhz.; |
| 157 | cycles_tcxx . . $ cycles_t# int_totalcxx . . $ thread#int_total.; |
| 158 | stamp_tcxx . . $ stamp_t# frc_startcxx . . $ thread#frc_start.; |
| 159 | stamp_tcxx . . $ stamp_t# frc_stopcxx . . $ thread#frc_stop.; |
| 160 | cycles_tcxx . . $ cycles_t# runtimecxx . . $ thread#runtime.; |
| 161 | stamp_tcxx . . $ stamp_t# *bucketscxx . . $ thread#buckets.; |
| 162 | uint64_tcxx . . $ uint64_t# minlatcxx . . $ thread#minlat.; |
| 163 | /* Maximum latency detected */ |
| 164 | uint64_tcxx . . $ uint64_t# maxlatcxx . . $ thread#maxlat.; |
| 165 | /* |
| 166 | * The extra part of the interruptions that cannot be put into even the |
| 167 | * biggest bucket. We'll use this to calculate a more accurate average at |
| 168 | * the end of the tests. |
| 169 | */ |
| 170 | uint64_tcxx . . $ uint64_t# overflow_sumcxx . . $ thread#overflow_sum.; |
| 171 | int memory_allocatedcxx . . $ thread#memory_allocated.; |
| 172 | |
| 173 | /* Buffers used for the workloads */ |
| 174 | char *src_bufcxx . . $ thread#src_buf.; |
| 175 | char *dst_bufcxx . . $ thread#dst_buf.; |
| 176 | |
| 177 | /* These variables are calculated after the test */ |
| 178 | double averagecxx . . $ thread#average.; |
| 179 | }; |
| 180 | |
| 181 | struct globalcxx . . $ global# { |
| 182 | /* Configuration. */ |
| 183 | unsigned int runtime_secscxx . . $ global#runtime_secs.; |
| 184 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! preheatcxx . . $ global#preheat.; |
| 185 | /* |
| 186 | * Number of threads running for current test |
| 187 | * (either pre heat or real run) |
| 188 | */ |
| 189 | unsigned int n_threadscxx . . $ global#n_threads.; |
| 190 | /* Number of threads to test for the real run */ |
| 191 | unsigned int n_threads_totalcxx . . $ global#n_threads_total.; |
| 192 | struct timevalcxx . . $ timeval# tv_startcxx . . $ global#tv_start.; |
| 193 | int rtpriocxx . . $ global#rtprio.; |
| 194 | int bucket_sizecxx . . $ global#bucket_size.; |
| 195 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! bucket_size_paramcxx . . $ global#bucket_size_param.; |
| 196 | int bucket_widthcxx . . $ global#bucket_width.; |
| 197 | int unit_per_uscxx . . $ global#unit_per_us.; |
| 198 | int precisioncxx . . $ global#precision.; |
| 199 | int trace_thresholdcxx . . $ global#trace_threshold.; |
| 200 | int runtimecxx . . $ global#runtime.; |
| 201 | /* The core that we run the main thread. Default is cpu0 */ |
| 202 | int cpu_main_threadcxx . . $ global#cpu_main_thread.; |
| 203 | char *cpu_listcxx . . $ global#cpu_list.; |
| 204 | char *app_namecxx . . $ global#app_name.; |
| 205 | struct workloadcxx . . $ workload# *workloadcxx . . $ global#workload.; |
| 206 | uint64_tcxx . . $ uint64_t# workload_mem_sizecxx . . $ global#workload_mem_size.; |
| 207 | int enable_biascxx . . $ global#enable_bias.; |
| 208 | uint64_tcxx . . $ uint64_t# biascxx . . $ global#bias.; |
| 209 | int quietcxx . . $ global#quiet.; |
| 210 | int single_preheat_threadcxx . . $ global#single_preheat_thread.; |
| 211 | int output_omit_zero_bucketscxx . . $ global#output_omit_zero_buckets.; |
| 212 | char jsonfilecxx . . $ global#jsonfile.[MAX_PATHcxx . . $ `src/include/rt-utils.h:9:9`!]; |
| 213 | |
| 214 | /* Mutable state. */ |
| 215 | volatile enum commandcxx . . $ command# cmdcxx . . $ global#cmd.; |
| 216 | volatile unsigned int n_threads_startedcxx . . $ global#n_threads_started.; |
| 217 | volatile unsigned int n_threads_runningcxx . . $ global#n_threads_running.; |
| 218 | volatile unsigned int n_threads_finishedcxx . . $ global#n_threads_finished.; |
| 219 | }; |
| 220 | |
| 221 | static struct globalcxx . . $ global# gcxx . . $ g.; |
| 222 | |
| 223 | static void workload_nopcxx . . $ workload_nop(dc09b413e6ab05e).(char *dst, char *src, size_t size) |
| 224 | { |
| 225 | /* Nop */ |
| 226 | } |
| 227 | |
| 228 | static void workload_memmovecxx . . $ workload_memmove(dc09b413e6ab05e).(char *dst, char *src, size_t size) |
| 229 | { |
| 230 | memmovecxx . . $ memmove(cc817cb175f282d).(dst, src, size); |
| 231 | } |
| 232 | |
| 233 | struct workloadcxx . . $ workload# workload_listcxx . . $ workload_list.[WORKLOAD_NUMcxx . . $ WORKLOAD_NUM.] = { |
| 234 | { "no", 0, workload_nopcxx . . $ workload_nop(dc09b413e6ab05e). }, |
| 235 | { "memmove", WORK_NEED_MEMcxx . . $ `src/oslat/oslat.c:132:10`!, workload_memmovecxx . . $ workload_memmove(dc09b413e6ab05e). }, |
| 236 | }; |
| 237 | |
| 238 | #define TESTcxx . . $ `src/oslat/oslat.c:238:9`!(x) \ |
| 239 | do { \ |
| 240 | if (!(x)) \ |
| 241 | test_fail(#x, __LINE__); \ |
| 242 | } while (0) |
| 243 | |
| 244 | #define TEST0cxx . . $ `src/oslat/oslat.c:244:9`!(x) TESTcxx . . $ `src/oslat/oslat.c:238:9`!((x) == 0) |
| 245 | |
| 246 | static void test_failcxx . . $ test_fail(34d26762b42c433a).(const char *what, int line) |
| 247 | { |
| 248 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR:\n"); |
| 249 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR: TEST(%s)\n", what); |
| 250 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR: at line %d\n", line); |
| 251 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR: errno=%d (%s)\n", errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 252 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR:\n"); |
| 253 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 254 | } |
| 255 | |
| 256 | static int move_to_corecxx . . $ move_to_core(7864480464b09eea).(int core_i) |
| 257 | { |
| 258 | cpu_set_tcxx . . $ cpu_set_t# cpus; |
| 259 | |
| 260 | CPU_ZEROcxx . . $ `<external>/17522079545615609418/sched.h:96:10`!(&cpus); |
| 261 | CPU_SETcxx . . $ `<external>/17522079545615609418/sched.h:92:10`!(core_i, &cpus); |
| 262 | return sched_setaffinitycxx . . $ sched_setaffinity(48631566441f33fb).(0, sizeof(cpus), &cpus); |
| 263 | } |
| 264 | |
| 265 | #ifndef arch_measure_counter_mhz |
| 266 | static cycles_tcxx . . $ cycles_t# __measure_counter_hzcxx . . $ __measure_counter_hz(f708dce9a8856c70).(void) |
| 267 | { |
| 268 | struct timevalcxx . . $ timeval# tvs, tve; |
| 269 | stamp_tcxx . . $ stamp_t# s, e; |
| 270 | double sec; |
| 271 | |
| 272 | frccxx . . $ frc(386f4d2be08c489b).(&s); |
| 273 | e = s; |
| 274 | gettimeofdaycxx . . $ gettimeofday(ee8865a94200b3d6).(&tvs, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 275 | while (e - s < 1000000) |
| 276 | frccxx . . $ frc(386f4d2be08c489b).(&e); |
| 277 | gettimeofdaycxx . . $ gettimeofday(ee8865a94200b3d6).(&tve, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 278 | sec = tve.tv_seccxx . . $ timeval#tv_sec. - tvs.tv_seccxx . . $ timeval#tv_sec. + (tve.tv_useccxx . . $ timeval#tv_usec. - tvs.tv_useccxx . . $ timeval#tv_usec.) / 1e6; |
| 279 | return (cycles_tcxx . . $ cycles_t#) ((e - s) / sec); |
| 280 | } |
| 281 | |
| 282 | static unsigned int measure_counter_mhzcxx . . $ measure_counter_mhz(db52760e79bf9054).(void) |
| 283 | { |
| 284 | cycles_tcxx . . $ cycles_t# m, mprev, d; |
| 285 | |
| 286 | mprev = __measure_counter_hzcxx . . $ __measure_counter_hz(f708dce9a8856c70).(); |
| 287 | do { |
| 288 | m = __measure_counter_hzcxx . . $ __measure_counter_hz(f708dce9a8856c70).(); |
| 289 | if (m > mprev) |
| 290 | d = m - mprev; |
| 291 | else |
| 292 | d = mprev - m; |
| 293 | mprev = m; |
| 294 | } while (d > m / 1000); |
| 295 | |
| 296 | return (unsigned int) (m / 1000000); |
| 297 | } |
| 298 | #endif |
| 299 | |
| 300 | static void thread_initcxx . . $ thread_init(9e796537fa7612a7).(struct threadcxx . . $ thread# *t) |
| 301 | { |
| 302 | t->counter_mhzcxx . . $ thread#counter_mhz. = measure_counter_mhzcxx . . $ measure_counter_mhz(db52760e79bf9054).(); |
| 303 | t->maxlatcxx . . $ thread#maxlat. = 0; |
| 304 | t->overflow_sumcxx . . $ thread#overflow_sum. = 0; |
| 305 | t->minlatcxx . . $ thread#minlat. = (uint64_tcxx . . $ uint64_t#)-1; |
| 306 | |
| 307 | /* NOTE: all the buffers are not freed until the process quits. */ |
| 308 | if (!t->memory_allocatedcxx . . $ thread#memory_allocated.) { |
| 309 | TESTcxx . . $ `src/oslat/oslat.c:238:9`!(t->buckets = calloc(1, sizeof(t->buckets[0]) * g.bucket_size)); |
| 310 | if (gcxx . . $ g..workloadcxx . . $ global#workload.->w_flagscxx . . $ workload#w_flags. & WORK_NEED_MEMcxx . . $ `src/oslat/oslat.c:132:10`!) { |
| 311 | TEST0cxx . . $ `src/oslat/oslat.c:244:9`!(posix_memalign((void **)&t->src_buf, getpagesize(), |
| 312 | g.workload_mem_size)); |
| 313 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(t->src_bufcxx . . $ thread#src_buf., 0, gcxx . . $ g..workload_mem_sizecxx . . $ global#workload_mem_size.); |
| 314 | TEST0cxx . . $ `src/oslat/oslat.c:244:9`!(posix_memalign((void **)&t->dst_buf, getpagesize(), |
| 315 | g.workload_mem_size)); |
| 316 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(t->dst_bufcxx . . $ thread#dst_buf., 0, gcxx . . $ g..workload_mem_sizecxx . . $ global#workload_mem_size.); |
| 317 | } |
| 318 | t->memory_allocatedcxx . . $ thread#memory_allocated. = 1; |
| 319 | } else { |
| 320 | /* Clear the buckets */ |
| 321 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(t->bucketscxx . . $ thread#buckets., 0, sizeof(t->bucketscxx . . $ thread#buckets.[0]) * gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size.); |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | static float cycles_to_seccxx . . $ cycles_to_sec(deb63856550461aa).(const struct threadcxx . . $ thread# *t, uint64_tcxx . . $ uint64_t# cycles) |
| 326 | { |
| 327 | return cycles / (t->counter_mhzcxx . . $ thread#counter_mhz. * 1e6); |
| 328 | } |
| 329 | |
| 330 | static void insert_bucketcxx . . $ insert_bucket(e7068df1e3592819).(struct threadcxx . . $ thread# *t, stamp_tcxx . . $ stamp_t# value) |
| 331 | { |
| 332 | int index; |
| 333 | unsigned int lat; |
| 334 | uint64_tcxx . . $ uint64_t# extra; |
| 335 | double us; |
| 336 | |
| 337 | lat = (value * gcxx . . $ g..unit_per_uscxx . . $ global#unit_per_us.) / t->counter_mhzcxx . . $ thread#counter_mhz.; |
| 338 | us = (double)lat / gcxx . . $ g..unit_per_uscxx . . $ global#unit_per_us.; |
| 339 | if (!gcxx . . $ g..preheatcxx . . $ global#preheat. && gcxx . . $ g..trace_thresholdcxx . . $ global#trace_threshold. && us >= gcxx . . $ g..trace_thresholdcxx . . $ global#trace_threshold.) { |
| 340 | char *line = "%s: Trace threshold (%d us) triggered on cpu %d with %.*f us!\n"; |
| 341 | tracemarkcxx . . $ tracemark(d5d9ff45db7b5d36).(line, gcxx . . $ g..app_namecxx . . $ global#app_name., gcxx . . $ g..trace_thresholdcxx . . $ global#trace_threshold., t->core_icxx . . $ thread#core_i., |
| 342 | gcxx . . $ g..precisioncxx . . $ global#precision., us); |
| 343 | tracing_stopcxx . . $ tracing_stop(49f6e7a06ebc5aa8).(); |
| 344 | err_quitcxx . . $ err_quit(5313ecf19fd40d4d).(line, gcxx . . $ g..app_namecxx . . $ global#app_name., gcxx . . $ g..trace_thresholdcxx . . $ global#trace_threshold., t->core_icxx . . $ thread#core_i., |
| 345 | gcxx . . $ g..precisioncxx . . $ global#precision., us); |
| 346 | } |
| 347 | |
| 348 | /* Update max latency */ |
| 349 | if (lat > t->maxlatcxx . . $ thread#maxlat.) |
| 350 | t->maxlatcxx . . $ thread#maxlat. = lat; |
| 351 | |
| 352 | if (lat < t->minlatcxx . . $ thread#minlat.) |
| 353 | t->minlatcxx . . $ thread#minlat. = lat; |
| 354 | |
| 355 | if (gcxx . . $ g..biascxx . . $ global#bias.) { |
| 356 | /* t->bias will be set after pre-heat if user enabled it */ |
| 357 | lat -= gcxx . . $ g..biascxx . . $ global#bias.; |
| 358 | /* |
| 359 | * Negative should hardly happen, but if it happens, we assume we're in |
| 360 | * the smallest bucket. |
| 361 | */ |
| 362 | if (lat <= 0) |
| 363 | lat = 1; |
| 364 | } |
| 365 | |
| 366 | index = lat / gcxx . . $ g..bucket_widthcxx . . $ global#bucket_width.; |
| 367 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(index >= 0); |
| 368 | |
| 369 | /* Too big the jitter; put into the last bucket */ |
| 370 | if (index >= gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size.) { |
| 371 | /* Keep the extra bit (in bucket width multiples) */ |
| 372 | extra = index - gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size.; |
| 373 | if (t->overflow_sumcxx . . $ thread#overflow_sum. + extra < t->overflow_sumcxx . . $ thread#overflow_sum.) { |
| 374 | /* The uint64_t even overflowed itself; bail out */ |
| 375 | printfcxx . . $ printf(581fddd72a8db8fc).("Accumulated overflow too much!\n"); |
| 376 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 377 | } |
| 378 | t->overflow_sumcxx . . $ thread#overflow_sum. += extra; |
| 379 | index = gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size. - 1; |
| 380 | } |
| 381 | |
| 382 | t->bucketscxx . . $ thread#buckets.[index]++; |
| 383 | if (t->bucketscxx . . $ thread#buckets.[index] == 0) { |
| 384 | printfcxx . . $ printf(581fddd72a8db8fc).("Bucket %d overflowed\n", index); |
| 385 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | static void doitcxx . . $ doit(9e796537fa7612a7).(struct threadcxx . . $ thread# *t) |
| 390 | { |
| 391 | stamp_tcxx . . $ stamp_t# ts1, ts2; |
| 392 | workload_fncxx . . $ workload_fn# workload_fn = gcxx . . $ g..workloadcxx . . $ global#workload.->w_fncxx . . $ workload#w_fn.; |
| 393 | |
| 394 | frccxx . . $ frc(386f4d2be08c489b).(&ts2); |
| 395 | do { |
| 396 | workload_fn(t->dst_bufcxx . . $ thread#dst_buf., t->src_bufcxx . . $ thread#src_buf., gcxx . . $ g..workload_mem_sizecxx . . $ global#workload_mem_size.); |
| 397 | frccxx . . $ frc(386f4d2be08c489b).(&ts1); |
| 398 | insert_bucketcxx . . $ insert_bucket(e7068df1e3592819).(t, ts1 - ts2); |
| 399 | ts2 = ts1; |
| 400 | } while (gcxx . . $ g..cmdcxx . . $ global#cmd. == GOcxx . . $ GO.); |
| 401 | } |
| 402 | |
| 403 | static int set_fifo_priocxx . . $ set_fifo_prio(7864480464b09eea).(int prio) |
| 404 | { |
| 405 | struct sched_paramcxx . . $ sched_param# param; |
| 406 | |
| 407 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(¶m, 0, sizeof(param)); |
| 408 | param.sched_prioritycxx . . $ `<external>/17522079545615609418/sched.h:47:9`! = prio; |
| 409 | return sched_setschedulercxx . . $ sched_setscheduler(b99e0841b006542f).(0, SCHED_FIFOcxx . . $ `<external>/4872883757279652994/sched.h:29:9`!, ¶m); |
| 410 | } |
| 411 | |
| 412 | static void *thread_maincxx . . $ thread_main(9f162e79bfc6c74).(void *arg) |
| 413 | { |
| 414 | /* Important thing to note here is that once we start bashing the CPU, we |
| 415 | * need to keep doing so to prevent the core from changing frequency or |
| 416 | * dropping into a low power state. |
| 417 | */ |
| 418 | struct threadcxx . . $ thread# *t = arg; |
| 419 | |
| 420 | /* Alloc memory in the thread itself after setting affinity to get the |
| 421 | * best chance of getting numa-local memory. Doesn't matter so much for |
| 422 | * the "struct thread" since we expect that to stay cache resident. |
| 423 | */ |
| 424 | TESTcxx . . $ `src/oslat/oslat.c:238:9`!(move_to_core(t->core_i) == 0); |
| 425 | if (gcxx . . $ g..rtpriocxx . . $ global#rtprio.) |
| 426 | TESTcxx . . $ `src/oslat/oslat.c:238:9`!(set_fifo_prio(g.rtprio) == 0); |
| 427 | |
| 428 | /* Don't bash the cpu until all threads have got going. */ |
| 429 | atomic_inccxx . . $ `src/oslat/oslat.c:51:10`!(&g.n_threads_started); |
| 430 | while (gcxx . . $ g..cmdcxx . . $ global#cmd. == WAITcxx . . $ WAIT.) |
| 431 | usleepcxx . . $ usleep(4c679297bf94b9eb).(1000); |
| 432 | |
| 433 | thread_initcxx . . $ thread_init(9e796537fa7612a7).(t); |
| 434 | |
| 435 | /* Ensure we all start at the same time. */ |
| 436 | atomic_inccxx . . $ `src/oslat/oslat.c:51:10`!(&g.n_threads_running); |
| 437 | while (gcxx . . $ g..n_threads_runningcxx . . $ global#n_threads_running. != gcxx . . $ g..n_threadscxx . . $ global#n_threads.) |
| 438 | relaxcxx . . $ `src/oslat/oslat.c:53:11`!(); |
| 439 | |
| 440 | frccxx . . $ frc(386f4d2be08c489b).(&t->frc_startcxx . . $ thread#frc_start.); |
| 441 | doitcxx . . $ doit(9e796537fa7612a7).(t); |
| 442 | frccxx . . $ frc(386f4d2be08c489b).(&t->frc_stopcxx . . $ thread#frc_stop.); |
| 443 | |
| 444 | t->runtimecxx . . $ thread#runtime. = t->frc_stopcxx . . $ thread#frc_stop. - t->frc_startcxx . . $ thread#frc_start.; |
| 445 | |
| 446 | /* Wait for everyone to finish so we don't disturb them by exiting and |
| 447 | * waking the main thread. |
| 448 | */ |
| 449 | atomic_inccxx . . $ `src/oslat/oslat.c:51:10`!(&g.n_threads_finished); |
| 450 | while (gcxx . . $ g..n_threads_finishedcxx . . $ global#n_threads_finished. != gcxx . . $ g..n_threadscxx . . $ global#n_threads.) |
| 451 | relaxcxx . . $ `src/oslat/oslat.c:53:11`!(); |
| 452 | |
| 453 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 454 | } |
| 455 | |
| 456 | #define putfieldcxx . . $ `src/oslat/oslat.c:456:9`!(label, val, fmt, end) do { \ |
| 457 | printf("%12s:\t", label); \ |
| 458 | for (i = 0; i < g.n_threads; ++i) \ |
| 459 | printf(" %"fmt, val); \ |
| 460 | printf("%s\n", end); \ |
| 461 | } while (0) |
| 462 | |
| 463 | #define putfieldpcxx . . $ `src/oslat/oslat.c:463:9`!(label, val, end) do { \ |
| 464 | printf("%12s:\t", label); \ |
| 465 | for (i = 0; i < g.n_threads; ++i) \ |
| 466 | printf(" %.*f", g.precision, \ |
| 467 | (double)(val) / g.unit_per_us); \ |
| 468 | printf("%s\n", end); \ |
| 469 | } while (0) |
| 470 | |
| 471 | static double bucket_to_latcxx . . $ bucket_to_lat(4badf5dbac1308a7).(int bucket) |
| 472 | { |
| 473 | return (gcxx . . $ g..biascxx . . $ global#bias. + (bucket + 1) * (double)gcxx . . $ g..bucket_widthcxx . . $ global#bucket_width.) / gcxx . . $ g..unit_per_uscxx . . $ global#unit_per_us.; |
| 474 | } |
| 475 | |
| 476 | void calculatecxx . . $ calculate(9e796537fa7612a7).(struct threadcxx . . $ thread# *t) |
| 477 | { |
| 478 | int j; |
| 479 | unsigned int i; |
| 480 | double sum; |
| 481 | uint64_tcxx . . $ uint64_t# count; |
| 482 | |
| 483 | for (i = 0; i < gcxx . . $ g..n_threadscxx . . $ global#n_threads.; ++i) { |
| 484 | /* Calculate average */ |
| 485 | sum = count = 0; |
| 486 | for (j = 0; j < gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size.; j++) { |
| 487 | sum += t[i].bucketscxx . . $ thread#buckets.[j] * bucket_to_latcxx . . $ bucket_to_lat(4badf5dbac1308a7).(j); |
| 488 | count += t[i].bucketscxx . . $ thread#buckets.[j]; |
| 489 | } |
| 490 | /* Add the extra amount of huge spikes in */ |
| 491 | sum += t->overflow_sumcxx . . $ thread#overflow_sum. * gcxx . . $ g..bucket_widthcxx . . $ global#bucket_width.; |
| 492 | t[i].averagecxx . . $ thread#average. = sum / count; |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | static void write_summarycxx . . $ write_summary(9e796537fa7612a7).(struct threadcxx . . $ thread# *t) |
| 497 | { |
| 498 | int j, print_dotdotdot = 0; |
| 499 | unsigned long int i, k; |
| 500 | char bucket_name[64]; |
| 501 | |
| 502 | calculatecxx . . $ calculate(9e796537fa7612a7).(t); |
| 503 | |
| 504 | putfieldcxx . . $ `src/oslat/oslat.c:456:9`!("Core", t[i].core_i, "d", ""); |
| 505 | putfieldcxx . . $ `src/oslat/oslat.c:456:9`!("Counter Freq", t[i].counter_mhz, "u", " (MHz)"); |
| 506 | |
| 507 | for (j = 0; j < gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size.; j++) { |
| 508 | if (j < gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size.-1 && gcxx . . $ g..output_omit_zero_bucketscxx . . $ global#output_omit_zero_buckets.) { |
| 509 | for (k = 0; k < gcxx . . $ g..n_threadscxx . . $ global#n_threads.; k++) { |
| 510 | if (t[k].bucketscxx . . $ thread#buckets.[j] != 0) |
| 511 | break; |
| 512 | } |
| 513 | if (k == gcxx . . $ g..n_threadscxx . . $ global#n_threads.) { |
| 514 | print_dotdotdot = 1; |
| 515 | continue; |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | if (print_dotdotdot) { |
| 520 | printfcxx . . $ printf(581fddd72a8db8fc).(" ...\n"); |
| 521 | print_dotdotdot = 0; |
| 522 | } |
| 523 | |
| 524 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(bucket_name, sizeof(bucket_name), "%03.*f (us)", |
| 525 | gcxx . . $ g..precisioncxx . . $ global#precision., bucket_to_latcxx . . $ bucket_to_lat(4badf5dbac1308a7).(j)); |
| 526 | putfieldcxx . . $ `src/oslat/oslat.c:456:9`!(bucket_name, t[i].buckets[j], PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`!, |
| 527 | (j == g.bucket_size - 1) ? " (including overflows)" : ""); |
| 528 | } |
| 529 | |
| 530 | putfieldpcxx . . $ `src/oslat/oslat.c:463:9`!("Minimum", t[i].minlat, " (us)"); |
| 531 | putfieldcxx . . $ `src/oslat/oslat.c:456:9`!("Average", t[i].average, ".3lf", " (us)"); |
| 532 | putfieldpcxx . . $ `src/oslat/oslat.c:463:9`!("Maximum", t[i].maxlat, " (us)"); |
| 533 | putfieldpcxx . . $ `src/oslat/oslat.c:463:9`!("Max-Min", t[i].maxlat - t[i].minlat, " (us)"); |
| 534 | putfieldcxx . . $ `src/oslat/oslat.c:456:9`!("Duration", cycles_to_sec(&(t[i]), t[i].runtime), |
| 535 | ".3f", " (sec)"); |
| 536 | printfcxx . . $ printf(581fddd72a8db8fc).("\n"); |
| 537 | } |
| 538 | |
| 539 | static void write_summary_jsoncxx . . $ write_summary_json(2fd218767557b4b8).(FILEcxx . . $ FILE# *f, void *data) |
| 540 | { |
| 541 | struct threadcxx . . $ thread# *t = data; |
| 542 | int j, comma; |
| 543 | unsigned long int i; |
| 544 | |
| 545 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"num_threads\": %d,\n", gcxx . . $ g..n_threadscxx . . $ global#n_threads.); |
| 546 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"thread\": {\n"); |
| 547 | for (i = 0; i < gcxx . . $ g..n_threadscxx . . $ global#n_threads.; ++i) { |
| 548 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"%lu\": {\n", i); |
| 549 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"cpu\": %d,\n", t[i].core_icxx . . $ thread#core_i.); |
| 550 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"freq\": %d,\n", t[i].counter_mhzcxx . . $ thread#counter_mhz.); |
| 551 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"min\": %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! ",\n", t[i].minlatcxx . . $ thread#minlat.); |
| 552 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"avg\": %3lf,\n", t[i].averagecxx . . $ thread#average.); |
| 553 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"max\": %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`! ",\n", t[i].maxlatcxx . . $ thread#maxlat.); |
| 554 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"duration\": %.3f,\n", |
| 555 | cycles_to_seccxx . . $ cycles_to_sec(deb63856550461aa).(&(t[i]), t[i].runtimecxx . . $ thread#runtime.)); |
| 556 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"histogram\": {"); |
| 557 | for (j = 0, comma = 0; j < gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size.; j++) { |
| 558 | if (t[i].bucketscxx . . $ thread#buckets.[j] == 0) |
| 559 | continue; |
| 560 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, "%s", comma ? ",\n" : "\n"); |
| 561 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " \"%.*f\": %" PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`!, |
| 562 | gcxx . . $ g..precisioncxx . . $ global#precision., bucket_to_latcxx . . $ bucket_to_lat(4badf5dbac1308a7).(j), t[i].bucketscxx . . $ thread#buckets.[j]); |
| 563 | comma = 1; |
| 564 | } |
| 565 | if (comma) |
| 566 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, "\n"); |
| 567 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " }\n"); |
| 568 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " }%s\n", i == gcxx . . $ g..n_threadscxx . . $ global#n_threads. - 1 ? "" : ","); |
| 569 | } |
| 570 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(f, " }\n"); |
| 571 | } |
| 572 | |
| 573 | static void run_exptcxx . . $ run_expt(5d6f42bf0aec3f27).(struct threadcxx . . $ thread# *threads, int runtime_secs, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! preheat) |
| 574 | { |
| 575 | unsigned long int i; |
| 576 | |
| 577 | gcxx . . $ g..runtime_secscxx . . $ global#runtime_secs. = runtime_secs; |
| 578 | gcxx . . $ g..preheatcxx . . $ global#preheat. = preheat; |
| 579 | gcxx . . $ g..n_threads_startedcxx . . $ global#n_threads_started. = 0; |
| 580 | gcxx . . $ g..n_threads_runningcxx . . $ global#n_threads_running. = 0; |
| 581 | gcxx . . $ g..n_threads_finishedcxx . . $ global#n_threads_finished. = 0; |
| 582 | gcxx . . $ g..cmdcxx . . $ global#cmd. = WAITcxx . . $ WAIT.; |
| 583 | |
| 584 | for (i = 0; i < gcxx . . $ g..n_threadscxx . . $ global#n_threads.; ++i) |
| 585 | TEST0cxx . . $ `src/oslat/oslat.c:244:9`!(pthread_create(&(threads[i].thread_id), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 586 | thread_main, &(threads[i]))); |
| 587 | while (gcxx . . $ g..n_threads_startedcxx . . $ global#n_threads_started. != gcxx . . $ g..n_threadscxx . . $ global#n_threads.) |
| 588 | usleepcxx . . $ usleep(4c679297bf94b9eb).(1000); |
| 589 | |
| 590 | gettimeofdaycxx . . $ gettimeofday(ee8865a94200b3d6).(&gcxx . . $ g..tv_startcxx . . $ global#tv_start., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 591 | gcxx . . $ g..cmdcxx . . $ global#cmd. = GOcxx . . $ GO.; |
| 592 | |
| 593 | alarmcxx . . $ alarm(2141b656ce2cc063).(runtime_secs); |
| 594 | |
| 595 | /* Go to sleep until the threads have done their stuff. */ |
| 596 | for (i = 0; i < gcxx . . $ g..n_threadscxx . . $ global#n_threads.; ++i) |
| 597 | pthread_joincxx . . $ pthread_join(269902cf949f12c5).(threads[i].thread_idcxx . . $ thread#thread_id., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 598 | } |
| 599 | |
| 600 | static void handle_alarmcxx . . $ handle_alarm(d4f767463ce0a6b3).(int code) |
| 601 | { |
| 602 | gcxx . . $ g..cmdcxx . . $ global#cmd. = STOPcxx . . $ STOP.; |
| 603 | } |
| 604 | |
| 605 | static void usagecxx . . $ usage(d4f767463ce0a6b3).(int error) |
| 606 | { |
| 607 | printfcxx . . $ printf(581fddd72a8db8fc).("Usage:\n" |
| 608 | "oslat <options>\n\n" |
| 609 | "This is an OS latency detector by running busy loops on specified cores.\n" |
| 610 | "Please run this tool using root.\n\n" |
| 611 | "Available options:\n\n" |
| 612 | "-b, --bucket-size Specify the number of the buckets (4-1024)\n" |
| 613 | "-B, --bias Add a bias to all the buckets using the estimated mininum\n" |
| 614 | "-c, --cpu-list Specify CPUs to run on, e.g. '1,3,5,7-15'\n" |
| 615 | "-C, --cpu-main-thread Specify which CPU the main thread runs on. Default is cpu0.\n" |
| 616 | "-D, --duration Specify test duration, e.g., 60, 20m, 2H\n" |
| 617 | " (m/M: minutes, h/H: hours, d/D: days)\n" |
| 618 | " --json=FILENAME write final results into FILENAME, JSON formatted\n" |
| 619 | "-f, --rtprio Using SCHED_FIFO priority (1-99)\n" |
| 620 | "-m, --workload-mem Size of the memory to use for the workload (e.g., 4K, 1M).\n" |
| 621 | " Total memory usage will be this value multiplies 2*N,\n" |
| 622 | " because there will be src/dst buffers for each thread, and\n" |
| 623 | " N is the number of processors for testing.\n" |
| 624 | "-q --quiet print a summary only on exit\n" |
| 625 | "-s, --single-preheat Use a single thread when measuring latency at preheat stage\n" |
| 626 | " NOTE: please make sure the CPU frequency on all testing cores\n" |
| 627 | " are locked before using this parmater. If you don't know how\n" |
| 628 | " to lock the freq then please don't use this parameter.\n" |
| 629 | "-T, --trace-threshold Stop the test when threshold triggered (in us),\n" |
| 630 | " print a marker in ftrace and stop ftrace too.\n" |
| 631 | "-v, --version Display the version of the software.\n" |
| 632 | "-w, --workload Specify a kind of workload, default is no workload\n" |
| 633 | " (options: no, memmove)\n" |
| 634 | "-W, --bucket-width Interval between buckets in nanoseconds\n" |
| 635 | " NOTE: Widths not a multiple of 1000 cause ns-precision output\n" |
| 636 | " You are responsible for considering the impact of measurement\n" |
| 637 | " overhead at the nanosecond scale.\n" |
| 638 | "-z, --zero-omit Don't display buckets in the output histogram if all zeros.\n" |
| 639 | ); |
| 640 | exitcxx . . $ exit(3ca292c338df9bb3).(error); |
| 641 | } |
| 642 | |
| 643 | static int workload_selectcxx . . $ workload_select(1ef8e6ec083aabb9).(char *name) |
| 644 | { |
| 645 | int i = 0; |
| 646 | |
| 647 | for (i = 0; i < WORKLOAD_NUMcxx . . $ WORKLOAD_NUM.; i++) { |
| 648 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(name, workload_listcxx . . $ workload_list.[i].w_namecxx . . $ workload#w_name.)) { |
| 649 | gcxx . . $ g..workloadcxx . . $ global#workload. = &workload_listcxx . . $ workload_list.[i]; |
| 650 | return 0; |
| 651 | } |
| 652 | } |
| 653 | |
| 654 | return -1; |
| 655 | } |
| 656 | |
| 657 | enum option_valuecxx . . $ option_value# { |
| 658 | OPT_BUCKETSIZEcxx . . $ OPT_BUCKETSIZE. = 1, OPT_BUCKETWIDTHcxx . . $ OPT_BUCKETWIDTH., OPT_CPU_LISTcxx . . $ OPT_CPU_LIST., OPT_CPU_MAIN_THREADcxx . . $ OPT_CPU_MAIN_THREAD., |
| 659 | OPT_DURATIONcxx . . $ OPT_DURATION., OPT_JSONcxx . . $ OPT_JSON., OPT_RT_PRIOcxx . . $ OPT_RT_PRIO., OPT_HELPcxx . . $ OPT_HELP., OPT_TRACE_THcxx . . $ OPT_TRACE_TH., |
| 660 | OPT_WORKLOADcxx . . $ OPT_WORKLOAD., OPT_WORKLOAD_MEMcxx . . $ OPT_WORKLOAD_MEM., OPT_BIAScxx . . $ OPT_BIAS., |
| 661 | OPT_QUIETcxx . . $ OPT_QUIET., OPT_SINGLE_PREHEATcxx . . $ OPT_SINGLE_PREHEAT., OPT_ZERO_OMITcxx . . $ OPT_ZERO_OMIT., |
| 662 | OPT_VERSIONcxx . . $ OPT_VERSION. |
| 663 | }; |
| 664 | |
| 665 | /* Process commandline options */ |
| 666 | static void parse_optionscxx . . $ parse_options(c759356ac01a31e7).(int argc, char *argv[]) |
| 667 | { |
| 668 | while (1) { |
| 669 | int option_index = 0; |
| 670 | static struct optioncxx . . $ option# options[] = { |
| 671 | { "bucket-size", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_BUCKETSIZEcxx . . $ OPT_BUCKETSIZE. }, |
| 672 | { "bucket-width", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_BUCKETWIDTHcxx . . $ OPT_BUCKETWIDTH. }, |
| 673 | { "cpu-list", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_CPU_LISTcxx . . $ OPT_CPU_LIST. }, |
| 674 | { "cpu-main-thread", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_CPU_MAIN_THREADcxx . . $ OPT_CPU_MAIN_THREAD.}, |
| 675 | { "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. }, |
| 676 | { "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. }, |
| 677 | { "rtprio", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_RT_PRIOcxx . . $ OPT_RT_PRIO. }, |
| 678 | { "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. }, |
| 679 | { "trace-threshold", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_TRACE_THcxx . . $ OPT_TRACE_TH. }, |
| 680 | { "workload", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_WORKLOADcxx . . $ OPT_WORKLOAD. }, |
| 681 | { "workload-mem", required_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:63:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_WORKLOAD_MEMcxx . . $ OPT_WORKLOAD_MEM. }, |
| 682 | { "bias", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_BIAScxx . . $ OPT_BIAS. }, |
| 683 | { "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. }, |
| 684 | { "single-preheat", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_SINGLE_PREHEATcxx . . $ OPT_SINGLE_PREHEAT. }, |
| 685 | { "zero-omit", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_ZERO_OMITcxx . . $ OPT_ZERO_OMIT. }, |
| 686 | { "version", no_argumentcxx . . $ `<external>/1746263805473775960/getopt_ext.h:62:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OPT_VERSIONcxx . . $ OPT_VERSION. }, |
| 687 | { 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 }, |
| 688 | }; |
| 689 | int i, c = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "b:Bc:C:D:f:hm:qsw:W:T:vz", |
| 690 | options, &option_index); |
| 691 | long ncores; |
| 692 | |
| 693 | if (c == -1) |
| 694 | break; |
| 695 | |
| 696 | switch (c) { |
| 697 | case OPT_BUCKETSIZEcxx . . $ OPT_BUCKETSIZE.: |
| 698 | case 'b': |
| 699 | gcxx . . $ g..bucket_size_paramcxx . . $ global#bucket_size_param. = truecxx . . $ `src/oslat/oslat.c:116:10`!; |
| 700 | gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size. = strtolcxx . . $ strtol(44bbb87609b212fc).(optargcxx . . $ optarg., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 10); |
| 701 | if (gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size. > 1024 || gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size. <= 4) { |
| 702 | printfcxx . . $ printf(581fddd72a8db8fc).("Illegal bucket size: %s (should be: 4-1024)\n", |
| 703 | optargcxx . . $ optarg.); |
| 704 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 705 | } |
| 706 | break; |
| 707 | case OPT_BUCKETWIDTHcxx . . $ OPT_BUCKETWIDTH.: |
| 708 | case 'W': |
| 709 | gcxx . . $ g..bucket_widthcxx . . $ global#bucket_width. = strtolcxx . . $ strtol(44bbb87609b212fc).(optargcxx . . $ optarg., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 10); |
| 710 | if (gcxx . . $ g..bucket_widthcxx . . $ global#bucket_width. <= 0) { |
| 711 | printfcxx . . $ printf(581fddd72a8db8fc).("Illegal bucket width: %s\n", optargcxx . . $ optarg.); |
| 712 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 713 | } |
| 714 | if (gcxx . . $ g..bucket_widthcxx . . $ global#bucket_width. % 1000) { |
| 715 | gcxx . . $ g..unit_per_uscxx . . $ global#unit_per_us. = 1000; |
| 716 | gcxx . . $ g..precisioncxx . . $ global#precision. = 3; |
| 717 | } else { |
| 718 | gcxx . . $ g..bucket_widthcxx . . $ global#bucket_width. /= 1000; |
| 719 | } |
| 720 | break; |
| 721 | case OPT_BIAScxx . . $ OPT_BIAS.: |
| 722 | case 'B': |
| 723 | gcxx . . $ g..enable_biascxx . . $ global#enable_bias. = 1; |
| 724 | break; |
| 725 | case OPT_CPU_LISTcxx . . $ OPT_CPU_LIST.: |
| 726 | case 'c': |
| 727 | gcxx . . $ g..cpu_listcxx . . $ global#cpu_list. = strdupcxx . . $ strdup(a8b8e32347182212).(optargcxx . . $ optarg.); |
| 728 | break; |
| 729 | case OPT_CPU_MAIN_THREADcxx . . $ OPT_CPU_MAIN_THREAD.: |
| 730 | case 'C': |
| 731 | ncores = sysconfcxx . . $ sysconf(dc1f09c09fbff20f).(_SC_NPROCESSORS_CONFcxx . . $ `<external>/6393649343499073842/confname.h:251:9`!); |
| 732 | gcxx . . $ g..cpu_main_threadcxx . . $ global#cpu_main_thread. = strtolcxx . . $ strtol(44bbb87609b212fc).(optargcxx . . $ optarg., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 10); |
| 733 | if (gcxx . . $ g..cpu_main_threadcxx . . $ global#cpu_main_thread. < 0 || gcxx . . $ g..cpu_main_threadcxx . . $ global#cpu_main_thread. > ncores) { |
| 734 | printfcxx . . $ printf(581fddd72a8db8fc).("Illegal core for main thread: %s (should be: 0-%ld)\n", |
| 735 | optargcxx . . $ optarg., ncores); |
| 736 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 737 | } |
| 738 | break; |
| 739 | case OPT_DURATIONcxx . . $ OPT_DURATION.: |
| 740 | case 'D': |
| 741 | gcxx . . $ g..runtimecxx . . $ global#runtime. = parse_time_stringcxx . . $ parse_time_string(1ef8e6ec083aabb9).(optargcxx . . $ optarg.); |
| 742 | if (!gcxx . . $ g..runtimecxx . . $ global#runtime.) { |
| 743 | printfcxx . . $ printf(581fddd72a8db8fc).("Illegal runtime: %s\n", optargcxx . . $ optarg.); |
| 744 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 745 | } |
| 746 | break; |
| 747 | case OPT_RT_PRIOcxx . . $ OPT_RT_PRIO.: |
| 748 | case 'f': |
| 749 | gcxx . . $ g..rtpriocxx . . $ global#rtprio. = strtolcxx . . $ strtol(44bbb87609b212fc).(optargcxx . . $ optarg., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 10); |
| 750 | if (gcxx . . $ g..rtpriocxx . . $ global#rtprio. < 1 || gcxx . . $ g..rtpriocxx . . $ global#rtprio. > 99) { |
| 751 | printfcxx . . $ printf(581fddd72a8db8fc).("Illegal RT priority: %s (should be: 1-99)\n", optargcxx . . $ optarg.); |
| 752 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 753 | } |
| 754 | break; |
| 755 | case OPT_JSONcxx . . $ OPT_JSON.: |
| 756 | strncpycxx . . $ strncpy(255158a415b673b0).(gcxx . . $ g..jsonfilecxx . . $ global#jsonfile., optargcxx . . $ optarg., strnlencxx . . $ strnlen(ac5a385650b4bde5).(optargcxx . . $ optarg., MAX_PATHcxx . . $ `src/include/rt-utils.h:9:9`!-1)); |
| 757 | break; |
| 758 | case OPT_TRACE_THcxx . . $ OPT_TRACE_TH.: |
| 759 | case 'T': |
| 760 | gcxx . . $ g..trace_thresholdcxx . . $ global#trace_threshold. = strtolcxx . . $ strtol(44bbb87609b212fc).(optargcxx . . $ optarg., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 10); |
| 761 | if (gcxx . . $ g..trace_thresholdcxx . . $ global#trace_threshold. <= 0) { |
| 762 | printfcxx . . $ printf(581fddd72a8db8fc).("Parameter --trace-threshold needs to be positive\n"); |
| 763 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 764 | } |
| 765 | enable_trace_markcxx . . $ enable_trace_mark(49f6e7a06ebc5aa8).(); |
| 766 | break; |
| 767 | case OPT_WORKLOADcxx . . $ OPT_WORKLOAD.: |
| 768 | case 'w': |
| 769 | if (workload_selectcxx . . $ workload_select(1ef8e6ec083aabb9).(optargcxx . . $ optarg.)) { |
| 770 | printfcxx . . $ printf(581fddd72a8db8fc).("Unknown workload '%s'. Please choose from: ", optargcxx . . $ optarg.); |
| 771 | for (i = 0; i < WORKLOAD_NUMcxx . . $ WORKLOAD_NUM.; i++) { |
| 772 | printfcxx . . $ printf(581fddd72a8db8fc).("'%s'", workload_listcxx . . $ workload_list.[i].w_namecxx . . $ workload#w_name.); |
| 773 | if (i != WORKLOAD_NUMcxx . . $ WORKLOAD_NUM. - 1) |
| 774 | printfcxx . . $ printf(581fddd72a8db8fc).(", "); |
| 775 | } |
| 776 | printfcxx . . $ printf(581fddd72a8db8fc).("\n\n"); |
| 777 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 778 | } |
| 779 | break; |
| 780 | case OPT_WORKLOAD_MEMcxx . . $ OPT_WORKLOAD_MEM.: |
| 781 | case 'm': |
| 782 | if (parse_mem_stringcxx . . $ parse_mem_string(bd93ee2296053586).(optargcxx . . $ optarg., &gcxx . . $ g..workload_mem_sizecxx . . $ global#workload_mem_size.)) { |
| 783 | printfcxx . . $ printf(581fddd72a8db8fc).("Unknown workload memory size '%s'.\n\n", optargcxx . . $ optarg.); |
| 784 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 785 | } |
| 786 | break; |
| 787 | case OPT_QUIETcxx . . $ OPT_QUIET.: |
| 788 | case 'q': |
| 789 | gcxx . . $ g..quietcxx . . $ global#quiet. = 1; |
| 790 | break; |
| 791 | case OPT_SINGLE_PREHEATcxx . . $ OPT_SINGLE_PREHEAT.: |
| 792 | case 's': |
| 793 | /* |
| 794 | * Only use one core for pre-heat. Then if --bias is used, the |
| 795 | * bias will be exactly the min value of the pre-heat core. |
| 796 | */ |
| 797 | gcxx . . $ g..single_preheat_threadcxx . . $ global#single_preheat_thread. = truecxx . . $ `src/oslat/oslat.c:116:10`!; |
| 798 | break; |
| 799 | case OPT_VERSIONcxx . . $ OPT_VERSION.: |
| 800 | case 'v': |
| 801 | /* |
| 802 | * We always print the version before parsing options |
| 803 | * so just exit |
| 804 | */ |
| 805 | exitcxx . . $ exit(3ca292c338df9bb3).(0); |
| 806 | break; |
| 807 | case OPT_ZERO_OMITcxx . . $ OPT_ZERO_OMIT.: |
| 808 | case 'z': |
| 809 | gcxx . . $ g..output_omit_zero_bucketscxx . . $ global#output_omit_zero_buckets. = 1; |
| 810 | break; |
| 811 | case OPT_HELPcxx . . $ OPT_HELP.: |
| 812 | case 'h': |
| 813 | usagecxx . . $ usage(d4f767463ce0a6b3).(0); |
| 814 | break; |
| 815 | default: |
| 816 | usagecxx . . $ usage(d4f767463ce0a6b3).(1); |
| 817 | break; |
| 818 | } |
| 819 | } |
| 820 | |
| 821 | if (!gcxx . . $ g..bucket_size_paramcxx . . $ global#bucket_size_param. && gcxx . . $ g..precisioncxx . . $ global#precision. == 3 && gcxx . . $ g..bucket_widthcxx . . $ global#bucket_width. < 1000) |
| 822 | gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size. = BUCKET_SIZEcxx . . $ `src/oslat/oslat.c:143:10`! * 1000 / gcxx . . $ g..bucket_widthcxx . . $ global#bucket_width.; |
| 823 | } |
| 824 | |
| 825 | void dump_globalscxx . . $ dump_globals(49f6e7a06ebc5aa8).(void) |
| 826 | { |
| 827 | printfcxx . . $ printf(581fddd72a8db8fc).("Total runtime: \t\t%d seconds\n", gcxx . . $ g..runtimecxx . . $ global#runtime.); |
| 828 | printfcxx . . $ printf(581fddd72a8db8fc).("Thread priority: \t"); |
| 829 | if (gcxx . . $ g..rtpriocxx . . $ global#rtprio.) |
| 830 | printfcxx . . $ printf(581fddd72a8db8fc).("SCHED_FIFO:%d\n", gcxx . . $ g..rtpriocxx . . $ global#rtprio.); |
| 831 | else |
| 832 | printfcxx . . $ printf(581fddd72a8db8fc).("default\n"); |
| 833 | printfcxx . . $ printf(581fddd72a8db8fc).("CPU list: \t\t%s\n", gcxx . . $ g..cpu_listcxx . . $ global#cpu_list. ?: "(all cores)"); |
| 834 | printfcxx . . $ printf(581fddd72a8db8fc).("CPU for main thread: \t%d\n", gcxx . . $ g..cpu_main_threadcxx . . $ global#cpu_main_thread.); |
| 835 | printfcxx . . $ printf(581fddd72a8db8fc).("Workload: \t\t%s\n", gcxx . . $ g..workloadcxx . . $ global#workload.->w_namecxx . . $ workload#w_name.); |
| 836 | printfcxx . . $ printf(581fddd72a8db8fc).("Workload mem: \t\t%"PRIu64cxx . . $ `<external>/15933738808807975373/inttypes.h:105:10`!" (KiB)\n", |
| 837 | (gcxx . . $ g..workloadcxx . . $ global#workload.->w_flagscxx . . $ workload#w_flags. & WORK_NEED_MEMcxx . . $ `src/oslat/oslat.c:132:10`!) ? |
| 838 | (gcxx . . $ g..workload_mem_sizecxx . . $ global#workload_mem_size. / 1024) : 0); |
| 839 | printfcxx . . $ printf(581fddd72a8db8fc).("Preheat cores: \t\t%d\n", gcxx . . $ g..single_preheat_threadcxx . . $ global#single_preheat_thread. ? |
| 840 | 1 : gcxx . . $ g..n_threads_totalcxx . . $ global#n_threads_total.); |
| 841 | printfcxx . . $ printf(581fddd72a8db8fc).("\n"); |
| 842 | } |
| 843 | |
| 844 | static void record_biascxx . . $ record_bias(9e796537fa7612a7).(struct threadcxx . . $ thread# *t) |
| 845 | { |
| 846 | unsigned long int i; |
| 847 | uint64_tcxx . . $ uint64_t# bias = (uint64_tcxx . . $ uint64_t#)-1; |
| 848 | |
| 849 | if (!gcxx . . $ g..enable_biascxx . . $ global#enable_bias.) |
| 850 | return; |
| 851 | |
| 852 | /* Record the min value of minlat on all the threads */ |
| 853 | for (i = 0; i < gcxx . . $ g..n_threadscxx . . $ global#n_threads.; ++i) { |
| 854 | if (t[i].minlatcxx . . $ thread#minlat. < bias) |
| 855 | bias = t[i].minlatcxx . . $ thread#minlat.; |
| 856 | } |
| 857 | gcxx . . $ g..biascxx . . $ global#bias. = bias; |
| 858 | printfcxx . . $ printf(581fddd72a8db8fc).("Global bias set to %.*f (us)\n", gcxx . . $ g..precisioncxx . . $ global#precision., |
| 859 | (double)bias / gcxx . . $ g..unit_per_uscxx . . $ global#unit_per_us.); |
| 860 | } |
| 861 | |
| 862 | int maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[]) |
| 863 | { |
| 864 | struct threadcxx . . $ thread# *threads; |
| 865 | int n_cores; |
| 866 | unsigned long int i; |
| 867 | struct bitmaskcxx . . $ bitmask# *cpu_set = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 868 | |
| 869 | #ifdef FRC_MISSING |
| 870 | printf("This architecture is not yet supported. " |
| 871 | "Please implement frc() function first for %s.\n", argv[0]); |
| 872 | return 0; |
| 873 | #endif |
| 874 | if (numa_availablecxx . . $ numa_available(b126dc7c1de90089).() == -1) { |
| 875 | printfcxx . . $ printf(581fddd72a8db8fc).("ERROR: Could not initialize libnuma\n"); |
| 876 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 877 | } |
| 878 | |
| 879 | rt_initcxx . . $ rt_init(c759356ac01a31e7).(argc, argv); |
| 880 | |
| 881 | gcxx . . $ g..app_namecxx . . $ global#app_name. = argv[0]; |
| 882 | gcxx . . $ g..rtpriocxx . . $ global#rtprio. = 0; |
| 883 | gcxx . . $ g..bucket_sizecxx . . $ global#bucket_size. = BUCKET_SIZEcxx . . $ `src/oslat/oslat.c:143:10`!; |
| 884 | gcxx . . $ g..bucket_widthcxx . . $ global#bucket_width. = 1; |
| 885 | gcxx . . $ g..unit_per_uscxx . . $ global#unit_per_us. = 1; |
| 886 | gcxx . . $ g..runtimecxx . . $ global#runtime. = 1; |
| 887 | gcxx . . $ g..workloadcxx . . $ global#workload. = &workload_listcxx . . $ workload_list.[WORKLOAD_DEFAULTcxx . . $ `src/oslat/oslat.c:149:10`!]; |
| 888 | gcxx . . $ g..workload_mem_sizecxx . . $ global#workload_mem_size. = WORKLOAD_MEM_SIZEcxx . . $ `src/oslat/oslat.c:146:10`!; |
| 889 | /* Run the main thread on cpu0 by default */ |
| 890 | gcxx . . $ g..cpu_main_threadcxx . . $ global#cpu_main_thread. = 0; |
| 891 | printfcxx . . $ printf(581fddd72a8db8fc).("oslat V %1.2f\n", VERSIONcxx . . $ `<built-in>:412:9`!); |
| 892 | parse_optionscxx . . $ parse_options(c759356ac01a31e7).(argc, argv); |
| 893 | |
| 894 | TESTcxx . . $ `src/oslat/oslat.c:238:9`!(mlockall(MCL_CURRENTcxx . . $ `<external>/17226767460805440860/mman-linux.h:131:10`! | MCL_FUTUREcxx . . $ `<external>/17226767460805440860/mman-linux.h:132:10`!) == 0); |
| 895 | |
| 896 | if (!gcxx . . $ g..cpu_listcxx . . $ global#cpu_list.) |
| 897 | gcxx . . $ g..cpu_listcxx . . $ global#cpu_list. = strdupcxx . . $ strdup(a8b8e32347182212).("all"); |
| 898 | |
| 899 | cpu_set = numa_parse_cpustring_allcxx . . $ numa_parse_cpustring_all(62218a8025ffedd2).(gcxx . . $ g..cpu_listcxx . . $ global#cpu_list.); |
| 900 | if (!cpu_set) |
| 901 | fatalcxx . . $ fatal(5313ecf19fd40d4d).("oslat: numa_parse_cpustring_all failed.\n"); |
| 902 | n_cores = numa_bitmask_weightcxx . . $ numa_bitmask_weight(4b55de75830e9378).(cpu_set); |
| 903 | |
| 904 | TESTcxx . . $ `src/oslat/oslat.c:238:9`!(threads = calloc(1, n_cores * sizeof(threads[0]))); |
| 905 | for (i = 0; n_cores && i < cpu_set->sizecxx . . $ bitmask#size.; i++) { |
| 906 | if (numa_bitmask_isbitsetcxx . . $ numa_bitmask_isbitset(9048e51cedd65d8e).(cpu_set, i) && move_to_corecxx . . $ move_to_core(7864480464b09eea).(i) == 0) { |
| 907 | threads[gcxx . . $ g..n_threads_totalcxx . . $ global#n_threads_total.++].core_icxx . . $ thread#core_i. = i; |
| 908 | n_cores--; |
| 909 | } |
| 910 | } |
| 911 | |
| 912 | if (numa_bitmask_isbitsetcxx . . $ numa_bitmask_isbitset(9048e51cedd65d8e).(cpu_set, 0) && gcxx . . $ g..rtpriocxx . . $ global#rtprio.) |
| 913 | printfcxx . . $ printf(581fddd72a8db8fc).("WARNING: Running SCHED_FIFO workload on CPU 0 may hang the thread\n"); |
| 914 | |
| 915 | numa_bitmask_freecxx . . $ numa_bitmask_free(d7c6455decaee94d).(cpu_set); |
| 916 | |
| 917 | TESTcxx . . $ `src/oslat/oslat.c:238:9`!(move_to_core(g.cpu_main_thread) == 0); |
| 918 | |
| 919 | signalcxx . . $ signal(c2d516773f91faf8).(SIGALRMcxx . . $ `<external>/11773118241360591791/signum-generic.h:61:9`!, handle_alarmcxx . . $ handle_alarm(d4f767463ce0a6b3).); |
| 920 | signalcxx . . $ signal(c2d516773f91faf8).(SIGINTcxx . . $ `<external>/11773118241360591791/signum-generic.h:48:9`!, handle_alarmcxx . . $ handle_alarm(d4f767463ce0a6b3).); |
| 921 | signalcxx . . $ signal(c2d516773f91faf8).(SIGTERMcxx . . $ `<external>/11773118241360591791/signum-generic.h:53:9`!, handle_alarmcxx . . $ handle_alarm(d4f767463ce0a6b3).); |
| 922 | |
| 923 | if (!gcxx . . $ g..quietcxx . . $ global#quiet.) |
| 924 | dump_globalscxx . . $ dump_globals(49f6e7a06ebc5aa8).(); |
| 925 | |
| 926 | if (!gcxx . . $ g..quietcxx . . $ global#quiet.) |
| 927 | printfcxx . . $ printf(581fddd72a8db8fc).("Pre-heat for 1 seconds...\n"); |
| 928 | if (gcxx . . $ g..single_preheat_threadcxx . . $ global#single_preheat_thread.) |
| 929 | gcxx . . $ g..n_threadscxx . . $ global#n_threads. = 1; |
| 930 | else |
| 931 | gcxx . . $ g..n_threadscxx . . $ global#n_threads. = gcxx . . $ g..n_threads_totalcxx . . $ global#n_threads_total.; |
| 932 | run_exptcxx . . $ run_expt(5d6f42bf0aec3f27).(threads, 1, truecxx . . $ `src/oslat/oslat.c:116:10`!); |
| 933 | record_biascxx . . $ record_bias(9e796537fa7612a7).(threads); |
| 934 | |
| 935 | if (!gcxx . . $ g..quietcxx . . $ global#quiet.) |
| 936 | printfcxx . . $ printf(581fddd72a8db8fc).("Test starts...\n"); |
| 937 | /* Reset n_threads to always run on all the cores */ |
| 938 | gcxx . . $ g..n_threadscxx . . $ global#n_threads. = gcxx . . $ g..n_threads_totalcxx . . $ global#n_threads_total.; |
| 939 | run_exptcxx . . $ run_expt(5d6f42bf0aec3f27).(threads, gcxx . . $ g..runtimecxx . . $ global#runtime., falsecxx . . $ `src/oslat/oslat.c:117:10`!); |
| 940 | |
| 941 | if (!gcxx . . $ g..quietcxx . . $ global#quiet.) |
| 942 | printfcxx . . $ printf(581fddd72a8db8fc).("Test completed.\n\n"); |
| 943 | |
| 944 | write_summarycxx . . $ write_summary(9e796537fa7612a7).(threads); |
| 945 | |
| 946 | if (strlencxx . . $ strlen(751346f8406fd082).(gcxx . . $ g..jsonfilecxx . . $ global#jsonfile.) != 0) |
| 947 | rt_write_jsoncxx . . $ rt_write_json(969c696bbc9a09ad).(gcxx . . $ g..jsonfilecxx . . $ global#jsonfile., 0, write_summary_jsoncxx . . $ write_summary_json(2fd218767557b4b8)., threads); |
| 948 | |
| 949 | if (gcxx . . $ g..cpu_listcxx . . $ global#cpu_list.) { |
| 950 | freecxx . . $ free(5d22bdacc48458e8).(gcxx . . $ g..cpu_listcxx . . $ global#cpu_list.); |
| 951 | gcxx . . $ g..cpu_listcxx . . $ global#cpu_list. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 952 | } |
| 953 | |
| 954 | disable_trace_markcxx . . $ disable_trace_mark(49f6e7a06ebc5aa8).(); |
| 955 | |
| 956 | return 0; |
| 957 | } |