Lines Matching full:alias

147 static int perf_pmu__parse_scale(struct perf_pmu_alias *alias, char *dir, char *name)  in perf_pmu__parse_scale()  argument
173 ret = perf_pmu__convert_scale(scale, NULL, &alias->scale); in perf_pmu__parse_scale()
179 static int perf_pmu__parse_unit(struct perf_pmu_alias *alias, char *dir, char *name) in perf_pmu__parse_unit() argument
191 sret = read(fd, alias->unit, UNIT_MAX_LEN); in perf_pmu__parse_unit()
197 if (alias->unit[sret - 1] == '\n') in perf_pmu__parse_unit()
198 alias->unit[sret - 1] = '\0'; in perf_pmu__parse_unit()
200 alias->unit[sret] = '\0'; in perf_pmu__parse_unit()
205 alias->unit[0] = '\0'; in perf_pmu__parse_unit()
210 perf_pmu__parse_per_pkg(struct perf_pmu_alias *alias, char *dir, char *name) in perf_pmu__parse_per_pkg() argument
223 alias->per_pkg = true; in perf_pmu__parse_per_pkg()
227 static int perf_pmu__parse_snapshot(struct perf_pmu_alias *alias, in perf_pmu__parse_snapshot() argument
239 alias->snapshot = true; in perf_pmu__parse_snapshot()
252 pr_debug("alias %s differs in field '%s'\n", in perf_pmu_assign_str()
280 /* Delete an alias entry. */
295 /* Merge an alias, search in alias list. If this name is already
321 struct perf_pmu_alias *alias; in __perf_pmu__new_alias() local
340 alias = malloc(sizeof(*alias)); in __perf_pmu__new_alias()
341 if (!alias) in __perf_pmu__new_alias()
344 INIT_LIST_HEAD(&alias->terms); in __perf_pmu__new_alias()
345 alias->scale = 1.0; in __perf_pmu__new_alias()
346 alias->unit[0] = '\0'; in __perf_pmu__new_alias()
347 alias->per_pkg = false; in __perf_pmu__new_alias()
348 alias->snapshot = false; in __perf_pmu__new_alias()
349 alias->deprecated = false; in __perf_pmu__new_alias()
351 ret = parse_events_terms(&alias->terms, val); in __perf_pmu__new_alias()
353 pr_err("Cannot parse alias %s: %d\n", val, ret); in __perf_pmu__new_alias()
354 free(alias); in __perf_pmu__new_alias()
363 * Rebuild string to make alias->str member comparable. in __perf_pmu__new_alias()
367 list_for_each_entry(term, &alias->terms, list) { in __perf_pmu__new_alias()
379 alias->name = strdup(name); in __perf_pmu__new_alias()
384 perf_pmu__parse_unit(alias, dir, name); in __perf_pmu__new_alias()
385 perf_pmu__parse_scale(alias, dir, name); in __perf_pmu__new_alias()
386 perf_pmu__parse_per_pkg(alias, dir, name); in __perf_pmu__new_alias()
387 perf_pmu__parse_snapshot(alias, dir, name); in __perf_pmu__new_alias()
390 alias->metric_expr = metric_expr ? strdup(metric_expr) : NULL; in __perf_pmu__new_alias()
391 alias->metric_name = metric_name ? strdup(metric_name): NULL; in __perf_pmu__new_alias()
392 alias->desc = desc ? strdup(desc) : NULL; in __perf_pmu__new_alias()
393 alias->long_desc = long_desc ? strdup(long_desc) : in __perf_pmu__new_alias()
395 alias->topic = topic ? strdup(topic) : NULL; in __perf_pmu__new_alias()
397 if (perf_pmu__convert_scale(unit, &unit, &alias->scale) < 0) in __perf_pmu__new_alias()
399 snprintf(alias->unit, sizeof(alias->unit), "%s", unit); in __perf_pmu__new_alias()
401 alias->per_pkg = perpkg && sscanf(perpkg, "%d", &num) == 1 && num == 1; in __perf_pmu__new_alias()
402 alias->str = strdup(newval); in __perf_pmu__new_alias()
403 alias->pmu_name = pmu_name ? strdup(pmu_name) : NULL; in __perf_pmu__new_alias()
406 alias->deprecated = true; in __perf_pmu__new_alias()
408 if (!perf_pmu_merge_alias(alias, list)) in __perf_pmu__new_alias()
409 list_add_tail(&alias->list, list); in __perf_pmu__new_alias()
516 static int pmu_alias_terms(struct perf_pmu_alias *alias, in pmu_alias_terms() argument
523 list_for_each_entry(term, &alias->terms, list) { in pmu_alias_terms()
757 * uncore alias may be from different PMU with common prefix in pmu_uncore_alias_match()
766 * Match more complex aliases where the alias name is a comma-delimited in pmu_uncore_alias_match()
769 * Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we in pmu_uncore_alias_match()
1379 struct perf_pmu_alias *alias; in pmu_find_alias() local
1399 list_for_each_entry(alias, &pmu->aliases, list) { in pmu_find_alias()
1400 if (!strcasecmp(alias->name, name)) in pmu_find_alias()
1401 return alias; in pmu_find_alias()
1407 static int check_info_data(struct perf_pmu_alias *alias, in check_info_data() argument
1415 if ((info->unit && alias->unit[0]) || in check_info_data()
1416 (info->scale && alias->scale) || in check_info_data()
1417 (info->snapshot && alias->snapshot)) in check_info_data()
1420 if (alias->unit[0]) in check_info_data()
1421 info->unit = alias->unit; in check_info_data()
1423 if (alias->scale) in check_info_data()
1424 info->scale = alias->scale; in check_info_data()
1426 if (alias->snapshot) in check_info_data()
1427 info->snapshot = alias->snapshot; in check_info_data()
1433 * Find alias in the terms list and replace it with the terms
1434 * defined for the alias
1440 struct perf_pmu_alias *alias; in perf_pmu__check_alias() local
1456 alias = pmu_find_alias(pmu, term); in perf_pmu__check_alias()
1457 if (!alias) in perf_pmu__check_alias()
1459 ret = pmu_alias_terms(alias, &term->list); in perf_pmu__check_alias()
1463 ret = check_info_data(alias, info); in perf_pmu__check_alias()
1467 if (alias->per_pkg) in perf_pmu__check_alias()
1469 info->metric_expr = alias->metric_expr; in perf_pmu__check_alias()
1470 info->metric_name = alias->metric_name; in perf_pmu__check_alias()
1538 struct perf_pmu_alias *alias) in format_alias() argument
1541 int used = snprintf(buf, len, "%s/%s", pmu->name, alias->name); in format_alias()
1543 list_for_each_entry(term, &alias->terms, list) { in format_alias()
1564 struct perf_pmu_alias *alias) in format_alias_or() argument
1566 snprintf(buf, len, "%s OR %s/%s/", alias->name, pmu->name, alias->name); in format_alias_or()
1656 struct perf_pmu_alias *alias; in print_pmu_events() local
1668 list_for_each_entry(alias, &pmu->aliases, list) in print_pmu_events()
1684 list_for_each_entry(alias, &pmu->aliases, list) { in print_pmu_events()
1685 char *name = alias->desc ? alias->name : in print_pmu_events()
1686 format_alias(buf, sizeof(buf), pmu, alias); in print_pmu_events()
1690 if (alias->deprecated && !deprecated) in print_pmu_events()
1695 (!is_cpu && strglobmatch_nocase(alias->name, in print_pmu_events()
1697 (alias->topic && in print_pmu_events()
1698 strglobmatch_nocase(alias->topic, event_glob)))) in print_pmu_events()
1701 if (is_cpu && !name_only && !alias->desc) in print_pmu_events()
1702 name = format_alias_or(buf, sizeof(buf), pmu, alias); in print_pmu_events()
1705 if (is_cpu && !name_only && !alias->desc) in print_pmu_events()
1708 pmu, alias); in print_pmu_events()
1713 aliases[j].desc = long_desc ? alias->long_desc : in print_pmu_events()
1714 alias->desc; in print_pmu_events()
1715 aliases[j].topic = alias->topic; in print_pmu_events()
1716 aliases[j].str = alias->str; in print_pmu_events()
1718 aliases[j].metric_expr = alias->metric_expr; in print_pmu_events()
1719 aliases[j].metric_name = alias->metric_name; in print_pmu_events()
1785 struct perf_pmu_alias *alias; in pmu_have_event() local
1791 list_for_each_entry(alias, &pmu->aliases, list) in pmu_have_event()
1792 if (!strcmp(alias->name, name)) in pmu_have_event()