Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350029
b: refs/heads/master
c: e6ab07d
h: refs/heads/master
i:
  350027: b5ab9dc
v: v3
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Jan 31, 2013
1 parent 3d9ecef commit f0e85b4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 00c7e1f10c6b8ae8a031f5c6a58ecd15d20c52cb
refs/heads/master: e6ab07d027d47e55d8a5c0f33b16dfdd3e18c96f
4 changes: 4 additions & 0 deletions trunk/tools/perf/Documentation/perf-evlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ OPTIONS
--verbose=::
Show all fields.

-g::
--group::
Show event group information.

SEE ALSO
--------
linkperf:perf-record[1], linkperf:perf-list[1],
Expand Down
7 changes: 7 additions & 0 deletions trunk/tools/perf/builtin-evlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN('F', "freq", &details.freq, "Show the sample frequency"),
OPT_BOOLEAN('v', "verbose", &details.verbose,
"Show all event attr details"),
OPT_BOOLEAN('g', "group", &symbol_conf.event_group,
"Show event group information"),
OPT_END()
};
const char * const evlist_usage[] = {
Expand All @@ -50,5 +52,10 @@ int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused)
if (argc)
usage_with_options(evlist_usage, options);

if (symbol_conf.event_group && (details.verbose || details.freq)) {
pr_err("--group option is not compatible with other options\n");
usage_with_options(evlist_usage, options);
}

return __cmd_evlist(input_name, &details);
}
24 changes: 22 additions & 2 deletions trunk/tools/perf/util/evsel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,27 @@ int perf_evsel__fprintf(struct perf_evsel *evsel,
struct perf_attr_details *details, FILE *fp)
{
bool first = true;
int printed = fprintf(fp, "%s", perf_evsel__name(evsel));
int printed = 0;

if (symbol_conf.event_group) {
struct perf_evsel *pos;

if (!perf_evsel__is_group_leader(evsel))
return 0;

if (evsel->nr_members > 1)
printed += fprintf(fp, "%s{", evsel->group_name ?: "");

printed += fprintf(fp, "%s", perf_evsel__name(evsel));
for_each_group_member(pos, evsel)
printed += fprintf(fp, ",%s", perf_evsel__name(pos));

if (evsel->nr_members > 1)
printed += fprintf(fp, "}");
goto out;
}

printed += fprintf(fp, "%s", perf_evsel__name(evsel));

if (details->verbose || details->freq) {
printed += comma_fprintf(fp, &first, " sample_freq=%" PRIu64,
Expand Down Expand Up @@ -1430,7 +1450,7 @@ int perf_evsel__fprintf(struct perf_evsel *evsel,
if_print(bp_type);
if_print(branch_sample_type);
}

out:
fputc('\n', fp);
return ++printed;
}
Expand Down

0 comments on commit f0e85b4

Please sign in to comment.