@@ -501,9 +501,14 @@ static void metricgroup__add_metric_non_group(struct strbuf *events,
{
struct hashmap_entry *cur;
size_t bkt;
+ bool first = true;
- hashmap__for_each_entry((&ctx->ids), cur, bkt)
- strbuf_addf(events, ",%s", (const char *)cur->key);
+ hashmap__for_each_entry((&ctx->ids), cur, bkt) {
+ if (!first)
+ strbuf_addf(events, ",");
+ strbuf_addf(events, "%s", (const char *)cur->key);
+ first = false;
+ }
}
static void metricgroup___watchdog_constraint_hint(const char *name, bool foot)
Remove unnecessary commas from events before they are parsed. This avoids ',' being echoed by parse-events.l. Signed-off-by: Ian Rogers <irogers@google.com> --- tools/perf/util/metricgroup.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)