@@ -1538,6 +1538,8 @@ static struct msr_counter_arch_info msr_counter_arch_infos[] = {
1538
1538
#define PMT_MTL_DC6_GUID 0x1a067102
1539
1539
#define PMT_MTL_DC6_SEQ 0
1540
1540
1541
+ unsigned long long tcore_clock_freq_hz = 800000000 ;
1542
+
1541
1543
#define PMT_COUNTER_NAME_SIZE_BYTES 16
1542
1544
#define PMT_COUNTER_TYPE_NAME_SIZE_BYTES 32
1543
1545
@@ -1560,6 +1562,7 @@ struct pmt_mmio {
1560
1562
enum pmt_datatype {
1561
1563
PMT_TYPE_RAW ,
1562
1564
PMT_TYPE_XTAL_TIME ,
1565
+ PMT_TYPE_TCORE_CLOCK ,
1563
1566
};
1564
1567
1565
1568
struct pmt_domain_info {
@@ -2474,6 +2477,7 @@ void print_header(char *delim)
2474
2477
break ;
2475
2478
2476
2479
case PMT_TYPE_XTAL_TIME :
2480
+ case PMT_TYPE_TCORE_CLOCK :
2477
2481
outp += sprintf (outp , "%s%s" , (printed ++ ? delim : "" ), ppmt -> name );
2478
2482
break ;
2479
2483
}
@@ -2548,6 +2552,7 @@ void print_header(char *delim)
2548
2552
break ;
2549
2553
2550
2554
case PMT_TYPE_XTAL_TIME :
2555
+ case PMT_TYPE_TCORE_CLOCK :
2551
2556
outp += sprintf (outp , "%s%s" , (printed ++ ? delim : "" ), ppmt -> name );
2552
2557
break ;
2553
2558
}
@@ -2679,6 +2684,7 @@ void print_header(char *delim)
2679
2684
break ;
2680
2685
2681
2686
case PMT_TYPE_XTAL_TIME :
2687
+ case PMT_TYPE_TCORE_CLOCK :
2682
2688
outp += sprintf (outp , "%s%s" , (printed ++ ? delim : "" ), ppmt -> name );
2683
2689
break ;
2684
2690
}
@@ -2997,7 +3003,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
2997
3003
2998
3004
for (i = 0 , ppmt = sys .pmt_tp ; ppmt ; i ++ , ppmt = ppmt -> next ) {
2999
3005
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 ;
3001
3007
switch (ppmt -> type ) {
3002
3008
case PMT_TYPE_RAW :
3003
3009
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
3009
3015
break ;
3010
3016
3011
3017
case PMT_TYPE_XTAL_TIME :
3018
+ value_converted = 100.0 * value_raw / crystal_hz / interval_float ;
3012
3019
outp += sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), value_converted );
3013
3020
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 );
3014
3025
}
3015
3026
}
3016
3027
@@ -3077,7 +3088,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
3077
3088
3078
3089
for (i = 0 , ppmt = sys .pmt_cp ; ppmt ; i ++ , ppmt = ppmt -> next ) {
3079
3090
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 ;
3081
3092
switch (ppmt -> type ) {
3082
3093
case PMT_TYPE_RAW :
3083
3094
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
3089
3100
break ;
3090
3101
3091
3102
case PMT_TYPE_XTAL_TIME :
3103
+ value_converted = 100.0 * value_raw / crystal_hz / interval_float ;
3092
3104
outp += sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), value_converted );
3093
3105
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 );
3094
3110
}
3095
3111
}
3096
3112
@@ -3275,7 +3291,7 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
3275
3291
3276
3292
for (i = 0 , ppmt = sys .pmt_pp ; ppmt ; i ++ , ppmt = ppmt -> next ) {
3277
3293
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 ;
3279
3295
switch (ppmt -> type ) {
3280
3296
case PMT_TYPE_RAW :
3281
3297
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
3287
3303
break ;
3288
3304
3289
3305
case PMT_TYPE_XTAL_TIME :
3306
+ value_converted = 100.0 * value_raw / crystal_hz / interval_float ;
3290
3307
outp += sprintf (outp , "%s%.2f" , (printed ++ ? delim : "" ), value_converted );
3291
3308
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 );
3292
3313
}
3293
3314
}
3294
3315
@@ -10016,6 +10037,11 @@ void parse_add_command_pmt(char *add_command)
10016
10037
has_type = true;
10017
10038
}
10018
10039
10040
+ if (strcmp ("tcore_clock" , type_name ) == 0 ) {
10041
+ type = PMT_TYPE_TCORE_CLOCK ;
10042
+ has_type = true;
10043
+ }
10044
+
10019
10045
if (!has_type ) {
10020
10046
printf ("%s: invalid %s: %s\n" , __func__ , "type" , type_name );
10021
10047
exit (1 );
0 commit comments