3
3
* turbostat -- show CPU frequency and C-state residency
4
4
* on modern Intel and AMD processors.
5
5
*
6
- * Copyright (c) 2024 Intel Corporation.
6
+ * Copyright (c) 2025 Intel Corporation.
7
7
8
8
*/
9
9
@@ -271,11 +271,11 @@ struct msr_counter bic[] = {
271
271
#define BIC_Sys_J (1ULL << 60)
272
272
#define BIC_NMI (1ULL << 61)
273
273
274
- #define BIC_TOPOLOGY (BIC_Package | BIC_Node | BIC_CoreCnt | BIC_PkgCnt | BIC_Core | BIC_CPU | BIC_Die )
275
- #define BIC_THERMAL_PWR ( BIC_CoreTmp | BIC_PkgTmp | BIC_PkgWatt | BIC_CorWatt | BIC_GFXWatt | BIC_RAMWatt | BIC_PKG__ | BIC_RAM__ | BIC_SysWatt)
274
+ #define BIC_TOPOLOGY (BIC_Package | BIC_Node | BIC_CoreCnt | BIC_PkgCnt | BIC_Core | BIC_CPU | BIC_Die)
275
+ #define BIC_THERMAL_PWR (BIC_CoreTmp | BIC_PkgTmp | BIC_PkgWatt | BIC_CorWatt | BIC_GFXWatt | BIC_RAMWatt | BIC_PKG__ | BIC_RAM__ | BIC_SysWatt)
276
276
#define BIC_FREQUENCY (BIC_Avg_MHz | BIC_Busy | BIC_Bzy_MHz | BIC_TSC_MHz | BIC_GFXMHz | BIC_GFXACTMHz | BIC_SAMMHz | BIC_SAMACTMHz | BIC_UNCORE_MHZ)
277
277
#define BIC_IDLE (BIC_Busy | BIC_sysfs | BIC_CPU_c1 | BIC_CPU_c3 | BIC_CPU_c6 | BIC_CPU_c7 | BIC_GFX_rc6 | BIC_Pkgpc2 | BIC_Pkgpc3 | BIC_Pkgpc6 | BIC_Pkgpc7 | BIC_Pkgpc8 | BIC_Pkgpc9 | BIC_Pkgpc10 | BIC_CPU_LPI | BIC_SYS_LPI | BIC_Mod_c6 | BIC_Totl_c0 | BIC_Any_c0 | BIC_GFX_c0 | BIC_CPUGFX | BIC_SAM_mc6 | BIC_Diec6)
278
- #define BIC_OTHER ( BIC_IRQ | BIC_NMI | BIC_SMI | BIC_ThreadC | BIC_CoreTmp | BIC_IPC)
278
+ #define BIC_OTHER (BIC_IRQ | BIC_NMI | BIC_SMI | BIC_ThreadC | BIC_CoreTmp | BIC_IPC)
279
279
280
280
#define BIC_DISABLED_BY_DEFAULT (BIC_USEC | BIC_TOD | BIC_APIC | BIC_X2APIC)
281
281
@@ -1593,8 +1593,7 @@ struct pmt_counter {
1593
1593
* PMT telemetry directory iterator.
1594
1594
* Used to iterate telemetry files in sysfs in correct order.
1595
1595
*/
1596
- struct pmt_diriter_t
1597
- {
1596
+ struct pmt_diriter_t {
1598
1597
DIR * dir ;
1599
1598
struct dirent * * namelist ;
1600
1599
unsigned int num_names ;
@@ -1604,6 +1603,7 @@ struct pmt_diriter_t
1604
1603
int pmt_telemdir_filter (const struct dirent * e )
1605
1604
{
1606
1605
unsigned int dummy ;
1606
+
1607
1607
return sscanf (e -> d_name , "telem%u" , & dummy );
1608
1608
}
1609
1609
@@ -1617,7 +1617,7 @@ int pmt_telemdir_sort(const struct dirent **a, const struct dirent **b)
1617
1617
return aidx >= bidx ;
1618
1618
}
1619
1619
1620
- const struct dirent * pmt_diriter_next (struct pmt_diriter_t * iter )
1620
+ const struct dirent * pmt_diriter_next (struct pmt_diriter_t * iter )
1621
1621
{
1622
1622
const struct dirent * ret = NULL ;
1623
1623
@@ -1633,7 +1633,7 @@ const struct dirent* pmt_diriter_next(struct pmt_diriter_t *iter)
1633
1633
return ret ;
1634
1634
}
1635
1635
1636
- const struct dirent * pmt_diriter_begin (struct pmt_diriter_t * iter , const char * pmt_root_path )
1636
+ const struct dirent * pmt_diriter_begin (struct pmt_diriter_t * iter , const char * pmt_root_path )
1637
1637
{
1638
1638
int num_names = iter -> num_names ;
1639
1639
@@ -2302,7 +2302,7 @@ void help(void)
2302
2302
" -h, --help\n"
2303
2303
" print this help message\n"
2304
2304
" -v, --version\n"
2305
- " print version information\n" "\n" "For more help, run \"man turbostat\"\n" );
2305
+ " print version information\n\nFor more help, run \"man turbostat\"\n" );
2306
2306
}
2307
2307
2308
2308
/*
@@ -9053,18 +9053,16 @@ struct pmt_mmio *pmt_mmio_open(unsigned int target_guid)
9053
9053
return NULL ;
9054
9054
}
9055
9055
9056
- for (; entry != NULL ; entry = pmt_diriter_next (& pmt_iter )) {
9057
- if (fstatat (dirfd (pmt_iter .dir ), entry -> d_name , & st , 0 ) == -1 ) {
9056
+ for ( ; entry != NULL ; entry = pmt_diriter_next (& pmt_iter )) {
9057
+ if (fstatat (dirfd (pmt_iter .dir ), entry -> d_name , & st , 0 ) == -1 )
9058
9058
break ;
9059
- }
9060
9059
9061
9060
if (!S_ISDIR (st .st_mode ))
9062
9061
continue ;
9063
9062
9064
9063
fd_telem_dir = openat (dirfd (pmt_iter .dir ), entry -> d_name , O_RDONLY );
9065
- if (fd_telem_dir == -1 ) {
9064
+ if (fd_telem_dir == -1 )
9066
9065
break ;
9067
- }
9068
9066
9069
9067
if (parse_telem_info_file (fd_telem_dir , "guid" , "%lx" , & guid )) {
9070
9068
close (fd_telem_dir );
@@ -9425,7 +9423,7 @@ int get_and_dump_counters(void)
9425
9423
9426
9424
void print_version ()
9427
9425
{
9428
- fprintf (
outf ,
"turbostat version 2024.11.30 - Len Brown <[email protected] >\n" );
9426
+ fprintf (
outf ,
"turbostat version 2025.01.14 - Len Brown <[email protected] >\n" );
9429
9427
}
9430
9428
9431
9429
#define COMMAND_LINE_SIZE 2048
@@ -9750,7 +9748,7 @@ void parse_add_command_msr(char *add_command)
9750
9748
9751
9749
}
9752
9750
if ((msr_num == 0 ) && (path == NULL ) && (perf_device [0 ] == '\0' || perf_event [0 ] == '\0' )) {
9753
- fprintf (stderr , "--add: (msrDDD | msr0xXXX | /path_to_counter | perf/device/event ) required\n" );
9751
+ fprintf (stderr , "--add: (msrDDD | msr0xXXX | /path_to_counter | perf/device/event) required\n" );
9754
9752
fail ++ ;
9755
9753
}
9756
9754
@@ -9822,9 +9820,8 @@ int pmt_parse_from_path(const char *target_path, unsigned int *out_guid, unsigne
9822
9820
dirname = pmt_diriter_next (& pmt_iter )) {
9823
9821
9824
9822
fd_telem_dir = openat (dirfd (pmt_iter .dir ), dirname -> d_name , O_RDONLY | O_DIRECTORY );
9825
- if (fd_telem_dir == -1 ) {
9823
+ if (fd_telem_dir == -1 )
9826
9824
continue ;
9827
- }
9828
9825
9829
9826
if (parse_telem_info_file (fd_telem_dir , "guid" , "%lx" , & guid )) {
9830
9827
fprintf (stderr , "%s: Failed to parse the guid file: %s" , __func__ , strerror (errno ));
@@ -9962,9 +9959,8 @@ void parse_add_command_pmt(char *add_command)
9962
9959
goto next ;
9963
9960
}
9964
9961
9965
- if (sscanf (add_command , "seq=%x" , & seq ) == 1 ) {
9962
+ if (sscanf (add_command , "seq=%x" , & seq ) == 1 )
9966
9963
goto next ;
9967
- }
9968
9964
9969
9965
if (strncmp (add_command , direct_path_prefix , strlen (direct_path_prefix )) == 0 ) {
9970
9966
direct_path = add_command + strlen (direct_path_prefix );
0 commit comments