* [PATCH] perf, tools: Fix adding multiple event groups
@ 2017-09-14 20:57 Andi Kleen
2017-09-18 6:58 ` Jiri Olsa
2017-09-22 16:44 ` [tip:perf/core] perf stat: " tip-bot for Andi Kleen
0 siblings, 2 replies; 3+ messages in thread
From: Andi Kleen @ 2017-09-14 20:57 UTC (permalink / raw)
To: acme; +Cc: jolsa, linux-kernel, Andi Kleen
From: Andi Kleen <ak@linux.intel.com>
The -M metric group parser threw away the events of earlier
groups when multiple groups were specified. Fix this here
by not overwriting the string incorrectly.
Now this works correctly:
% perf stat -M Summary,SMT --metric-only -a sleep 1
Performance counter stats for 'system wide':
Instructions CPI CLKS CPU_Utilization GFLOPs SMT_2T_Utilization SMT_2T_Utilization Kernel_Utilization CoreIPC CORE_CLKS
900907376.0 2.7 2398954144.0 0.1 0.0 0.2 0.2 0.1 0.4 2080822855.5
while previously it would only show the SMT metrics.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
tools/perf/util/metricgroup.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 0794f02cbb8f..ce18474adc12 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -373,9 +373,6 @@ static int metricgroup__add_metric(const char *metric, struct strbuf *events,
int ret = -EINVAL;
int i, j;
- strbuf_init(events, 100);
- strbuf_addf(events, "%s", "");
-
if (!map)
return 0;
@@ -433,6 +430,10 @@ static int metricgroup__add_metric_list(const char *list, struct strbuf *events,
if (!nlist)
return -ENOMEM;
llist = nlist;
+
+ strbuf_init(events, 100);
+ strbuf_addf(events, "%s", "");
+
while ((p = strsep(&llist, ",")) != NULL) {
ret = metricgroup__add_metric(p, events, group_list);
if (ret == -EINVAL) {
--
2.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf, tools: Fix adding multiple event groups
2017-09-14 20:57 [PATCH] perf, tools: Fix adding multiple event groups Andi Kleen
@ 2017-09-18 6:58 ` Jiri Olsa
2017-09-22 16:44 ` [tip:perf/core] perf stat: " tip-bot for Andi Kleen
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2017-09-18 6:58 UTC (permalink / raw)
To: Andi Kleen; +Cc: acme, jolsa, linux-kernel, Andi Kleen
On Thu, Sep 14, 2017 at 01:57:35PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> The -M metric group parser threw away the events of earlier
> groups when multiple groups were specified. Fix this here
> by not overwriting the string incorrectly.
>
> Now this works correctly:
>
> % perf stat -M Summary,SMT --metric-only -a sleep 1
>
> Performance counter stats for 'system wide':
>
> Instructions CPI CLKS CPU_Utilization GFLOPs SMT_2T_Utilization SMT_2T_Utilization Kernel_Utilization CoreIPC CORE_CLKS
> 900907376.0 2.7 2398954144.0 0.1 0.0 0.2 0.2 0.1 0.4 2080822855.5
>
> while previously it would only show the SMT metrics.
>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/core] perf stat: Fix adding multiple event groups
2017-09-14 20:57 [PATCH] perf, tools: Fix adding multiple event groups Andi Kleen
2017-09-18 6:58 ` Jiri Olsa
@ 2017-09-22 16:44 ` tip-bot for Andi Kleen
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Andi Kleen @ 2017-09-22 16:44 UTC (permalink / raw)
To: linux-tip-commits; +Cc: mingo, hpa, linux-kernel, acme, ak, jolsa, tglx
Commit-ID: 411bc316f3365363959c2c895af2618389534583
Gitweb: http://git.kernel.org/tip/411bc316f3365363959c2c895af2618389534583
Author: Andi Kleen <ak@linux.intel.com>
AuthorDate: Thu, 14 Sep 2017 13:57:35 -0700
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 21 Sep 2017 13:12:58 -0300
perf stat: Fix adding multiple event groups
The -M metric group parser threw away the events of earlier groups when
multiple groups were specified. Fix this here by not overwriting the
string incorrectly.
Now this works correctly:
% perf stat -M Summary,SMT --metric-only -a sleep 1
Performance counter stats for 'system wide':
Instructions CPI CLKS CPU_Utilization GFLOPs SMT_2T_Utilization SMT_2T_Utilization Kernel_Utilization CoreIPC CORE_CLKS
900907376.0 2.7 2398954144.0 0.1 0.0 0.2 0.2 0.1 0.4 2080822855.5
while previously it would only show the SMT metrics.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20170914205735.18431-1-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/metricgroup.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index fa37ef7..0ddd9c1 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -373,9 +373,6 @@ static int metricgroup__add_metric(const char *metric, struct strbuf *events,
int ret = -EINVAL;
int i, j;
- strbuf_init(events, 100);
- strbuf_addf(events, "%s", "");
-
if (!map)
return 0;
@@ -433,6 +430,10 @@ static int metricgroup__add_metric_list(const char *list, struct strbuf *events,
if (!nlist)
return -ENOMEM;
llist = nlist;
+
+ strbuf_init(events, 100);
+ strbuf_addf(events, "%s", "");
+
while ((p = strsep(&llist, ",")) != NULL) {
ret = metricgroup__add_metric(p, events, group_list);
if (ret == -EINVAL) {
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-22 16:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-14 20:57 [PATCH] perf, tools: Fix adding multiple event groups Andi Kleen
2017-09-18 6:58 ` Jiri Olsa
2017-09-22 16:44 ` [tip:perf/core] perf stat: " tip-bot for Andi Kleen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.