@@ -1721,6 +1721,25 @@ int get_mp(int cpu, struct msr_counter *mp, unsigned long long *counterp)
1721
1721
return 0 ;
1722
1722
}
1723
1723
1724
+ int get_epb (int cpu )
1725
+ {
1726
+ char path [128 + PATH_BYTES ];
1727
+ int ret , epb = -1 ;
1728
+ FILE * fp ;
1729
+
1730
+ sprintf (path , "/sys/devices/system/cpu/cpu%d/power/energy_perf_bias" , cpu );
1731
+
1732
+ fp = fopen_or_die (path , "r" );
1733
+
1734
+ ret = fscanf (fp , "%d" , & epb );
1735
+ if (ret != 1 )
1736
+ err (1 , "%s(%s)" , __func__ , path );
1737
+
1738
+ fclose (fp );
1739
+
1740
+ return epb ;
1741
+ }
1742
+
1724
1743
void get_apic_id (struct thread_data * t )
1725
1744
{
1726
1745
unsigned int eax , ebx , ecx , edx ;
@@ -3631,9 +3650,8 @@ dump_sysfs_pstate_config(void)
3631
3650
*/
3632
3651
int print_epb (struct thread_data * t , struct core_data * c , struct pkg_data * p )
3633
3652
{
3634
- unsigned long long msr ;
3635
3653
char * epb_string ;
3636
- int cpu ;
3654
+ int cpu , epb ;
3637
3655
3638
3656
if (!has_epb )
3639
3657
return 0 ;
@@ -3649,10 +3667,11 @@ int print_epb(struct thread_data *t, struct core_data *c, struct pkg_data *p)
3649
3667
return -1 ;
3650
3668
}
3651
3669
3652
- if (get_msr (cpu , MSR_IA32_ENERGY_PERF_BIAS , & msr ))
3670
+ epb = get_epb (cpu );
3671
+ if (epb < 0 )
3653
3672
return 0 ;
3654
3673
3655
- switch (msr & 0xF ) {
3674
+ switch (epb ) {
3656
3675
case ENERGY_PERF_BIAS_PERFORMANCE :
3657
3676
epb_string = "performance" ;
3658
3677
break ;
@@ -3666,7 +3685,7 @@ int print_epb(struct thread_data *t, struct core_data *c, struct pkg_data *p)
3666
3685
epb_string = "custom" ;
3667
3686
break ;
3668
3687
}
3669
- fprintf (outf , "cpu%d: MSR_IA32_ENERGY_PERF_BIAS: 0x%08llx (%s)\n" , cpu , msr , epb_string );
3688
+ fprintf (outf , "cpu%d: EPB: %d (%s)\n" , cpu , epb , epb_string );
3670
3689
3671
3690
return 0 ;
3672
3691
}
0 commit comments