2020-03-09 02:17:53

by Jin Yao

[permalink] [raw]
Subject: [PATCH] perf/x86/pmu-events: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric

The kernel utilization metric does multiplexing currently and is somewhat
unreliable. The problem is that it uses two instances of the fixed counter,
and the kernel has to multipleplex which causes errors. So should use
CPU_CLK_UNHALTED.THREAD instead.

Before:

# perf stat -M Kernel_Utilization -- sleep 1

Performance counter stats for 'sleep 1':

1,419,425 cpu_clk_unhalted.ref_tsc:k
<not counted> cpu_clk_unhalted.ref_tsc (0.00%)

After:

# perf stat -M Kernel_Utilization -- sleep 1

Performance counter stats for 'sleep 1':

746,688 cpu_clk_unhalted.thread:k # 0.7 Kernel_Utilization
1,088,348 cpu_clk_unhalted.thread

Signed-off-by: Jin Yao <[email protected]>
---
tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json | 2 +-
12 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
index 45a34ce4fe89..8cdc7c13dc2a 100644
--- a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
@@ -297,7 +297,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
index 961fe4395758..16fd8a7490fc 100644
--- a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
@@ -115,7 +115,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
index 746734ce09be..1eb0415fa11a 100644
--- a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
@@ -297,7 +297,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
index f94653229dd4..a2c32db8f14e 100644
--- a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
@@ -315,7 +315,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
index 5402cd3120f9..f57c5f3506c2 100644
--- a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
@@ -267,7 +267,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
index 832f3cb40b34..311a005dc35b 100644
--- a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
@@ -267,7 +267,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
index d69b2a8fc0bc..28e25447d3ef 100644
--- a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
@@ -285,7 +285,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
index 5f465fd81315..db23db2e98be 100644
--- a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
@@ -285,7 +285,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
index 3e909b306003..dbb33e00b72a 100644
--- a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
@@ -171,7 +171,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
index 50c053235752..fb2d7b8875f8 100644
--- a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
@@ -171,7 +171,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
index e7feb60f9fa9..e3afc3178958 100644
--- a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
@@ -303,7 +303,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
index 21d7a0c2c2e8..12d1efba79bb 100644
--- a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
@@ -315,7 +315,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
--
2.17.1


2020-03-30 00:41:20

by Jin Yao

[permalink] [raw]
Subject: Re: [PATCH] perf/x86/pmu-events: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric

Hi,

Any comments for this patch?

Thanks
Jin Yao

On 3/9/2020 9:31 AM, Jin Yao wrote:
> The kernel utilization metric does multiplexing currently and is somewhat
> unreliable. The problem is that it uses two instances of the fixed counter,
> and the kernel has to multipleplex which causes errors. So should use
> CPU_CLK_UNHALTED.THREAD instead.
>
> Before:
>
> # perf stat -M Kernel_Utilization -- sleep 1
>
> Performance counter stats for 'sleep 1':
>
> 1,419,425 cpu_clk_unhalted.ref_tsc:k
> <not counted> cpu_clk_unhalted.ref_tsc (0.00%)
>
> After:
>
> # perf stat -M Kernel_Utilization -- sleep 1
>
> Performance counter stats for 'sleep 1':
>
> 746,688 cpu_clk_unhalted.thread:k # 0.7 Kernel_Utilization
> 1,088,348 cpu_clk_unhalted.thread
>
> Signed-off-by: Jin Yao <[email protected]>
> ---
> tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json | 2 +-
> 12 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> index 45a34ce4fe89..8cdc7c13dc2a 100644
> --- a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> @@ -297,7 +297,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> index 961fe4395758..16fd8a7490fc 100644
> --- a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> @@ -115,7 +115,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> index 746734ce09be..1eb0415fa11a 100644
> --- a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> @@ -297,7 +297,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> index f94653229dd4..a2c32db8f14e 100644
> --- a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> @@ -315,7 +315,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> index 5402cd3120f9..f57c5f3506c2 100644
> --- a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> @@ -267,7 +267,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> index 832f3cb40b34..311a005dc35b 100644
> --- a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> @@ -267,7 +267,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> index d69b2a8fc0bc..28e25447d3ef 100644
> --- a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> @@ -285,7 +285,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> index 5f465fd81315..db23db2e98be 100644
> --- a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> @@ -285,7 +285,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> index 3e909b306003..dbb33e00b72a 100644
> --- a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> @@ -171,7 +171,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> index 50c053235752..fb2d7b8875f8 100644
> --- a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> @@ -171,7 +171,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> index e7feb60f9fa9..e3afc3178958 100644
> --- a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> @@ -303,7 +303,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> index 21d7a0c2c2e8..12d1efba79bb 100644
> --- a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> @@ -315,7 +315,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
>

2020-03-31 19:10:00

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH] perf/x86/pmu-events: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric

Em Mon, Mar 30, 2020 at 08:38:29AM +0800, Jin, Yao escreveu:
> Hi,
>
> Any comments for this patch?

Can someone help Jin reviewing this x86 specific metric?

- Arnaldo

> Thanks
> Jin Yao
>
> On 3/9/2020 9:31 AM, Jin Yao wrote:
> > The kernel utilization metric does multiplexing currently and is somewhat
> > unreliable. The problem is that it uses two instances of the fixed counter,
> > and the kernel has to multipleplex which causes errors. So should use
> > CPU_CLK_UNHALTED.THREAD instead.
> >
> > Before:
> >
> > # perf stat -M Kernel_Utilization -- sleep 1
> >
> > Performance counter stats for 'sleep 1':
> >
> > 1,419,425 cpu_clk_unhalted.ref_tsc:k
> > <not counted> cpu_clk_unhalted.ref_tsc (0.00%)
> >
> > After:
> >
> > # perf stat -M Kernel_Utilization -- sleep 1
> >
> > Performance counter stats for 'sleep 1':
> >
> > 746,688 cpu_clk_unhalted.thread:k # 0.7 Kernel_Utilization
> > 1,088,348 cpu_clk_unhalted.thread
> >
> > Signed-off-by: Jin Yao <[email protected]>
> > ---
> > tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json | 2 +-
> > tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json | 2 +-
> > tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json | 2 +-
> > tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json | 2 +-
> > tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json | 2 +-
> > tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json | 2 +-
> > tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json | 2 +-
> > tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json | 2 +-
> > tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json | 2 +-
> > tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json | 2 +-
> > tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json | 2 +-
> > tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json | 2 +-
> > 12 files changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > index 45a34ce4fe89..8cdc7c13dc2a 100644
> > --- a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > @@ -297,7 +297,7 @@
> > },
> > {
> > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > "MetricGroup": "Summary",
> > "MetricName": "Kernel_Utilization"
> > },
> > diff --git a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> > index 961fe4395758..16fd8a7490fc 100644
> > --- a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> > @@ -115,7 +115,7 @@
> > },
> > {
> > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > "MetricGroup": "Summary",
> > "MetricName": "Kernel_Utilization"
> > },
> > diff --git a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> > index 746734ce09be..1eb0415fa11a 100644
> > --- a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> > @@ -297,7 +297,7 @@
> > },
> > {
> > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > "MetricGroup": "Summary",
> > "MetricName": "Kernel_Utilization"
> > },
> > diff --git a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> > index f94653229dd4..a2c32db8f14e 100644
> > --- a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> > @@ -315,7 +315,7 @@
> > },
> > {
> > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > "MetricGroup": "Summary",
> > "MetricName": "Kernel_Utilization"
> > },
> > diff --git a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> > index 5402cd3120f9..f57c5f3506c2 100644
> > --- a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> > @@ -267,7 +267,7 @@
> > },
> > {
> > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > "MetricGroup": "Summary",
> > "MetricName": "Kernel_Utilization"
> > },
> > diff --git a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> > index 832f3cb40b34..311a005dc35b 100644
> > --- a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> > @@ -267,7 +267,7 @@
> > },
> > {
> > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > "MetricGroup": "Summary",
> > "MetricName": "Kernel_Utilization"
> > },
> > diff --git a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> > index d69b2a8fc0bc..28e25447d3ef 100644
> > --- a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> > @@ -285,7 +285,7 @@
> > },
> > {
> > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > "MetricGroup": "Summary",
> > "MetricName": "Kernel_Utilization"
> > },
> > diff --git a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> > index 5f465fd81315..db23db2e98be 100644
> > --- a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> > @@ -285,7 +285,7 @@
> > },
> > {
> > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > "MetricGroup": "Summary",
> > "MetricName": "Kernel_Utilization"
> > },
> > diff --git a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> > index 3e909b306003..dbb33e00b72a 100644
> > --- a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> > @@ -171,7 +171,7 @@
> > },
> > {
> > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > "MetricGroup": "Summary",
> > "MetricName": "Kernel_Utilization"
> > },
> > diff --git a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> > index 50c053235752..fb2d7b8875f8 100644
> > --- a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> > @@ -171,7 +171,7 @@
> > },
> > {
> > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > "MetricGroup": "Summary",
> > "MetricName": "Kernel_Utilization"
> > },
> > diff --git a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> > index e7feb60f9fa9..e3afc3178958 100644
> > --- a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> > @@ -303,7 +303,7 @@
> > },
> > {
> > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > "MetricGroup": "Summary",
> > "MetricName": "Kernel_Utilization"
> > },
> > diff --git a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> > index 21d7a0c2c2e8..12d1efba79bb 100644
> > --- a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> > +++ b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> > @@ -315,7 +315,7 @@
> > },
> > {
> > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > "MetricGroup": "Summary",
> > "MetricName": "Kernel_Utilization"
> > },
> >

--

- Arnaldo

2020-03-31 19:31:51

by Liang, Kan

[permalink] [raw]
Subject: Re: [PATCH] perf/x86/pmu-events: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric



On 3/8/2020 9:31 PM, Jin Yao wrote:
> The kernel utilization metric does multiplexing currently and is somewhat
> unreliable. The problem is that it uses two instances of the fixed counter,
> and the kernel has to multipleplex which causes errors. So should use
> CPU_CLK_UNHALTED.THREAD instead.
>
> Before:
>
> # perf stat -M Kernel_Utilization -- sleep 1
>
> Performance counter stats for 'sleep 1':
>
> 1,419,425 cpu_clk_unhalted.ref_tsc:k
> <not counted> cpu_clk_unhalted.ref_tsc (0.00%)
>
> After:
>
> # perf stat -M Kernel_Utilization -- sleep 1
>
> Performance counter stats for 'sleep 1':
>
> 746,688 cpu_clk_unhalted.thread:k # 0.7 Kernel_Utilization
> 1,088,348 cpu_clk_unhalted.thread
>
> Signed-off-by: Jin Yao <[email protected]>


Reviewed-by: Kan Liang <[email protected]>

Thanks,
Kan

> ---
> tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json | 2 +-
> tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json | 2 +-
> 12 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> index 45a34ce4fe89..8cdc7c13dc2a 100644
> --- a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> @@ -297,7 +297,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> index 961fe4395758..16fd8a7490fc 100644
> --- a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> @@ -115,7 +115,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> index 746734ce09be..1eb0415fa11a 100644
> --- a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> @@ -297,7 +297,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> index f94653229dd4..a2c32db8f14e 100644
> --- a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> @@ -315,7 +315,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> index 5402cd3120f9..f57c5f3506c2 100644
> --- a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> @@ -267,7 +267,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> index 832f3cb40b34..311a005dc35b 100644
> --- a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> @@ -267,7 +267,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> index d69b2a8fc0bc..28e25447d3ef 100644
> --- a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> @@ -285,7 +285,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> index 5f465fd81315..db23db2e98be 100644
> --- a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> @@ -285,7 +285,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> index 3e909b306003..dbb33e00b72a 100644
> --- a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> @@ -171,7 +171,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> index 50c053235752..fb2d7b8875f8 100644
> --- a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> @@ -171,7 +171,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> index e7feb60f9fa9..e3afc3178958 100644
> --- a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> @@ -303,7 +303,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
> diff --git a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> index 21d7a0c2c2e8..12d1efba79bb 100644
> --- a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> +++ b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> @@ -315,7 +315,7 @@
> },
> {
> "BriefDescription": "Fraction of cycles spent in Kernel mode",
> - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> "MetricGroup": "Summary",
> "MetricName": "Kernel_Utilization"
> },
>

2020-03-31 19:35:08

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH] perf/x86/pmu-events: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric

Em Tue, Mar 31, 2020 at 03:30:25PM -0400, Liang, Kan escreveu:
>
>
> On 3/8/2020 9:31 PM, Jin Yao wrote:
> > The kernel utilization metric does multiplexing currently and is somewhat
> > unreliable. The problem is that it uses two instances of the fixed counter,
> > and the kernel has to multipleplex which causes errors. So should use
> > CPU_CLK_UNHALTED.THREAD instead.
> >
> > Before:
> >
> > # perf stat -M Kernel_Utilization -- sleep 1
> >
> > Performance counter stats for 'sleep 1':
> >
> > 1,419,425 cpu_clk_unhalted.ref_tsc:k
> > <not counted> cpu_clk_unhalted.ref_tsc (0.00%)
> >
> > After:
> >
> > # perf stat -M Kernel_Utilization -- sleep 1
> >
> > Performance counter stats for 'sleep 1':
> >
> > 746,688 cpu_clk_unhalted.thread:k # 0.7 Kernel_Utilization
> > 1,088,348 cpu_clk_unhalted.thread
> >
> > Signed-off-by: Jin Yao <[email protected]>
>
>
> Reviewed-by: Kan Liang <[email protected]>

Thanks, applied.

- Arnaldo

2020-03-31 20:04:50

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] perf/x86/pmu-events: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric

On Tue, Mar 31, 2020 at 04:08:04PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Mar 30, 2020 at 08:38:29AM +0800, Jin, Yao escreveu:
> > Hi,
> >
> > Any comments for this patch?
>
> Can someone help Jin reviewing this x86 specific metric?

Looks good to me.

Reviewed-by: Andi Kleen <[email protected]>
>
> - Arnaldo
>
> > Thanks
> > Jin Yao
> >
> > On 3/9/2020 9:31 AM, Jin Yao wrote:
> > > The kernel utilization metric does multiplexing currently and is somewhat
> > > unreliable. The problem is that it uses two instances of the fixed counter,
> > > and the kernel has to multipleplex which causes errors. So should use
> > > CPU_CLK_UNHALTED.THREAD instead.
> > >
> > > Before:
> > >
> > > # perf stat -M Kernel_Utilization -- sleep 1
> > >
> > > Performance counter stats for 'sleep 1':
> > >
> > > 1,419,425 cpu_clk_unhalted.ref_tsc:k
> > > <not counted> cpu_clk_unhalted.ref_tsc (0.00%)
> > >
> > > After:
> > >
> > > # perf stat -M Kernel_Utilization -- sleep 1
> > >
> > > Performance counter stats for 'sleep 1':
> > >
> > > 746,688 cpu_clk_unhalted.thread:k # 0.7 Kernel_Utilization
> > > 1,088,348 cpu_clk_unhalted.thread
> > >
> > > Signed-off-by: Jin Yao <[email protected]>
> > > ---
> > > tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json | 2 +-
> > > tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json | 2 +-
> > > tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json | 2 +-
> > > tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json | 2 +-
> > > tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json | 2 +-
> > > tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json | 2 +-
> > > tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json | 2 +-
> > > tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json | 2 +-
> > > tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json | 2 +-
> > > tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json | 2 +-
> > > tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json | 2 +-
> > > tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json | 2 +-
> > > 12 files changed, 12 insertions(+), 12 deletions(-)
> > >
> > > diff --git a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > > index 45a34ce4fe89..8cdc7c13dc2a 100644
> > > --- a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
> > > @@ -297,7 +297,7 @@
> > > },
> > > {
> > > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > > "MetricGroup": "Summary",
> > > "MetricName": "Kernel_Utilization"
> > > },
> > > diff --git a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> > > index 961fe4395758..16fd8a7490fc 100644
> > > --- a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
> > > @@ -115,7 +115,7 @@
> > > },
> > > {
> > > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > > "MetricGroup": "Summary",
> > > "MetricName": "Kernel_Utilization"
> > > },
> > > diff --git a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> > > index 746734ce09be..1eb0415fa11a 100644
> > > --- a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
> > > @@ -297,7 +297,7 @@
> > > },
> > > {
> > > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > > "MetricGroup": "Summary",
> > > "MetricName": "Kernel_Utilization"
> > > },
> > > diff --git a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> > > index f94653229dd4..a2c32db8f14e 100644
> > > --- a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> > > @@ -315,7 +315,7 @@
> > > },
> > > {
> > > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > > "MetricGroup": "Summary",
> > > "MetricName": "Kernel_Utilization"
> > > },
> > > diff --git a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> > > index 5402cd3120f9..f57c5f3506c2 100644
> > > --- a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
> > > @@ -267,7 +267,7 @@
> > > },
> > > {
> > > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > > "MetricGroup": "Summary",
> > > "MetricName": "Kernel_Utilization"
> > > },
> > > diff --git a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> > > index 832f3cb40b34..311a005dc35b 100644
> > > --- a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
> > > @@ -267,7 +267,7 @@
> > > },
> > > {
> > > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > > "MetricGroup": "Summary",
> > > "MetricName": "Kernel_Utilization"
> > > },
> > > diff --git a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> > > index d69b2a8fc0bc..28e25447d3ef 100644
> > > --- a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
> > > @@ -285,7 +285,7 @@
> > > },
> > > {
> > > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > > "MetricGroup": "Summary",
> > > "MetricName": "Kernel_Utilization"
> > > },
> > > diff --git a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> > > index 5f465fd81315..db23db2e98be 100644
> > > --- a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
> > > @@ -285,7 +285,7 @@
> > > },
> > > {
> > > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > > "MetricGroup": "Summary",
> > > "MetricName": "Kernel_Utilization"
> > > },
> > > diff --git a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> > > index 3e909b306003..dbb33e00b72a 100644
> > > --- a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
> > > @@ -171,7 +171,7 @@
> > > },
> > > {
> > > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > > "MetricGroup": "Summary",
> > > "MetricName": "Kernel_Utilization"
> > > },
> > > diff --git a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> > > index 50c053235752..fb2d7b8875f8 100644
> > > --- a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
> > > @@ -171,7 +171,7 @@
> > > },
> > > {
> > > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > > "MetricGroup": "Summary",
> > > "MetricName": "Kernel_Utilization"
> > > },
> > > diff --git a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> > > index e7feb60f9fa9..e3afc3178958 100644
> > > --- a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
> > > @@ -303,7 +303,7 @@
> > > },
> > > {
> > > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > > "MetricGroup": "Summary",
> > > "MetricName": "Kernel_Utilization"
> > > },
> > > diff --git a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> > > index 21d7a0c2c2e8..12d1efba79bb 100644
> > > --- a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> > > +++ b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> > > @@ -315,7 +315,7 @@
> > > },
> > > {
> > > "BriefDescription": "Fraction of cycles spent in Kernel mode",
> > > - "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
> > > + "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
> > > "MetricGroup": "Summary",
> > > "MetricName": "Kernel_Utilization"
> > > },
> > >
>
> --
>
> - Arnaldo

Subject: [tip: perf/urgent] perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID: 8ed1faf0156e569c46f1b3d59e74c9cbd5e557ff
Gitweb: https://git.kernel.org/tip/8ed1faf0156e569c46f1b3d59e74c9cbd5e557ff
Author: Jin Yao <[email protected]>
AuthorDate: Mon, 09 Mar 2020 09:31:25 +08:00
Committer: Arnaldo Carvalho de Melo <[email protected]>
CommitterDate: Fri, 03 Apr 2020 09:37:56 -03:00

perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric

The kernel utilization metric does multiplexing currently and is somewhat
unreliable. The problem is that it uses two instances of the fixed counter,
and the kernel has to multipleplex which causes errors. So should use
CPU_CLK_UNHALTED.THREAD instead.

Before:

# perf stat -M Kernel_Utilization -- sleep 1

Performance counter stats for 'sleep 1':

1,419,425 cpu_clk_unhalted.ref_tsc:k
<not counted> cpu_clk_unhalted.ref_tsc (0.00%)

After:

# perf stat -M Kernel_Utilization -- sleep 1

Performance counter stats for 'sleep 1':

746,688 cpu_clk_unhalted.thread:k # 0.7 Kernel_Utilization
1,088,348 cpu_clk_unhalted.thread

Signed-off-by: Jin Yao <[email protected]>
Reviewed-by: Andi Kleen <[email protected]>
Reviewed-by: Kan Liang <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Jin Yao <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json | 2 +-
tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json | 2 +-
12 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
index 45a34ce..8cdc7c1 100644
--- a/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json
@@ -297,7 +297,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
index 961fe43..16fd8a7 100644
--- a/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json
@@ -115,7 +115,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
index 746734c..1eb0415 100644
--- a/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json
@@ -297,7 +297,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
index a728c6e..7fde0d2 100644
--- a/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
@@ -316,7 +316,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
index 5402cd3..f57c5f3 100644
--- a/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json
@@ -267,7 +267,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
index 832f3cb..311a005 100644
--- a/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json
@@ -267,7 +267,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
index d69b2a8..28e2544 100644
--- a/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json
@@ -285,7 +285,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
index 5f465fd..db23db2 100644
--- a/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json
@@ -285,7 +285,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
index 3e909b3..dbb33e0 100644
--- a/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json
@@ -171,7 +171,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
index 50c0532..fb2d7b8 100644
--- a/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json
@@ -171,7 +171,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
index f97e831..8704efe 100644
--- a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json
@@ -304,7 +304,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},
diff --git a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
index 35f5db1..b4f9113 100644
--- a/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
+++ b/tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
@@ -316,7 +316,7 @@
},
{
"BriefDescription": "Fraction of cycles spent in Kernel mode",
- "MetricExpr": "CPU_CLK_UNHALTED.REF_TSC:k / CPU_CLK_UNHALTED.REF_TSC",
+ "MetricExpr": "CPU_CLK_UNHALTED.THREAD:k / CPU_CLK_UNHALTED.THREAD",
"MetricGroup": "Summary",
"MetricName": "Kernel_Utilization"
},