| 1 | // SPDX-License-Identifier: GPL-2.0-or-latercxx . . $ `<file>/src/include/pi_stress.h`/ |
| 2 | #ifndef __PI_STRESS_H |
| 3 | #define __PI_STRESS_Hcxx . . $ `src/include/pi_stress.h:3:9`! |
| 4 | #include <stdio.h> |
| 5 | #include <errno.h> |
| 6 | #include <stdlib.h> |
| 7 | #include <stdarg.h> |
| 8 | #include <pthread.h> |
| 9 | #include <sched.h> |
| 10 | #include <unistd.h> |
| 11 | #include <string.h> |
| 12 | #include <signal.h> |
| 13 | #include <getopt.h> |
| 14 | #include <sys/types.h> |
| 15 | #include <sys/mman.h> |
| 16 | #include <sys/wait.h> |
| 17 | #include <sys/syscall.h> |
| 18 | #include <termios.h> |
| 19 | #include <stdint.h> |
| 20 | #include <inttypes.h> |
| 21 | #include <limits.h> |
| 22 | |
| 23 | #include "rt-sched.h"cxx . . $ `<file>/src/include/rt-sched.h`/ |
| 24 | #include "rt-utils.h"cxx . . $ `<file>/src/include/rt-utils.h`/ |
| 25 | #include "rt-error.h"cxx . . $ `<file>/src/include/rt-error.h`/ |
| 26 | |
| 27 | /* test timeout */ |
| 28 | #define TIMEOUTcxx . . $ `src/include/pi_stress.h:28:9`! 2 |
| 29 | |
| 30 | /* determine if the C library supports Priority Inheritance mutexes */ |
| 31 | #if defined(_POSIX_THREAD_PRIO_INHERITcxx . . $ `<external>/4533468968537266721/posix_opt.h:88:9`!) && _POSIX_THREAD_PRIO_INHERITcxx . . $ `<external>/4533468968537266721/posix_opt.h:88:9`! != -1 |
| 32 | #define HAVE_PI_MUTEXcxx . . $ `src/include/pi_stress.h:32:9`! 1 |
| 33 | #else |
| 34 | #define HAVE_PI_MUTEX 0 |
| 35 | #endif |
| 36 | |
| 37 | #if HAVE_PI_MUTEXcxx . . $ `src/include/pi_stress.h:32:9`! == 0 |
| 38 | #error "Can't run this test without PI Mutex support" |
| 39 | #endif |
| 40 | |
| 41 | #define SUCCESScxx . . $ `src/include/pi_stress.h:41:9`! 0 |
| 42 | #define FAILUREcxx . . $ `src/include/pi_stress.h:42:9`! 1 |
| 43 | |
| 44 | /* cursor control */ |
| 45 | #define UP_ONEcxx . . $ `src/include/pi_stress.h:45:9`! "\033[1A" |
| 46 | #define DOWN_ONEcxx . . $ `src/include/pi_stress.h:46:9`! "\033[1B" |
| 47 | |
| 48 | #define pi_infocxx . . $ `src/include/pi_stress.h:48:9`!(fmt, arg...) \ |
| 49 | do { info(verbose, fmt, ## arg); } while (0) |
| 50 | #define pi_debugcxx . . $ `src/include/pi_stress.h:50:9`!(fmt, arg...) \ |
| 51 | do { debug(debugging, fmt, ## arg); } while (0) |
| 52 | #define pi_errorcxx . . $ `src/include/pi_stress.h:52:9`!(fmt, arg...) \ |
| 53 | do { err_msg(fmt, ## arg); have_errors = 1; } while (0) |
| 54 | |
| 55 | #define NUM_TEST_THREADScxx . . $ `src/include/pi_stress.h:55:9`! 3 |
| 56 | #define NUM_ADMIN_THREADScxx . . $ `src/include/pi_stress.h:56:9`! 1 |
| 57 | |
| 58 | #define SA_INIT_LOWcxx . . $ `src/include/pi_stress.h:58:9`! (1 << 0) |
| 59 | #define SA_INIT_MEDcxx . . $ `src/include/pi_stress.h:59:9`! (1 << 1) |
| 60 | #define SA_INIT_HIGHcxx . . $ `src/include/pi_stress.h:60:9`! (1 << 2) |
| 61 | #define SA_INIT_ADMINcxx . . $ `src/include/pi_stress.h:61:9`! (1 << 3) |
| 62 | |
| 63 | /* number of consecutive watchdog hits before quitting */ |
| 64 | #define WATCHDOG_LIMITcxx . . $ `src/include/pi_stress.h:64:9`! 5 |
| 65 | |
| 66 | struct group_parameterscxx . . $ group_parameters# { |
| 67 | |
| 68 | /* group id (index) */ |
| 69 | int idcxx . . $ group_parameters#id.; |
| 70 | |
| 71 | /* cpu this group is bound to */ |
| 72 | long cpucxx . . $ group_parameters#cpu.; |
| 73 | |
| 74 | /* threads in the group */ |
| 75 | pthread_tcxx . . $ pthread_t# low_tidcxx . . $ group_parameters#low_tid.; |
| 76 | pthread_tcxx . . $ pthread_t# med_tidcxx . . $ group_parameters#med_tid.; |
| 77 | pthread_tcxx . . $ pthread_t# high_tidcxx . . $ group_parameters#high_tid.; |
| 78 | |
| 79 | /* number of machine iterations to perform */ |
| 80 | int inversionscxx . . $ group_parameters#inversions.; |
| 81 | |
| 82 | /* group mutex */ |
| 83 | pthread_mutex_tcxx . . $ pthread_mutex_t# mutexcxx . . $ group_parameters#mutex.; |
| 84 | |
| 85 | /* state barriers */ |
| 86 | pthread_barrier_tcxx . . $ pthread_barrier_t# start_barriercxx . . $ group_parameters#start_barrier.; |
| 87 | pthread_barrier_tcxx . . $ pthread_barrier_t# locked_barriercxx . . $ group_parameters#locked_barrier.; |
| 88 | pthread_barrier_tcxx . . $ pthread_barrier_t# elevate_barriercxx . . $ group_parameters#elevate_barrier.; |
| 89 | pthread_barrier_tcxx . . $ pthread_barrier_t# finish_barriercxx . . $ group_parameters#finish_barrier.; |
| 90 | |
| 91 | /* Either everyone goes through the loop, or else no-ones does */ |
| 92 | pthread_barrier_tcxx . . $ pthread_barrier_t# loop_barrcxx . . $ group_parameters#loop_barr.; |
| 93 | pthread_mutex_tcxx . . $ pthread_mutex_t# loop_mtxcxx . . $ group_parameters#loop_mtx.; /* Protect access to int loop */ |
| 94 | int loopcxx . . $ group_parameters#loop.; /* boolean, loop or not, connected to shutdown */ |
| 95 | |
| 96 | /* state variables */ |
| 97 | volatile int watchdogcxx . . $ group_parameters#watchdog.; |
| 98 | |
| 99 | /* total number of inversions performed */ |
| 100 | unsigned long totalcxx . . $ group_parameters#total.; |
| 101 | |
| 102 | /* total watchdog hits */ |
| 103 | int watchdog_hitscxx . . $ group_parameters#watchdog_hits.; |
| 104 | |
| 105 | }; |
| 106 | |
| 107 | /* forward prototypes */ |
| 108 | void *low_prioritycxx . . $ low_priority(9f162e79bfc6c74).(void *arg); |
| 109 | void *med_prioritycxx . . $ med_priority(9f162e79bfc6c74).(void *arg); |
| 110 | void *high_prioritycxx . . $ high_priority(9f162e79bfc6c74).(void *arg); |
| 111 | void *reportercxx . . $ reporter(9f162e79bfc6c74).(void *arg); |
| 112 | void *watchdogcxx . . $ watchdog(9f162e79bfc6c74).(void *arg); |
| 113 | int setup_thread_attrcxx . . $ setup_thread_attr(1f85186bfce73196).(pthread_attr_tcxx . . $ pthread_attr_t# *attr, struct sched_attrcxx . . $ sched_attr# *sa, |
| 114 | cpu_set_tcxx . . $ cpu_set_t# *mask); |
| 115 | int set_cpu_affinitycxx . . $ set_cpu_affinity(d96ca8014e0634be).(cpu_set_tcxx . . $ cpu_set_t# *test_mask, cpu_set_tcxx . . $ cpu_set_t# *admin_mask); |
| 116 | void process_command_linecxx . . $ process_command_line(c759356ac01a31e7).(int argc, char **argv); |
| 117 | void usagecxx . . $ usage(d4f767463ce0a6b3).(int error); |
| 118 | int block_signalscxx . . $ block_signals(b126dc7c1de90089).(void); |
| 119 | int allow_sigtermcxx . . $ allow_sigterm(b126dc7c1de90089).(void); |
| 120 | void set_shutdown_flagcxx . . $ set_shutdown_flag(49f6e7a06ebc5aa8).(void); |
| 121 | int initialize_groupcxx . . $ initialize_group(5723616408aa12db).(struct group_parameterscxx . . $ group_parameters# *group); |
| 122 | int create_groupcxx . . $ create_group(5723616408aa12db).(struct group_parameterscxx . . $ group_parameters# *group); |
| 123 | unsigned long total_inversionscxx . . $ total_inversions(f708dce9a8856c70).(void); |
| 124 | void bannercxx . . $ banner(49f6e7a06ebc5aa8).(void); |
| 125 | void summarycxx . . $ summary(49f6e7a06ebc5aa8).(void); |
| 126 | void write_statscxx . . $ write_stats(2fd218767557b4b8).(FILEcxx . . $ FILE# *f, void *data); |
| 127 | void wait_for_terminationcxx . . $ wait_for_termination(49f6e7a06ebc5aa8).(void); |
| 128 | int barrier_initcxx . . $ barrier_init(f9df304b61f441a4).(pthread_barrier_tcxx . . $ pthread_barrier_t# *b, const pthread_barrierattr_tcxx . . $ pthread_barrierattr_t# *attr, |
| 129 | unsigned int count, const char *name); |
| 130 | void setup_sched_attrcxx . . $ setup_sched_attr(d876dc12d2dd5b19).(struct sched_attrcxx . . $ sched_attr# *attr, int policy, int prio); |
| 131 | void setup_sched_configcxx . . $ setup_sched_config(d4f767463ce0a6b3).(int policy); |
| 132 | |
| 133 | #endif /* __PI_STRESS_H */ |