@@ -2331,6 +2331,8 @@ int cpu_is_not_allowed(int cpu)
2331
2331
* skip non-present cpus
2332
2332
*/
2333
2333
2334
+ #define PER_THREAD_PARAMS struct thread_data *t, struct core_data *c, struct pkg_data *p
2335
+
2334
2336
int for_all_cpus (int (func ) (struct thread_data * , struct core_data * , struct pkg_data * ),
2335
2337
struct thread_data * thread_base , struct core_data * core_base , struct pkg_data * pkg_base )
2336
2338
{
@@ -2360,21 +2362,21 @@ int for_all_cpus(int (func) (struct thread_data *, struct core_data *, struct pk
2360
2362
return retval ;
2361
2363
}
2362
2364
2363
- int is_cpu_first_thread_in_core (struct thread_data * t , struct core_data * c , struct pkg_data * p )
2365
+ int is_cpu_first_thread_in_core (PER_THREAD_PARAMS )
2364
2366
{
2365
2367
UNUSED (p );
2366
2368
2367
2369
return ((int )t -> cpu_id == c -> base_cpu || c -> base_cpu < 0 );
2368
2370
}
2369
2371
2370
- int is_cpu_first_core_in_package (struct thread_data * t , struct core_data * c , struct pkg_data * p )
2372
+ int is_cpu_first_core_in_package (PER_THREAD_PARAMS )
2371
2373
{
2372
2374
UNUSED (c );
2373
2375
2374
2376
return ((int )t -> cpu_id == p -> base_cpu || p -> base_cpu < 0 );
2375
2377
}
2376
2378
2377
- int is_cpu_first_thread_in_package (struct thread_data * t , struct core_data * c , struct pkg_data * p )
2379
+ int is_cpu_first_thread_in_package (PER_THREAD_PARAMS )
2378
2380
{
2379
2381
return is_cpu_first_thread_in_core (t , c , p ) && is_cpu_first_core_in_package (t , c , p );
2380
2382
}
@@ -3020,7 +3022,7 @@ void print_header(char *delim)
3020
3022
outp += sprintf (outp , "\n" );
3021
3023
}
3022
3024
3023
- int dump_counters (struct thread_data * t , struct core_data * c , struct pkg_data * p )
3025
+ int dump_counters (PER_THREAD_PARAMS )
3024
3026
{
3025
3027
int i ;
3026
3028
struct msr_counter * mp ;
@@ -3135,7 +3137,7 @@ double rapl_counter_get_value(const struct rapl_counter *c, enum rapl_unit desir
3135
3137
/*
3136
3138
* column formatting convention & formats
3137
3139
*/
3138
- int format_counters (struct thread_data * t , struct core_data * c , struct pkg_data * p )
3140
+ int format_counters (PER_THREAD_PARAMS )
3139
3141
{
3140
3142
static int count ;
3141
3143
@@ -3677,7 +3679,7 @@ void flush_output_stderr(void)
3677
3679
outp = output_buffer ;
3678
3680
}
3679
3681
3680
- void format_all_counters (struct thread_data * t , struct core_data * c , struct pkg_data * p )
3682
+ void format_all_counters (PER_THREAD_PARAMS )
3681
3683
{
3682
3684
static int count ;
3683
3685
@@ -3968,7 +3970,7 @@ void rapl_counter_clear(struct rapl_counter *c)
3968
3970
c -> unit = RAPL_UNIT_INVALID ;
3969
3971
}
3970
3972
3971
- void clear_counters (struct thread_data * t , struct core_data * c , struct pkg_data * p )
3973
+ void clear_counters (PER_THREAD_PARAMS )
3972
3974
{
3973
3975
int i ;
3974
3976
struct msr_counter * mp ;
@@ -4065,7 +4067,7 @@ void rapl_counter_accumulate(struct rapl_counter *dst, const struct rapl_counter
4065
4067
dst -> raw_value += src -> raw_value ;
4066
4068
}
4067
4069
4068
- int sum_counters (struct thread_data * t , struct core_data * c , struct pkg_data * p )
4070
+ int sum_counters (PER_THREAD_PARAMS )
4069
4071
{
4070
4072
int i ;
4071
4073
struct msr_counter * mp ;
@@ -4213,7 +4215,7 @@ int sum_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
4213
4215
* sum the counters for all cpus in the system
4214
4216
* compute the weighted average
4215
4217
*/
4216
- void compute_average (struct thread_data * t , struct core_data * c , struct pkg_data * p )
4218
+ void compute_average (PER_THREAD_PARAMS )
4217
4219
{
4218
4220
int i ;
4219
4221
struct msr_counter * mp ;
@@ -4796,7 +4798,7 @@ char *find_sysfs_path_by_id(struct sysfs_path *sp, int id)
4796
4798
return NULL ;
4797
4799
}
4798
4800
4799
- int get_cstate_counters (unsigned int cpu , struct thread_data * t , struct core_data * c , struct pkg_data * p )
4801
+ int get_cstate_counters (unsigned int cpu , PER_THREAD_PARAMS )
4800
4802
{
4801
4803
/*
4802
4804
* Overcommit memory a little bit here,
@@ -5096,7 +5098,7 @@ static inline int get_rapl_domain_id(int cpu)
5096
5098
* migrate to cpu
5097
5099
* acquire and record local counters for that cpu
5098
5100
*/
5099
- int get_counters (struct thread_data * t , struct core_data * c , struct pkg_data * p )
5101
+ int get_counters (PER_THREAD_PARAMS )
5100
5102
{
5101
5103
int cpu = t -> cpu_id ;
5102
5104
unsigned long long msr ;
@@ -6586,7 +6588,7 @@ int get_msr_sum(int cpu, off_t offset, unsigned long long *msr)
6586
6588
timer_t timerid ;
6587
6589
6588
6590
/* Timer callback, update the sum of MSRs periodically. */
6589
- static int update_msr_sum (struct thread_data * t , struct core_data * c , struct pkg_data * p )
6591
+ static int update_msr_sum (PER_THREAD_PARAMS )
6590
6592
{
6591
6593
int i , ret ;
6592
6594
int cpu = t -> cpu_id ;
@@ -7332,7 +7334,7 @@ static void dump_sysfs_pstate_config(void)
7332
7334
* print_epb()
7333
7335
* Decode the ENERGY_PERF_BIAS MSR
7334
7336
*/
7335
- int print_epb (struct thread_data * t , struct core_data * c , struct pkg_data * p )
7337
+ int print_epb (PER_THREAD_PARAMS )
7336
7338
{
7337
7339
char * epb_string ;
7338
7340
int cpu , epb ;
@@ -7381,7 +7383,7 @@ int print_epb(struct thread_data *t, struct core_data *c, struct pkg_data *p)
7381
7383
* print_hwp()
7382
7384
* Decode the MSR_HWP_CAPABILITIES
7383
7385
*/
7384
- int print_hwp (struct thread_data * t , struct core_data * c , struct pkg_data * p )
7386
+ int print_hwp (PER_THREAD_PARAMS )
7385
7387
{
7386
7388
unsigned long long msr ;
7387
7389
int cpu ;
@@ -7470,7 +7472,7 @@ int print_hwp(struct thread_data *t, struct core_data *c, struct pkg_data *p)
7470
7472
/*
7471
7473
* print_perf_limit()
7472
7474
*/
7473
- int print_perf_limit (struct thread_data * t , struct core_data * c , struct pkg_data * p )
7475
+ int print_perf_limit (PER_THREAD_PARAMS )
7474
7476
{
7475
7477
unsigned long long msr ;
7476
7478
int cpu ;
@@ -7845,7 +7847,7 @@ static int print_rapl_sysfs(void)
7845
7847
return 0 ;
7846
7848
}
7847
7849
7848
- int print_rapl (struct thread_data * t , struct core_data * c , struct pkg_data * p )
7850
+ int print_rapl (PER_THREAD_PARAMS )
7849
7851
{
7850
7852
unsigned long long msr ;
7851
7853
const char * msr_name ;
@@ -7999,7 +8001,7 @@ void probe_rapl(void)
7999
8001
* below this value, including the Digital Thermal Sensor (DTS),
8000
8002
* Package Thermal Management Sensor (PTM), and thermal event thresholds.
8001
8003
*/
8002
- int set_temperature_target (struct thread_data * t , struct core_data * c , struct pkg_data * p )
8004
+ int set_temperature_target (PER_THREAD_PARAMS )
8003
8005
{
8004
8006
unsigned long long msr ;
8005
8007
unsigned int tcc_default , tcc_offset ;
@@ -8067,7 +8069,7 @@ int set_temperature_target(struct thread_data *t, struct core_data *c, struct pk
8067
8069
return 0 ;
8068
8070
}
8069
8071
8070
- int print_thermal (struct thread_data * t , struct core_data * c , struct pkg_data * p )
8072
+ int print_thermal (PER_THREAD_PARAMS )
8071
8073
{
8072
8074
unsigned long long msr ;
8073
8075
unsigned int dts , dts2 ;
@@ -8147,7 +8149,7 @@ void probe_thermal(void)
8147
8149
for_all_cpus (print_thermal , ODD_COUNTERS );
8148
8150
}
8149
8151
8150
- int get_cpu_type (struct thread_data * t , struct core_data * c , struct pkg_data * p )
8152
+ int get_cpu_type (PER_THREAD_PARAMS )
8151
8153
{
8152
8154
unsigned int eax , ebx , ecx , edx ;
8153
8155
@@ -9395,7 +9397,7 @@ void allocate_irq_buffers(void)
9395
9397
err (-1 , "calloc %d NMI" , topo .max_cpu_num + 1 );
9396
9398
}
9397
9399
9398
- int update_topo (struct thread_data * t , struct core_data * c , struct pkg_data * p )
9400
+ int update_topo (PER_THREAD_PARAMS )
9399
9401
{
9400
9402
topo .allowed_cpus ++ ;
9401
9403
if ((int )t -> cpu_id == c -> base_cpu )
0 commit comments