@@ -2331,6 +2331,8 @@ int cpu_is_not_allowed(int cpu)
23312331 * skip non-present cpus
23322332 */
23332333
2334+ #define PER_THREAD_PARAMS struct thread_data *t, struct core_data *c, struct pkg_data *p
2335+
23342336int for_all_cpus (int (func ) (struct thread_data * , struct core_data * , struct pkg_data * ),
23352337 struct thread_data * thread_base , struct core_data * core_base , struct pkg_data * pkg_base )
23362338{
@@ -2360,21 +2362,21 @@ int for_all_cpus(int (func) (struct thread_data *, struct core_data *, struct pk
23602362 return retval ;
23612363}
23622364
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 )
23642366{
23652367 UNUSED (p );
23662368
23672369 return ((int )t -> cpu_id == c -> base_cpu || c -> base_cpu < 0 );
23682370}
23692371
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 )
23712373{
23722374 UNUSED (c );
23732375
23742376 return ((int )t -> cpu_id == p -> base_cpu || p -> base_cpu < 0 );
23752377}
23762378
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 )
23782380{
23792381 return is_cpu_first_thread_in_core (t , c , p ) && is_cpu_first_core_in_package (t , c , p );
23802382}
@@ -3020,7 +3022,7 @@ void print_header(char *delim)
30203022 outp += sprintf (outp , "\n" );
30213023}
30223024
3023- int dump_counters (struct thread_data * t , struct core_data * c , struct pkg_data * p )
3025+ int dump_counters (PER_THREAD_PARAMS )
30243026{
30253027 int i ;
30263028 struct msr_counter * mp ;
@@ -3135,7 +3137,7 @@ double rapl_counter_get_value(const struct rapl_counter *c, enum rapl_unit desir
31353137/*
31363138 * column formatting convention & formats
31373139 */
3138- int format_counters (struct thread_data * t , struct core_data * c , struct pkg_data * p )
3140+ int format_counters (PER_THREAD_PARAMS )
31393141{
31403142 static int count ;
31413143
@@ -3677,7 +3679,7 @@ void flush_output_stderr(void)
36773679 outp = output_buffer ;
36783680}
36793681
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 )
36813683{
36823684 static int count ;
36833685
@@ -3968,7 +3970,7 @@ void rapl_counter_clear(struct rapl_counter *c)
39683970 c -> unit = RAPL_UNIT_INVALID ;
39693971}
39703972
3971- void clear_counters (struct thread_data * t , struct core_data * c , struct pkg_data * p )
3973+ void clear_counters (PER_THREAD_PARAMS )
39723974{
39733975 int i ;
39743976 struct msr_counter * mp ;
@@ -4065,7 +4067,7 @@ void rapl_counter_accumulate(struct rapl_counter *dst, const struct rapl_counter
40654067 dst -> raw_value += src -> raw_value ;
40664068}
40674069
4068- int sum_counters (struct thread_data * t , struct core_data * c , struct pkg_data * p )
4070+ int sum_counters (PER_THREAD_PARAMS )
40694071{
40704072 int i ;
40714073 struct msr_counter * mp ;
@@ -4213,7 +4215,7 @@ int sum_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p)
42134215 * sum the counters for all cpus in the system
42144216 * compute the weighted average
42154217 */
4216- void compute_average (struct thread_data * t , struct core_data * c , struct pkg_data * p )
4218+ void compute_average (PER_THREAD_PARAMS )
42174219{
42184220 int i ;
42194221 struct msr_counter * mp ;
@@ -4796,7 +4798,7 @@ char *find_sysfs_path_by_id(struct sysfs_path *sp, int id)
47964798 return NULL ;
47974799}
47984800
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 )
48004802{
48014803 /*
48024804 * Overcommit memory a little bit here,
@@ -5096,7 +5098,7 @@ static inline int get_rapl_domain_id(int cpu)
50965098 * migrate to cpu
50975099 * acquire and record local counters for that cpu
50985100 */
5099- int get_counters (struct thread_data * t , struct core_data * c , struct pkg_data * p )
5101+ int get_counters (PER_THREAD_PARAMS )
51005102{
51015103 int cpu = t -> cpu_id ;
51025104 unsigned long long msr ;
@@ -6586,7 +6588,7 @@ int get_msr_sum(int cpu, off_t offset, unsigned long long *msr)
65866588timer_t timerid ;
65876589
65886590/* 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 )
65906592{
65916593 int i , ret ;
65926594 int cpu = t -> cpu_id ;
@@ -7332,7 +7334,7 @@ static void dump_sysfs_pstate_config(void)
73327334 * print_epb()
73337335 * Decode the ENERGY_PERF_BIAS MSR
73347336 */
7335- int print_epb (struct thread_data * t , struct core_data * c , struct pkg_data * p )
7337+ int print_epb (PER_THREAD_PARAMS )
73367338{
73377339 char * epb_string ;
73387340 int cpu , epb ;
@@ -7381,7 +7383,7 @@ int print_epb(struct thread_data *t, struct core_data *c, struct pkg_data *p)
73817383 * print_hwp()
73827384 * Decode the MSR_HWP_CAPABILITIES
73837385 */
7384- int print_hwp (struct thread_data * t , struct core_data * c , struct pkg_data * p )
7386+ int print_hwp (PER_THREAD_PARAMS )
73857387{
73867388 unsigned long long msr ;
73877389 int cpu ;
@@ -7470,7 +7472,7 @@ int print_hwp(struct thread_data *t, struct core_data *c, struct pkg_data *p)
74707472/*
74717473 * print_perf_limit()
74727474 */
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 )
74747476{
74757477 unsigned long long msr ;
74767478 int cpu ;
@@ -7845,7 +7847,7 @@ static int print_rapl_sysfs(void)
78457847 return 0 ;
78467848}
78477849
7848- int print_rapl (struct thread_data * t , struct core_data * c , struct pkg_data * p )
7850+ int print_rapl (PER_THREAD_PARAMS )
78497851{
78507852 unsigned long long msr ;
78517853 const char * msr_name ;
@@ -7999,7 +8001,7 @@ void probe_rapl(void)
79998001 * below this value, including the Digital Thermal Sensor (DTS),
80008002 * Package Thermal Management Sensor (PTM), and thermal event thresholds.
80018003 */
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 )
80038005{
80048006 unsigned long long msr ;
80058007 unsigned int tcc_default , tcc_offset ;
@@ -8067,7 +8069,7 @@ int set_temperature_target(struct thread_data *t, struct core_data *c, struct pk
80678069 return 0 ;
80688070}
80698071
8070- int print_thermal (struct thread_data * t , struct core_data * c , struct pkg_data * p )
8072+ int print_thermal (PER_THREAD_PARAMS )
80718073{
80728074 unsigned long long msr ;
80738075 unsigned int dts , dts2 ;
@@ -8147,7 +8149,7 @@ void probe_thermal(void)
81478149 for_all_cpus (print_thermal , ODD_COUNTERS );
81488150}
81498151
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 )
81518153{
81528154 unsigned int eax , ebx , ecx , edx ;
81538155
@@ -9395,7 +9397,7 @@ void allocate_irq_buffers(void)
93959397 err (-1 , "calloc %d NMI" , topo .max_cpu_num + 1 );
93969398}
93979399
9398- int update_topo (struct thread_data * t , struct core_data * c , struct pkg_data * p )
9400+ int update_topo (PER_THREAD_PARAMS )
93999401{
94009402 topo .allowed_cpus ++ ;
94019403 if ((int )t -> cpu_id == c -> base_cpu )
0 commit comments