78 INIT_LIST_HEAD(&me->
head);
106 if (!strcmp(ev->
name, ids[ind])) {
107 metric_events[ind] = ev;
110 if (++ind == idnum) {
111 metric_events[ind] = NULL;
129 struct rblist *metric_events_list)
138 list_for_each_entry (eg, groups,
nd) {
141 metric_events = calloc(
sizeof(
void *), eg->
idnum + 1);
142 if (!metric_events) {
153 for (i = 0; i < eg->
idnum; i++)
168 list_add(&expr->
nd, &me->
head);
180 if (!strcmp(list,
"all"))
183 return !strcasecmp(list,
"No_group");
185 m = strcasestr(n, list);
188 if ((m == n || m[-1] ==
';' || m[-1] ==
' ') &&
189 (m[len] == 0 || m[len] ==
';'))
202 struct mep *a = container_of(rb_node,
struct mep,
nd);
203 struct mep *b = (
struct mep *)entry;
238 return container_of(nd,
struct mep, nd);
242 return container_of(nd,
struct mep, nd);
249 struct mep *me = container_of(nd,
struct mep, nd);
263 printf(
"%s%s", n > 0 ?
" " :
"", sn->
s);
265 printf(
" %s\n", sn->
s);
279 struct rb_node *
node, *next;
280 struct strlist *metriclist = NULL;
311 char *mg = strdup(g);
316 while ((g = strsep(&mg,
";")) != NULL) {
324 if (filter && !strstr(g, filter))
329 if (asprintf(&s,
"%s\n\t[%s]",
350 if (metricgroups && !
raw)
351 printf(
"\nMetric Groups:\n\n");
353 printf(
"\nMetrics:\n\n");
355 for (
node = rb_first(&groups.entries);
node;
node = next) {
362 next = rb_next(
node);
371 struct list_head *group_list)
397 NULL, &ids, &idnum) < 0)
401 for (j = 0; j <
idnum; j++) {
402 pr_debug(
"found event %s\n", ids[j]);
418 list_add_tail(&eg->
nd, group_list);
426 struct list_head *group_list)
428 char *llist, *nlist, *p;
431 nlist = strdup(list);
439 while ((p = strsep(&llist,
",")) != NULL) {
441 if (ret == -EINVAL) {
442 fprintf(stderr,
"Cannot find metric or group `%s'\n",
453 struct egroup *eg, *egtmp;
456 list_for_each_entry_safe (eg, egtmp, group_list,
nd) {
457 for (i = 0; i < eg->
idnum; i++)
470 struct strbuf extra_events;
479 pr_debug(
"adding %s\n", extra_events.buf);
481 ret =
parse_events(perf_evlist, extra_events.buf, &parse_error);
int strbuf_init(struct strbuf *sb, ssize_t hint)
static struct rb_node * mep_new(struct rblist *rl __maybe_unused, const void *entry)
struct perf_probe_event events[MAX_PROBES]
static LIST_HEAD(page_alloc_sort_input)
struct perf_evsel * evsel
int strlist__add(struct strlist *slist, const char *new_entry)
static int metricgroup__add_metric(const char *metric, struct strbuf *events, struct list_head *group_list)
static struct rblist metric_events
int(* node_cmp)(struct rb_node *rbn, const void *entry)
static int metric_event_cmp(struct rb_node *rb_node, const void *entry)
x86 movsq based memset() in arch/x86/lib/memset_64.S") MEMSET_FN(memset_erms
void(* node_delete)(struct rblist *rblist, struct rb_node *rb_node)
int parse_events(struct perf_evlist *evlist, const char *str, struct parse_events_error *err)
static void mep_delete(struct rblist *rl __maybe_unused, struct rb_node *nd)
static struct rb_node * metric_event_new(struct rblist *rblist __maybe_unused, const void *entry)
struct rb_node * rblist__find(struct rblist *rblist, const void *entry)
static void metricgroup__rblist_init(struct rblist *metric_events)
static struct global_info * g
#define pr_debug(fmt,...)
#define evlist__for_each_entry(evlist, evsel)
static int entry(u64 ip, struct unwind_info *ui)
static struct mep * mep_lookup(struct rblist *groups, const char *name)
static int str(yyscan_t scanner, int token)
#define strlist__for_each_entry(pos, slist)
static int mep_cmp(struct rb_node *rb_node, const void *entry)
struct pmu_events_map * perf_pmu__find_map(struct perf_pmu *pmu)
struct metric_event * metricgroup__lookup(struct rblist *metric_events, struct perf_evsel *evsel, bool create)
x86 movsq based memcpy() in arch/x86/lib/memcpy_64.S") MEMCPY_FN(memcpy_erms
static int raw(yyscan_t scanner)
static void metricgroup__free_egroups(struct list_head *group_list)
struct rb_node *(* node_new)(struct rblist *rlist, const void *new_entry)
struct strfilter * filter
void rblist__init(struct rblist *rblist)
static void metricgroup__print_strlist(struct strlist *metrics, bool raw)
int rblist__add_node(struct rblist *rblist, const void *new_entry)
static int metricgroup__setup_events(struct list_head *groups, struct perf_evlist *perf_evlist, struct rblist *metric_events_list)
void strlist__delete(struct strlist *slist)
static int metricgroup__add_metric_list(const char *list, struct strbuf *events, struct list_head *group_list)
const char * metric_group
int strbuf_addf(struct strbuf *sb, const char *fmt,...)
void parse_events_print_error(struct parse_events_error *err, const char *event)
int metricgroup__parse_groups(const struct option *opt, const char *str, struct rblist *metric_events)
struct perf_evsel ** metric_events
void rblist__remove_node(struct rblist *rblist, struct rb_node *rb_node)
static bool match_metric(const char *n, const char *list)
struct strlist * strlist__new(const char *list, const struct strlist_config *config)
void metricgroup__print(bool metrics, bool metricgroups, char *filter, bool raw)
void strbuf_release(struct strbuf *sb)
int expr__find_other(const char *p, const char *one, const char ***other, int *num_otherp)
static struct perf_evsel * find_evsel(struct perf_evlist *perf_evlist, const char **ids, int idnum, struct perf_evsel **metric_events)