Lines Matching refs:name

34 	.name = "fake",
57 char *name; member
117 char *name; member
130 static struct perf_pmu_format *perf_pmu__new_format(struct list_head *list, char *name) in perf_pmu__new_format() argument
138 format->name = strdup(name); in perf_pmu__new_format()
139 if (!format->name) { in perf_pmu__new_format()
179 if (!perf_pmu__pathname_scnprintf(path, sizeof(path), pmu->name, "format")) in perf_pmu_format__load()
182 assert(strlen(path) + strlen(format->name) + 2 < sizeof(path)); in perf_pmu_format__load()
184 strcat(path, format->name); in perf_pmu_format__load()
209 char *name = evt_ent->d_name; in perf_pmu__format_parse() local
211 if (!strcmp(name, ".") || !strcmp(name, "..")) in perf_pmu__format_parse()
214 format = perf_pmu__new_format(&pmu->format, name); in perf_pmu__format_parse()
222 int fd = openat(dirfd, name, O_RDONLY); in perf_pmu__format_parse()
247 static int pmu_format(struct perf_pmu *pmu, int dirfd, const char *name) in pmu_format() argument
251 fd = perf_pmu__pathname_fd(dirfd, name, "format", O_DIRECTORY); in pmu_format()
311 scnprintf(path + len, sizeof(path) - len, "%s/events/%s.scale", pmu->name, alias->name); in perf_pmu__parse_scale()
346 scnprintf(path + len, sizeof(path) - len, "%s/events/%s.unit", pmu->name, alias->name); in perf_pmu__parse_unit()
380 scnprintf(path + len, sizeof(path) - len, "%s/events/%s.per-pkg", pmu->name, alias->name); in perf_pmu__parse_per_pkg()
401 scnprintf(path + len, sizeof(path) - len, "%s/events/%s.snapshot", pmu->name, alias->name); in perf_pmu__parse_snapshot()
415 zfree(&newalias->name); in perf_pmu_free_alias()
435 const char *name, in perf_pmu__find_alias() argument
449 scnprintf(event_file_name, sizeof(event_file_name), "events/%s", name); in perf_pmu__find_alias()
450 for (size_t i = 7, n = 7 + strlen(name); i < n; i++) in perf_pmu__find_alias()
455 for (size_t i = 7, n = 7 + strlen(name); i < n; i++) in perf_pmu__find_alias()
465 if (!strcasecmp(alias->name, name)) in perf_pmu__find_alias()
471 static bool assign_str(const char *name, const char *field, char **old_str, in assign_str() argument
483 name, field, *old_str, new_str); in assign_str()
516 assign_str(pe->name, "desc", &data->alias->desc, pe->desc); in update_alias()
517 assign_str(pe->name, "long_desc", &data->alias->long_desc, pe->long_desc); in update_alias()
518 assign_str(pe->name, "topic", &data->alias->topic, pe->topic); in update_alias()
534 static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name, in perf_pmu__new_alias() argument
543 if (perf_pmu__find_alias(pmu, name, /*load=*/ false)) { in perf_pmu__new_alias()
575 alias->name = strdup(name); in perf_pmu__new_alias()
598 if (pmu_events_table__find_event(pmu->events_table, pmu, name, in perf_pmu__new_alias()
616 static inline bool pmu_alias_info_file(char *name) in pmu_alias_info_file() argument
620 len = strlen(name); in pmu_alias_info_file()
621 if (len > 5 && !strcmp(name + len - 5, ".unit")) in pmu_alias_info_file()
623 if (len > 6 && !strcmp(name + len - 6, ".scale")) in pmu_alias_info_file()
625 if (len > 8 && !strcmp(name + len - 8, ".per-pkg")) in pmu_alias_info_file()
627 if (len > 9 && !strcmp(name + len - 9, ".snapshot")) in pmu_alias_info_file()
648 scnprintf(path + len, sizeof(path) - len, "%s/events", pmu->name); in pmu_aliases_parse()
663 char *name = evt_ent->d_name; in pmu_aliases_parse() local
666 if (!strcmp(name, ".") || !strcmp(name, "..")) in pmu_aliases_parse()
672 if (pmu_alias_info_file(name)) in pmu_aliases_parse()
675 fd = openat(dir_fd, name, O_RDONLY); in pmu_aliases_parse()
677 pr_debug("Cannot open %s\n", name); in pmu_aliases_parse()
686 if (perf_pmu__new_alias(pmu, name, /*desc=*/ NULL, in pmu_aliases_parse()
689 pr_debug("Cannot set up %s\n", name); in pmu_aliases_parse()
727 static struct perf_cpu_map *pmu_cpumask(int dirfd, const char *name, bool is_core) in pmu_cpumask() argument
737 struct perf_pmu pmu = {.name = pmu_name}; in pmu_cpumask()
740 strlcpy(pmu_name, name, sizeof(pmu_name)); in pmu_cpumask()
755 static bool pmu_is_uncore(int dirfd, const char *name) in pmu_is_uncore() argument
759 fd = perf_pmu__pathname_fd(dirfd, name, "cpumask", O_PATH); in pmu_is_uncore()
767 static char *pmu_id(const char *name) in pmu_id() argument
772 perf_pmu__pathname_scnprintf(path, sizeof(path), name, "identifier"); in pmu_id()
789 static int is_sysfs_pmu_core(const char *name) in is_sysfs_pmu_core() argument
793 if (!perf_pmu__pathname_scnprintf(path, sizeof(path), name, "cpus")) in is_sysfs_pmu_core()
867 static bool pmu_uncore_alias_match(const char *pmu_name, const char *name) in pmu_uncore_alias_match() argument
873 return perf_pmu__match_ignoring_suffix(name, pmu_name); in pmu_uncore_alias_match()
899 name = strstr(name, tok); in pmu_uncore_alias_match()
900 if (!name || in pmu_uncore_alias_match()
901 (!next_tok && !perf_pmu__match_ignoring_suffix(name, tok))) { in pmu_uncore_alias_match()
908 name += strlen(tok); in pmu_uncore_alias_match()
945 perf_pmu__new_alias(pmu, pe->name, pe->desc, pe->event, /*val_fd=*/ NULL, in pmu_add_cpu_aliases_map_callback()
980 if (pmu_uncore_alias_match(pe->pmu, pmu->name) && in pmu_add_sys_aliases_iter_fn()
983 pe->name, in pmu_add_sys_aliases_iter_fn()
1009 pmu_find_real_name(const char *name) in pmu_find_real_name() argument
1011 return name; in pmu_find_real_name()
1015 pmu_find_alias_name(const char *name __maybe_unused) in pmu_find_alias_name()
1032 const char *name = pmu_find_real_name(lookup_name); in perf_pmu__lookup() local
1039 pmu->name = strdup(name); in perf_pmu__lookup()
1040 if (!pmu->name) in perf_pmu__lookup()
1059 if (pmu_format(pmu, dirfd, name)) in perf_pmu__lookup()
1062 pmu->is_core = is_pmu_core(name); in perf_pmu__lookup()
1063 pmu->cpus = pmu_cpumask(dirfd, name, pmu->is_core); in perf_pmu__lookup()
1065 alias_name = pmu_find_alias_name(name); in perf_pmu__lookup()
1073 pmu->is_uncore = pmu_is_uncore(dirfd, name); in perf_pmu__lookup()
1075 pmu->id = pmu_id(name); in perf_pmu__lookup()
1091 zfree(&pmu->name); in perf_pmu__lookup()
1104 pmu->name = strdup("cpu"); in perf_pmu__create_placeholder_core_pmu()
1105 if (!pmu->name) { in perf_pmu__create_placeholder_core_pmu()
1139 pmu->name, format->name, format->value); in perf_pmu__warn_invalid_formats()
1182 pmu_find_format(struct list_head *formats, const char *name) in pmu_find_format() argument
1187 if (!strcmp(format->name, name)) in pmu_find_format()
1193 __u64 perf_pmu__format_bits(struct perf_pmu *pmu, const char *name) in perf_pmu__format_bits() argument
1195 struct perf_pmu_format *format = pmu_find_format(&pmu->format, name); in perf_pmu__format_bits()
1208 int perf_pmu__format_type(struct perf_pmu *pmu, const char *name) in perf_pmu__format_type() argument
1210 struct perf_pmu_format *format = pmu_find_format(&pmu->format, name); in perf_pmu__format_type()
1292 if (strbuf_addf(&buf, i++ ? ",%s" : "%s", format->name) < 0) in pmu_formats_string()
1338 term->config, pmu->name) < 0) in pmu_config_term()
1462 const char *name; in pmu_find_alias() local
1472 name = term->config; in pmu_find_alias()
1477 name = term->val.str; in pmu_find_alias()
1482 alias = perf_pmu__find_alias(pmu, name, /*load=*/ true); in pmu_find_alias()
1488 pmu_events_table__find_event(pmu->events_table, pmu, name, in pmu_find_alias()
1491 alias = perf_pmu__find_alias(pmu, name, /*load=*/ false); in pmu_find_alias()
1608 if (!strcmp(args->event, info->name)) in find_event_callback()
1633 zfree(&fmt->name); in perf_pmu__del_formats()
1638 bool perf_pmu__has_format(const struct perf_pmu *pmu, const char *name) in perf_pmu__has_format() argument
1643 if (!strcmp(format->name, name)) in perf_pmu__has_format()
1649 bool is_pmu_core(const char *name) in is_pmu_core() argument
1651 return !strcmp(name, "cpu") || !strcmp(name, "cpum_cf") || is_sysfs_pmu_core(name); in is_pmu_core()
1664 bool perf_pmu__have_event(struct perf_pmu *pmu, const char *name) in perf_pmu__have_event() argument
1666 if (perf_pmu__find_alias(pmu, name, /*load=*/ true) != NULL) in perf_pmu__have_event()
1670 return pmu_events_table__find_event(pmu->events_table, pmu, name, NULL, NULL) == 0; in perf_pmu__have_event()
1702 ? pmu_name_len_no_suffix(pmu->name, /*num=*/NULL) in format_alias()
1703 : (int)strlen(pmu->name); in format_alias()
1704 int used = snprintf(buf, len, "%.*s/%s", pmu_name_len, pmu->name, alias->name); in format_alias()
1743 info.pmu_name = event->pmu_name ?: pmu->name; in perf_pmu__for_each_event()
1746 info.name = event->name; in perf_pmu__for_each_event()
1749 info.name = format_alias(buf, sizeof(buf), pmu, event, in perf_pmu__for_each_event()
1752 info.alias = info.name; in perf_pmu__for_each_event()
1753 info.name = event->name; in perf_pmu__for_each_event()
1778 info.name = buf; in perf_pmu__for_each_event()
1779 snprintf(buf, sizeof(buf), "%s//", pmu->name); in perf_pmu__for_each_event()
1786 info.pmu_name = pmu->name; in perf_pmu__for_each_event()
1797 return !strcmp(pmu->name, pmu_name) || in pmu__name_match()
1798 (pmu->is_uncore && pmu_uncore_alias_match(pmu_name, pmu->name)) || in pmu__name_match()
1826 if (!strcmp(pmu->name, known_sw_pmus[i])) in perf_pmu__is_software()
1832 FILE *perf_pmu__open_file(struct perf_pmu *pmu, const char *name) in perf_pmu__open_file() argument
1836 if (!perf_pmu__pathname_scnprintf(path, sizeof(path), pmu->name, name) || in perf_pmu__open_file()
1843 FILE *perf_pmu__open_file_at(struct perf_pmu *pmu, int dirfd, const char *name) in perf_pmu__open_file_at() argument
1847 fd = perf_pmu__pathname_fd(dirfd, pmu->name, name, O_RDONLY); in perf_pmu__open_file_at()
1854 int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, in perf_pmu__scan_file() argument
1862 file = perf_pmu__open_file(pmu, name); in perf_pmu__scan_file()
1871 int perf_pmu__scan_file_at(struct perf_pmu *pmu, int dirfd, const char *name, in perf_pmu__scan_file_at() argument
1879 file = perf_pmu__open_file_at(pmu, dirfd, name); in perf_pmu__scan_file_at()
1888 bool perf_pmu__file_exists(struct perf_pmu *pmu, const char *name) in perf_pmu__file_exists() argument
1892 if (!perf_pmu__pathname_scnprintf(path, sizeof(path), pmu->name, name)) in perf_pmu__file_exists()
1898 static int perf_pmu__new_caps(struct list_head *list, char *name, char *value) in perf_pmu__new_caps() argument
1905 caps->name = strdup(name); in perf_pmu__new_caps()
1906 if (!caps->name) in perf_pmu__new_caps()
1915 zfree(&caps->name); in perf_pmu__new_caps()
1928 zfree(&caps->name); in perf_pmu__del_caps()
1952 if (!perf_pmu__pathname_scnprintf(caps_path, sizeof(caps_path), pmu->name, "caps")) in perf_pmu__caps_parse()
1967 char *name = evt_ent->d_name; in perf_pmu__caps_parse() local
1972 if (!strcmp(name, ".") || !strcmp(name, "..")) in perf_pmu__caps_parse()
1975 fd = openat(caps_fd, name, O_RDONLY); in perf_pmu__caps_parse()
1985 (perf_pmu__new_caps(&pmu->caps, name, value) < 0)) { in perf_pmu__caps_parse()
2024 const char *name, int config_num, in perf_pmu__warn_invalid_config() argument
2046 name ?: "N/A", buf, config_name, config); in perf_pmu__warn_invalid_config()
2049 int perf_pmu__match(const char *pattern, const char *name, const char *tok) in perf_pmu__match() argument
2051 if (!name) in perf_pmu__match()
2054 if (fnmatch(pattern, name, 0)) in perf_pmu__match()
2057 if (tok && !perf_pmu__match_ignoring_suffix(name, tok)) in perf_pmu__match()
2127 zfree(&pmu->name); in perf_pmu__delete()
2147 return event->name; in perf_pmu__name_from_config()