@@ -1057,8 +1057,7 @@ void probe_platform_features(unsigned int family, unsigned int model)
10571057 return ;
10581058
10591059 for (i = 0 ; turbostat_pdata [i ].features ; i ++ ) {
1060- if (VFM_FAMILY (turbostat_pdata [i ].vfm ) == family &&
1061- VFM_MODEL (turbostat_pdata [i ].vfm ) == model ) {
1060+ if (VFM_FAMILY (turbostat_pdata [i ].vfm ) == family && VFM_MODEL (turbostat_pdata [i ].vfm ) == model ) {
10621061 platform = turbostat_pdata [i ].features ;
10631062 return ;
10641063 }
@@ -1448,28 +1447,28 @@ enum msr_arch_info_index {
14481447
14491448static struct msr_counter_arch_info msr_counter_arch_infos [] = {
14501449 [MSR_ARCH_INFO_APERF_INDEX ] = {
1451- .perf_subsys = "msr" ,
1452- .perf_name = "aperf" ,
1453- .msr = MSR_IA32_APERF ,
1454- .msr_mask = 0xFFFFFFFFFFFFFFFF ,
1455- .rci_index = MSR_RCI_INDEX_APERF ,
1456- },
1450+ .perf_subsys = "msr" ,
1451+ .perf_name = "aperf" ,
1452+ .msr = MSR_IA32_APERF ,
1453+ .msr_mask = 0xFFFFFFFFFFFFFFFF ,
1454+ .rci_index = MSR_RCI_INDEX_APERF ,
1455+ },
14571456
14581457 [MSR_ARCH_INFO_MPERF_INDEX ] = {
1459- .perf_subsys = "msr" ,
1460- .perf_name = "mperf" ,
1461- .msr = MSR_IA32_MPERF ,
1462- .msr_mask = 0xFFFFFFFFFFFFFFFF ,
1463- .rci_index = MSR_RCI_INDEX_MPERF ,
1464- },
1458+ .perf_subsys = "msr" ,
1459+ .perf_name = "mperf" ,
1460+ .msr = MSR_IA32_MPERF ,
1461+ .msr_mask = 0xFFFFFFFFFFFFFFFF ,
1462+ .rci_index = MSR_RCI_INDEX_MPERF ,
1463+ },
14651464
14661465 [MSR_ARCH_INFO_SMI_INDEX ] = {
1467- .perf_subsys = "msr" ,
1468- .perf_name = "smi" ,
1469- .msr = MSR_SMI_COUNT ,
1470- .msr_mask = 0xFFFFFFFF ,
1471- .rci_index = MSR_RCI_INDEX_SMI ,
1472- },
1466+ .perf_subsys = "msr" ,
1467+ .perf_name = "smi" ,
1468+ .msr = MSR_SMI_COUNT ,
1469+ .msr_mask = 0xFFFFFFFF ,
1470+ .rci_index = MSR_RCI_INDEX_SMI ,
1471+ },
14731472};
14741473
14751474/* Can be redefined when compiling, useful for testing. */
@@ -1535,14 +1534,14 @@ struct pmt_counter {
15351534
15361535unsigned int pmt_counter_get_width (const struct pmt_counter * p )
15371536{
1538- return (p -> msb - p -> lsb )+ 1 ;
1537+ return (p -> msb - p -> lsb ) + 1 ;
15391538}
15401539
15411540void pmt_counter_resize_ (struct pmt_counter * pcounter , unsigned int new_size )
15421541{
15431542 struct pmt_domain_info * new_mem ;
15441543
1545- new_mem = (struct pmt_domain_info * ) reallocarray (pcounter -> domains , new_size , sizeof (* pcounter -> domains ));
1544+ new_mem = (struct pmt_domain_info * ) reallocarray (pcounter -> domains , new_size , sizeof (* pcounter -> domains ));
15461545 if (!new_mem ) {
15471546 fprintf (stderr , "%s: failed to allocate memory for PMT counters\n" , __func__ );
15481547 exit (1 );
@@ -1567,7 +1566,7 @@ void pmt_counter_resize(struct pmt_counter *pcounter, unsigned int new_size)
15671566 */
15681567 if (new_size < 8 )
15691568 new_size = 8 ;
1570- new_size = MAX (new_size , pcounter -> num_domains * 2 );
1569+ new_size = MAX (new_size , pcounter -> num_domains * 2 );
15711570
15721571 pmt_counter_resize_ (pcounter , new_size );
15731572}
@@ -2282,7 +2281,7 @@ void print_header(char *delim)
22822281
22832282 ppmt = sys .pmt_tp ;
22842283 while (ppmt ) {
2285- switch (ppmt -> type ) {
2284+ switch (ppmt -> type ) {
22862285 case PMT_TYPE_RAW :
22872286 if (pmt_counter_get_width (ppmt ) <= 32 )
22882287 outp += sprintf (outp , "%s%10.10s" , (printed ++ ? delim : "" ), ppmt -> name );
@@ -2356,7 +2355,7 @@ void print_header(char *delim)
23562355
23572356 ppmt = sys .pmt_cp ;
23582357 while (ppmt ) {
2359- switch (ppmt -> type ) {
2358+ switch (ppmt -> type ) {
23602359 case PMT_TYPE_RAW :
23612360 if (pmt_counter_get_width (ppmt ) <= 32 )
23622361 outp += sprintf (outp , "%s%10.10s" , (printed ++ ? delim : "" ), ppmt -> name );
@@ -2487,7 +2486,7 @@ void print_header(char *delim)
24872486
24882487 ppmt = sys .pmt_pp ;
24892488 while (ppmt ) {
2490- switch (ppmt -> type ) {
2489+ switch (ppmt -> type ) {
24912490 case PMT_TYPE_RAW :
24922491 if (pmt_counter_get_width (ppmt ) <= 32 )
24932492 outp += sprintf (outp , "%s%10.10s" , (printed ++ ? delim : "" ), ppmt -> name );
@@ -2969,7 +2968,8 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
29692968 outp += sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), 100.0 * p -> pc10 / tsc );
29702969
29712970 if (DO_BIC (BIC_Diec6 ))
2972- outp += sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), 100.0 * p -> die_c6 / crystal_hz / interval_float );
2971+ outp +=
2972+ sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), 100.0 * p -> die_c6 / crystal_hz / interval_float );
29732973
29742974 if (DO_BIC (BIC_CPU_LPI )) {
29752975 if (p -> cpu_lpi >= 0 )
@@ -4049,7 +4049,7 @@ static unsigned int read_perf_config(const char *subsys, const char *event_name)
40494049 goto next ;
40504050 }
40514051
4052- next :
4052+ next :
40534053 pconfig_str = strchr (pconfig_str , ',' );
40544054 if (pconfig_str ) {
40554055 * pconfig_str = '\0' ;
@@ -4463,9 +4463,9 @@ unsigned long pmt_gen_value_mask(unsigned int lsb, unsigned int msb)
44634463 if (msb == 63 )
44644464 mask = 0xffffffffffffffff ;
44654465 else
4466- mask = ((1 << (msb + 1 ))- 1 );
4466+ mask = ((1 << (msb + 1 )) - 1 );
44674467
4468- mask -= (1 << lsb )- 1 ;
4468+ mask -= (1 << lsb ) - 1 ;
44694469
44704470 return mask ;
44714471}
@@ -8636,7 +8636,7 @@ int added_perf_counters_init_(struct perf_counter_info *pinfo)
86368636
86378637 if (debug )
86388638 fprintf (stderr , "Add perf/%s/%s cpu%d: %d\n" ,
8639- pinfo -> device , pinfo -> event , cpu , pinfo -> fd_perf_per_domain [next_domain ]);
8639+ pinfo -> device , pinfo -> event , cpu , pinfo -> fd_perf_per_domain [next_domain ]);
86408640 }
86418641
86428642 pinfo = pinfo -> next ;
@@ -8687,7 +8687,7 @@ int parse_telem_info_file(int fd_dir, const char *info_filename, const char *for
86878687 return 0 ;
86888688}
86898689
8690- struct pmt_mmio * pmt_mmio_open (unsigned int target_guid )
8690+ struct pmt_mmio * pmt_mmio_open (unsigned int target_guid )
86918691{
86928692 DIR * dirp ;
86938693 struct dirent * entry ;
@@ -8793,7 +8793,7 @@ struct pmt_mmio* pmt_mmio_open(unsigned int target_guid)
87938793 return ret ;
87948794}
87958795
8796- struct pmt_mmio * pmt_mmio_find (unsigned int guid )
8796+ struct pmt_mmio * pmt_mmio_find (unsigned int guid )
87978797{
87988798 struct pmt_mmio * pmmio = pmt_mmios ;
87998799
@@ -8802,22 +8802,22 @@ struct pmt_mmio* pmt_mmio_find(unsigned int guid)
88028802 return pmmio ;
88038803
88048804 pmmio = pmmio -> next ;
8805- }
8805+ }
88068806
88078807 return NULL ;
88088808}
88098809
8810- void * pmt_get_counter_pointer (struct pmt_mmio * pmmio , unsigned long counter_offset )
8810+ void * pmt_get_counter_pointer (struct pmt_mmio * pmmio , unsigned long counter_offset )
88118811{
88128812 char * ret ;
88138813
88148814 /* Get base of mmaped PMT file. */
8815- ret = (char * )pmmio -> mmio_base ;
8815+ ret = (char * )pmmio -> mmio_base ;
88168816
88178817 /*
88188818 * Apply PMT MMIO offset to obtain beginning of the mmaped telemetry data.
88198819 * It's not guaranteed that the mmaped memory begins with the telemetry data
8820- * - we might have to apply the offset first.
8820+ * - we might have to apply the offset first.
88218821 */
88228822 ret += pmmio -> pmt_offset ;
88238823
@@ -8827,7 +8827,7 @@ void* pmt_get_counter_pointer(struct pmt_mmio *pmmio, unsigned long counter_offs
88278827 return ret ;
88288828}
88298829
8830- struct pmt_mmio * pmt_add_guid (unsigned int guid )
8830+ struct pmt_mmio * pmt_add_guid (unsigned int guid )
88318831{
88328832 struct pmt_mmio * ret ;
88338833
@@ -8843,7 +8843,7 @@ enum pmt_open_mode {
88438843 PMT_OPEN_REQUIRED , /* Open failure is a fatal error. */
88448844};
88458845
8846- struct pmt_counter * pmt_find_counter (struct pmt_counter * pcounter , const char * name )
8846+ struct pmt_counter * pmt_find_counter (struct pmt_counter * pcounter , const char * name )
88478847{
88488848 while (pcounter ) {
88498849 if (strcmp (pcounter -> name , name ) == 0 )
@@ -8855,9 +8855,9 @@ struct pmt_counter* pmt_find_counter(struct pmt_counter *pcounter, const char *n
88558855 return pcounter ;
88568856}
88578857
8858- struct pmt_counter * * pmt_get_scope_root (enum counter_scope scope )
8858+ struct pmt_counter * * pmt_get_scope_root (enum counter_scope scope )
88598859{
8860- switch (scope ) {
8860+ switch (scope ) {
88618861 case SCOPE_CPU :
88628862 return & sys .pmt_tp ;
88638863 case SCOPE_CORE :
@@ -8873,7 +8873,7 @@ void pmt_counter_add_domain(struct pmt_counter *pcounter, unsigned long *pmmio,
88738873{
88748874 /* Make sure the new domain fits. */
88758875 if (domain_id >= pcounter -> num_domains )
8876- pmt_counter_resize (pcounter , domain_id + 1 );
8876+ pmt_counter_resize (pcounter , domain_id + 1 );
88778877
88788878 assert (pcounter -> domains );
88798879 assert (domain_id < pcounter -> num_domains );
@@ -8882,12 +8882,12 @@ void pmt_counter_add_domain(struct pmt_counter *pcounter, unsigned long *pmmio,
88828882}
88838883
88848884int pmt_add_counter (unsigned int guid , const char * name , enum pmt_datatype type ,
8885- unsigned int lsb , unsigned int msb , unsigned int offset , enum counter_scope scope ,
8886- enum counter_format format , unsigned int domain_id , enum pmt_open_mode mode )
8885+ unsigned int lsb , unsigned int msb , unsigned int offset , enum counter_scope scope ,
8886+ enum counter_format format , unsigned int domain_id , enum pmt_open_mode mode )
88878887{
88888888 struct pmt_mmio * mmio ;
88898889 struct pmt_counter * pcounter ;
8890- struct pmt_counter * * const pmt_root = pmt_get_scope_root (scope );
8890+ struct pmt_counter * * const pmt_root = pmt_get_scope_root (scope );
88918891 bool new_counter = false;
88928892 int conflict = 0 ;
88938893
@@ -8927,7 +8927,7 @@ int pmt_add_counter(unsigned int guid, const char *name, enum pmt_datatype type,
89278927 }
89288928
89298929 if (new_counter ) {
8930- strncpy (pcounter -> name , name , ARRAY_SIZE (pcounter -> name )- 1 );
8930+ strncpy (pcounter -> name , name , ARRAY_SIZE (pcounter -> name ) - 1 );
89318931 pcounter -> type = type ;
89328932 pcounter -> scope = scope ;
89338933 pcounter -> lsb = lsb ;
@@ -9071,7 +9071,7 @@ int get_and_dump_counters(void)
90719071
90729072void print_version ()
90739073{
9074- fprintf (
outf ,
"turbostat version 2024.05.10 - Len Brown <[email protected] >\n" );
9074+ fprintf (
outf ,
"turbostat version 2024.07.26 - Len Brown <[email protected] >\n" );
90759075}
90769076
90779077#define COMMAND_LINE_SIZE 2048
@@ -9299,7 +9299,7 @@ int add_perf_counter(const char *perf_device, const char *perf_event, const char
92999299 // FIXME: we might not have debug here yet
93009300 if (debug )
93019301 fprintf (stderr , "%s: %s/%s, name: %s, scope%d\n" ,
9302- __func__ , pinfo -> device , pinfo -> event , pinfo -> name , pinfo -> scope );
9302+ __func__ , pinfo -> device , pinfo -> event , pinfo -> name , pinfo -> scope );
93039303
93049304 return 0 ;
93059305}
@@ -9450,10 +9450,10 @@ void parse_add_command_pmt(char *add_command)
94509450 bool has_offset = false;
94519451 bool has_lsb = false;
94529452 bool has_msb = false;
9453- bool has_format = true; /* Format has a default value. */
9453+ bool has_format = true; /* Format has a default value. */
94549454 bool has_guid = false;
94559455 bool has_scope = false;
9456- bool has_type = true; /* Type has a default value. */
9456+ bool has_type = true; /* Type has a default value. */
94579457
94589458 /* Consume the "pmt," prefix. */
94599459 add_command = strchr (add_command , ',' );
@@ -9490,7 +9490,7 @@ void parse_add_command_pmt(char *add_command)
94909490
94919491 if (!has_scope ) {
94929492 printf ("%s: invalid value for scope. Expected cpu%%u, core%%u or package%%u.\n" ,
9493- __func__ );
9493+ __func__ );
94949494 exit (1 );
94959495 }
94969496
@@ -9536,8 +9536,7 @@ void parse_add_command_pmt(char *add_command)
95369536 }
95379537
95389538 if (strlen (name ) >= PMT_COUNTER_NAME_SIZE_BYTES ) {
9539- printf ("%s: name has to be at most %d characters long\n" ,
9540- __func__ , PMT_COUNTER_NAME_SIZE_BYTES );
9539+ printf ("%s: name has to be at most %d characters long\n" , __func__ , PMT_COUNTER_NAME_SIZE_BYTES );
95419540 exit (1 );
95429541 }
95439542
0 commit comments