perf tools metric: Don't include duration_time in group

The Memory_BW metric generates groups including duration_time, which
maps to a software event.

For some reason this makes the group always not count.

Always put duration_time outside a group when generating metrics.  It's
always the same time, so no need to group it.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20190628220737.13259-3-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Andi Kleen 2019-06-28 15:07:37 -07:00 committed by Arnaldo Carvalho de Melo
parent 9c344d15f5
commit 488c3bf7ec
1 changed files with 17 additions and 2 deletions

View File

@ -409,6 +409,7 @@ static int metricgroup__add_metric(const char *metric, struct strbuf *events,
const char **ids; const char **ids;
int idnum; int idnum;
struct egroup *eg; struct egroup *eg;
bool no_group = false;
pr_debug("metric expr %s for %s\n", pe->metric_expr, pe->metric_name); pr_debug("metric expr %s for %s\n", pe->metric_expr, pe->metric_name);
@ -419,10 +420,24 @@ static int metricgroup__add_metric(const char *metric, struct strbuf *events,
strbuf_addf(events, ","); strbuf_addf(events, ",");
for (j = 0; j < idnum; j++) { for (j = 0; j < idnum; j++) {
pr_debug("found event %s\n", ids[j]); pr_debug("found event %s\n", ids[j]);
strbuf_addf(events, "%s%s", /*
j == 0 ? "{" : ",", * Duration time maps to a software event and can make
ids[j]); * groups not count. Always use it outside a
* group.
*/
if (!strcmp(ids[j], "duration_time")) {
if (j > 0)
strbuf_addf(events, "}:W,");
strbuf_addf(events, "duration_time");
no_group = true;
continue;
} }
strbuf_addf(events, "%s%s",
j == 0 || no_group ? "{" : ",",
ids[j]);
no_group = false;
}
if (!no_group)
strbuf_addf(events, "}:W"); strbuf_addf(events, "}:W");
eg = malloc(sizeof(struct egroup)); eg = malloc(sizeof(struct egroup));