@@ -1057,8 +1057,7 @@ void probe_platform_features(unsigned int family, unsigned int model)
1057
1057
return ;
1058
1058
1059
1059
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 ) {
1062
1061
platform = turbostat_pdata [i ].features ;
1063
1062
return ;
1064
1063
}
@@ -1448,28 +1447,28 @@ enum msr_arch_info_index {
1448
1447
1449
1448
static struct msr_counter_arch_info msr_counter_arch_infos [] = {
1450
1449
[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
+ },
1457
1456
1458
1457
[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
+ },
1465
1464
1466
1465
[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
+ },
1473
1472
};
1474
1473
1475
1474
/* Can be redefined when compiling, useful for testing. */
@@ -1535,14 +1534,14 @@ struct pmt_counter {
1535
1534
1536
1535
unsigned int pmt_counter_get_width (const struct pmt_counter * p )
1537
1536
{
1538
- return (p -> msb - p -> lsb )+ 1 ;
1537
+ return (p -> msb - p -> lsb ) + 1 ;
1539
1538
}
1540
1539
1541
1540
void pmt_counter_resize_ (struct pmt_counter * pcounter , unsigned int new_size )
1542
1541
{
1543
1542
struct pmt_domain_info * new_mem ;
1544
1543
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 ));
1546
1545
if (!new_mem ) {
1547
1546
fprintf (stderr , "%s: failed to allocate memory for PMT counters\n" , __func__ );
1548
1547
exit (1 );
@@ -1567,7 +1566,7 @@ void pmt_counter_resize(struct pmt_counter *pcounter, unsigned int new_size)
1567
1566
*/
1568
1567
if (new_size < 8 )
1569
1568
new_size = 8 ;
1570
- new_size = MAX (new_size , pcounter -> num_domains * 2 );
1569
+ new_size = MAX (new_size , pcounter -> num_domains * 2 );
1571
1570
1572
1571
pmt_counter_resize_ (pcounter , new_size );
1573
1572
}
@@ -2282,7 +2281,7 @@ void print_header(char *delim)
2282
2281
2283
2282
ppmt = sys .pmt_tp ;
2284
2283
while (ppmt ) {
2285
- switch (ppmt -> type ) {
2284
+ switch (ppmt -> type ) {
2286
2285
case PMT_TYPE_RAW :
2287
2286
if (pmt_counter_get_width (ppmt ) <= 32 )
2288
2287
outp += sprintf (outp , "%s%10.10s" , (printed ++ ? delim : "" ), ppmt -> name );
@@ -2356,7 +2355,7 @@ void print_header(char *delim)
2356
2355
2357
2356
ppmt = sys .pmt_cp ;
2358
2357
while (ppmt ) {
2359
- switch (ppmt -> type ) {
2358
+ switch (ppmt -> type ) {
2360
2359
case PMT_TYPE_RAW :
2361
2360
if (pmt_counter_get_width (ppmt ) <= 32 )
2362
2361
outp += sprintf (outp , "%s%10.10s" , (printed ++ ? delim : "" ), ppmt -> name );
@@ -2487,7 +2486,7 @@ void print_header(char *delim)
2487
2486
2488
2487
ppmt = sys .pmt_pp ;
2489
2488
while (ppmt ) {
2490
- switch (ppmt -> type ) {
2489
+ switch (ppmt -> type ) {
2491
2490
case PMT_TYPE_RAW :
2492
2491
if (pmt_counter_get_width (ppmt ) <= 32 )
2493
2492
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
2969
2968
outp += sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), 100.0 * p -> pc10 / tsc );
2970
2969
2971
2970
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 );
2973
2973
2974
2974
if (DO_BIC (BIC_CPU_LPI )) {
2975
2975
if (p -> cpu_lpi >= 0 )
@@ -4049,7 +4049,7 @@ static unsigned int read_perf_config(const char *subsys, const char *event_name)
4049
4049
goto next ;
4050
4050
}
4051
4051
4052
- next :
4052
+ next :
4053
4053
pconfig_str = strchr (pconfig_str , ',' );
4054
4054
if (pconfig_str ) {
4055
4055
* pconfig_str = '\0' ;
@@ -4463,9 +4463,9 @@ unsigned long pmt_gen_value_mask(unsigned int lsb, unsigned int msb)
4463
4463
if (msb == 63 )
4464
4464
mask = 0xffffffffffffffff ;
4465
4465
else
4466
- mask = ((1 << (msb + 1 ))- 1 );
4466
+ mask = ((1 << (msb + 1 )) - 1 );
4467
4467
4468
- mask -= (1 << lsb )- 1 ;
4468
+ mask -= (1 << lsb ) - 1 ;
4469
4469
4470
4470
return mask ;
4471
4471
}
@@ -8636,7 +8636,7 @@ int added_perf_counters_init_(struct perf_counter_info *pinfo)
8636
8636
8637
8637
if (debug )
8638
8638
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 ]);
8640
8640
}
8641
8641
8642
8642
pinfo = pinfo -> next ;
@@ -8687,7 +8687,7 @@ int parse_telem_info_file(int fd_dir, const char *info_filename, const char *for
8687
8687
return 0 ;
8688
8688
}
8689
8689
8690
- struct pmt_mmio * pmt_mmio_open (unsigned int target_guid )
8690
+ struct pmt_mmio * pmt_mmio_open (unsigned int target_guid )
8691
8691
{
8692
8692
DIR * dirp ;
8693
8693
struct dirent * entry ;
@@ -8793,7 +8793,7 @@ struct pmt_mmio* pmt_mmio_open(unsigned int target_guid)
8793
8793
return ret ;
8794
8794
}
8795
8795
8796
- struct pmt_mmio * pmt_mmio_find (unsigned int guid )
8796
+ struct pmt_mmio * pmt_mmio_find (unsigned int guid )
8797
8797
{
8798
8798
struct pmt_mmio * pmmio = pmt_mmios ;
8799
8799
@@ -8802,22 +8802,22 @@ struct pmt_mmio* pmt_mmio_find(unsigned int guid)
8802
8802
return pmmio ;
8803
8803
8804
8804
pmmio = pmmio -> next ;
8805
- }
8805
+ }
8806
8806
8807
8807
return NULL ;
8808
8808
}
8809
8809
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 )
8811
8811
{
8812
8812
char * ret ;
8813
8813
8814
8814
/* Get base of mmaped PMT file. */
8815
- ret = (char * )pmmio -> mmio_base ;
8815
+ ret = (char * )pmmio -> mmio_base ;
8816
8816
8817
8817
/*
8818
8818
* Apply PMT MMIO offset to obtain beginning of the mmaped telemetry data.
8819
8819
* 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.
8821
8821
*/
8822
8822
ret += pmmio -> pmt_offset ;
8823
8823
@@ -8827,7 +8827,7 @@ void* pmt_get_counter_pointer(struct pmt_mmio *pmmio, unsigned long counter_offs
8827
8827
return ret ;
8828
8828
}
8829
8829
8830
- struct pmt_mmio * pmt_add_guid (unsigned int guid )
8830
+ struct pmt_mmio * pmt_add_guid (unsigned int guid )
8831
8831
{
8832
8832
struct pmt_mmio * ret ;
8833
8833
@@ -8843,7 +8843,7 @@ enum pmt_open_mode {
8843
8843
PMT_OPEN_REQUIRED , /* Open failure is a fatal error. */
8844
8844
};
8845
8845
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 )
8847
8847
{
8848
8848
while (pcounter ) {
8849
8849
if (strcmp (pcounter -> name , name ) == 0 )
@@ -8855,9 +8855,9 @@ struct pmt_counter* pmt_find_counter(struct pmt_counter *pcounter, const char *n
8855
8855
return pcounter ;
8856
8856
}
8857
8857
8858
- struct pmt_counter * * pmt_get_scope_root (enum counter_scope scope )
8858
+ struct pmt_counter * * pmt_get_scope_root (enum counter_scope scope )
8859
8859
{
8860
- switch (scope ) {
8860
+ switch (scope ) {
8861
8861
case SCOPE_CPU :
8862
8862
return & sys .pmt_tp ;
8863
8863
case SCOPE_CORE :
@@ -8873,7 +8873,7 @@ void pmt_counter_add_domain(struct pmt_counter *pcounter, unsigned long *pmmio,
8873
8873
{
8874
8874
/* Make sure the new domain fits. */
8875
8875
if (domain_id >= pcounter -> num_domains )
8876
- pmt_counter_resize (pcounter , domain_id + 1 );
8876
+ pmt_counter_resize (pcounter , domain_id + 1 );
8877
8877
8878
8878
assert (pcounter -> domains );
8879
8879
assert (domain_id < pcounter -> num_domains );
@@ -8882,12 +8882,12 @@ void pmt_counter_add_domain(struct pmt_counter *pcounter, unsigned long *pmmio,
8882
8882
}
8883
8883
8884
8884
int 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 )
8887
8887
{
8888
8888
struct pmt_mmio * mmio ;
8889
8889
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 );
8891
8891
bool new_counter = false;
8892
8892
int conflict = 0 ;
8893
8893
@@ -8927,7 +8927,7 @@ int pmt_add_counter(unsigned int guid, const char *name, enum pmt_datatype type,
8927
8927
}
8928
8928
8929
8929
if (new_counter ) {
8930
- strncpy (pcounter -> name , name , ARRAY_SIZE (pcounter -> name )- 1 );
8930
+ strncpy (pcounter -> name , name , ARRAY_SIZE (pcounter -> name ) - 1 );
8931
8931
pcounter -> type = type ;
8932
8932
pcounter -> scope = scope ;
8933
8933
pcounter -> lsb = lsb ;
@@ -9071,7 +9071,7 @@ int get_and_dump_counters(void)
9071
9071
9072
9072
void print_version ()
9073
9073
{
9074
- fprintf (outf , "turbostat version 2024.05.10 - Len Brown <lenb@kernel.org>\n" );
9074
+ fprintf (outf , "turbostat version 2024.07.26 - Len Brown <lenb@kernel.org>\n" );
9075
9075
}
9076
9076
9077
9077
#define COMMAND_LINE_SIZE 2048
@@ -9299,7 +9299,7 @@ int add_perf_counter(const char *perf_device, const char *perf_event, const char
9299
9299
// FIXME: we might not have debug here yet
9300
9300
if (debug )
9301
9301
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 );
9303
9303
9304
9304
return 0 ;
9305
9305
}
@@ -9450,10 +9450,10 @@ void parse_add_command_pmt(char *add_command)
9450
9450
bool has_offset = false;
9451
9451
bool has_lsb = false;
9452
9452
bool has_msb = false;
9453
- bool has_format = true; /* Format has a default value. */
9453
+ bool has_format = true; /* Format has a default value. */
9454
9454
bool has_guid = false;
9455
9455
bool has_scope = false;
9456
- bool has_type = true; /* Type has a default value. */
9456
+ bool has_type = true; /* Type has a default value. */
9457
9457
9458
9458
/* Consume the "pmt," prefix. */
9459
9459
add_command = strchr (add_command , ',' );
@@ -9490,7 +9490,7 @@ void parse_add_command_pmt(char *add_command)
9490
9490
9491
9491
if (!has_scope ) {
9492
9492
printf ("%s: invalid value for scope. Expected cpu%%u, core%%u or package%%u.\n" ,
9493
- __func__ );
9493
+ __func__ );
9494
9494
exit (1 );
9495
9495
}
9496
9496
@@ -9536,8 +9536,7 @@ void parse_add_command_pmt(char *add_command)
9536
9536
}
9537
9537
9538
9538
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 );
9541
9540
exit (1 );
9542
9541
}
9543
9542
0 commit comments