Skip to content

Commit e5cf72f

Browse files
author
Fox Snowpatch
committed
1 parent 182544a commit e5cf72f

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

tools/perf/util/pmu.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,7 @@ static char *format_alias(char *buf, int len, const struct perf_pmu *pmu,
21172117
skip_duplicate_pmus);
21182118

21192119
/* Paramemterized events have the parameters shown. */
2120-
if (strstr(alias->terms, "=?")) {
2120+
if (!strstr(alias->terms, "=?")) {
21212121
/* No parameters. */
21222122
snprintf(buf, len, "%.*s/%s/", (int)pmu_name_len, pmu->name, alias->name);
21232123
return buf;
@@ -2129,15 +2129,19 @@ static char *format_alias(char *buf, int len, const struct perf_pmu *pmu,
21292129
pr_err("Failure to parse '%s' terms '%s': %d\n",
21302130
alias->name, alias->terms, ret);
21312131
parse_events_terms__exit(&terms);
2132-
snprintf(buf, len, "%.*s/%s/", (int)pmu_name_len, pmu->name, alias->name);
2132+
scnprintf(buf, len, "%.*s/%s/", (int)pmu_name_len, pmu->name, alias->name);
21332133
return buf;
21342134
}
2135-
used = snprintf(buf, len, "%.*s/%s", (int)pmu_name_len, pmu->name, alias->name);
2135+
used = scnprintf(buf, len, "%.*s/%s", (int)pmu_name_len, pmu->name, alias->name);
21362136

21372137
list_for_each_entry(term, &terms.terms, list) {
2138+
const char *name = term->config;
2139+
2140+
if (!name)
2141+
name = parse_events__term_type_str(term->type_term);
21382142
if (term->type_val == PARSE_EVENTS__TERM_TYPE_STR)
2139-
used += snprintf(buf + used, sub_non_neg(len, used),
2140-
",%s=%s", term->config,
2143+
used += scnprintf(buf + used, sub_non_neg(len, used),
2144+
",%s=%s", name,
21412145
term->val.str);
21422146
}
21432147
parse_events_terms__exit(&terms);

0 commit comments

Comments
 (0)