@@ -1538,6 +1538,8 @@ static struct msr_counter_arch_info msr_counter_arch_infos[] = {
15381538#define PMT_MTL_DC6_GUID 0x1a067102
15391539#define PMT_MTL_DC6_SEQ 0
15401540
1541+ unsigned long long tcore_clock_freq_hz = 800000000 ;
1542+
15411543#define PMT_COUNTER_NAME_SIZE_BYTES 16
15421544#define PMT_COUNTER_TYPE_NAME_SIZE_BYTES 32
15431545
@@ -1560,6 +1562,7 @@ struct pmt_mmio {
15601562enum pmt_datatype {
15611563 PMT_TYPE_RAW ,
15621564 PMT_TYPE_XTAL_TIME ,
1565+ PMT_TYPE_TCORE_CLOCK ,
15631566};
15641567
15651568struct pmt_domain_info {
@@ -2474,6 +2477,7 @@ void print_header(char *delim)
24742477 break ;
24752478
24762479 case PMT_TYPE_XTAL_TIME :
2480+ case PMT_TYPE_TCORE_CLOCK :
24772481 outp += sprintf (outp , "%s%s" , (printed ++ ? delim : "" ), ppmt -> name );
24782482 break ;
24792483 }
@@ -2548,6 +2552,7 @@ void print_header(char *delim)
25482552 break ;
25492553
25502554 case PMT_TYPE_XTAL_TIME :
2555+ case PMT_TYPE_TCORE_CLOCK :
25512556 outp += sprintf (outp , "%s%s" , (printed ++ ? delim : "" ), ppmt -> name );
25522557 break ;
25532558 }
@@ -2679,6 +2684,7 @@ void print_header(char *delim)
26792684 break ;
26802685
26812686 case PMT_TYPE_XTAL_TIME :
2687+ case PMT_TYPE_TCORE_CLOCK :
26822688 outp += sprintf (outp , "%s%s" , (printed ++ ? delim : "" ), ppmt -> name );
26832689 break ;
26842690 }
@@ -2997,7 +3003,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
29973003
29983004 for (i = 0 , ppmt = sys .pmt_tp ; ppmt ; i ++ , ppmt = ppmt -> next ) {
29993005 const unsigned long value_raw = t -> pmt_counter [i ];
3000- const double value_converted = 100.0 * value_raw / crystal_hz / interval_float ;
3006+ double value_converted ;
30013007 switch (ppmt -> type ) {
30023008 case PMT_TYPE_RAW :
30033009 if (pmt_counter_get_width (ppmt ) <= 32 )
@@ -3009,8 +3015,13 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
30093015 break ;
30103016
30113017 case PMT_TYPE_XTAL_TIME :
3018+ value_converted = 100.0 * value_raw / crystal_hz / interval_float ;
30123019 outp += sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), value_converted );
30133020 break ;
3021+
3022+ case PMT_TYPE_TCORE_CLOCK :
3023+ value_converted = 100.0 * value_raw / tcore_clock_freq_hz / interval_float ;
3024+ outp += sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), value_converted );
30143025 }
30153026 }
30163027
@@ -3077,7 +3088,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
30773088
30783089 for (i = 0 , ppmt = sys .pmt_cp ; ppmt ; i ++ , ppmt = ppmt -> next ) {
30793090 const unsigned long value_raw = c -> pmt_counter [i ];
3080- const double value_converted = 100.0 * value_raw / crystal_hz / interval_float ;
3091+ double value_converted ;
30813092 switch (ppmt -> type ) {
30823093 case PMT_TYPE_RAW :
30833094 if (pmt_counter_get_width (ppmt ) <= 32 )
@@ -3089,8 +3100,13 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
30893100 break ;
30903101
30913102 case PMT_TYPE_XTAL_TIME :
3103+ value_converted = 100.0 * value_raw / crystal_hz / interval_float ;
30923104 outp += sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), value_converted );
30933105 break ;
3106+
3107+ case PMT_TYPE_TCORE_CLOCK :
3108+ value_converted = 100.0 * value_raw / tcore_clock_freq_hz / interval_float ;
3109+ outp += sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), value_converted );
30943110 }
30953111 }
30963112
@@ -3275,7 +3291,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
32753291
32763292 for (i = 0 , ppmt = sys .pmt_pp ; ppmt ; i ++ , ppmt = ppmt -> next ) {
32773293 const unsigned long value_raw = p -> pmt_counter [i ];
3278- const double value_converted = 100.0 * value_raw / crystal_hz / interval_float ;
3294+ double value_converted ;
32793295 switch (ppmt -> type ) {
32803296 case PMT_TYPE_RAW :
32813297 if (pmt_counter_get_width (ppmt ) <= 32 )
@@ -3287,8 +3303,13 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
32873303 break ;
32883304
32893305 case PMT_TYPE_XTAL_TIME :
3306+ value_converted = 100.0 * value_raw / crystal_hz / interval_float ;
32903307 outp += sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), value_converted );
32913308 break ;
3309+
3310+ case PMT_TYPE_TCORE_CLOCK :
3311+ value_converted = 100.0 * value_raw / tcore_clock_freq_hz / interval_float ;
3312+ outp += sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), value_converted );
32923313 }
32933314 }
32943315
@@ -10016,6 +10037,11 @@ void parse_add_command_pmt(char *add_command)
1001610037 has_type = true;
1001710038 }
1001810039
10040+ if (strcmp ("tcore_clock" , type_name ) == 0 ) {
10041+ type = PMT_TYPE_TCORE_CLOCK ;
10042+ has_type = true;
10043+ }
10044+
1001910045 if (!has_type ) {
1002010046 printf ("%s: invalid %s: %s\n" , __func__ , "type" , type_name );
1002110047 exit (1 );
0 commit comments