aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Rogers <[email protected]>2020-05-20 11:20:05 -0700
committerArnaldo Carvalho de Melo <[email protected]>2020-05-28 10:03:28 -0300
commit4e21c13aca38b69c4470b68ef29d198802e7d74e (patch)
tree539a416132d3a876fdfa9dae18b11663860e3213
parenta159e2fe89b4d1f9fb54b0ae418b961e239bf617 (diff)
perf metricgroup: Always place duration_time last
If a metric contains the duration_time event then the event is placed outside of the metric's group of events. Rather than split the group, make it so the duration_time is immediately after the group. Signed-off-by: Ian Rogers <[email protected]> Acked-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Cong Wang <[email protected]> Cc: Jin Yao <[email protected]> Cc: John Garry <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Kim Phillips <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Song Liu <[email protected]> Cc: Srikar Dronamraju <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Vince Weaver <[email protected]> Cc: [email protected] Cc: [email protected] Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/util/metricgroup.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 381a619a80b9..0798658592d9 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -413,8 +413,8 @@ static void metricgroup__add_metric_weak_group(struct strbuf *events,
struct expr_parse_ctx *ctx)
{
struct hashmap_entry *cur;
- size_t bkt, i = 0;
- bool no_group = false;
+ size_t bkt;
+ bool no_group = true, has_duration = false;
hashmap__for_each_entry((&ctx->ids), cur, bkt) {
pr_debug("found event %s\n", (const char *)cur->key);
@@ -424,20 +424,20 @@ static void metricgroup__add_metric_weak_group(struct strbuf *events,
* group.
*/
if (!strcmp(cur->key, "duration_time")) {
- if (i > 0)
- strbuf_addf(events, "}:W,");
- strbuf_addf(events, "duration_time");
- no_group = true;
+ has_duration = true;
continue;
}
strbuf_addf(events, "%s%s",
- i == 0 || no_group ? "{" : ",",
+ no_group ? "{" : ",",
(const char *)cur->key);
no_group = false;
- i++;
}
- if (!no_group)
+ if (!no_group) {
strbuf_addf(events, "}:W");
+ if (has_duration)
+ strbuf_addf(events, ",duration_time");
+ } else if (has_duration)
+ strbuf_addf(events, "duration_time");
}
static void metricgroup__add_metric_non_group(struct strbuf *events,