diff options
author | Ingo Molnar <mingo@kernel.org> | 2014-10-18 03:04:02 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-10-18 03:04:02 -0400 |
commit | 3b10ea7f922b538ba5dcb3d979a6b6b4d07daae2 (patch) | |
tree | e7d8e31708d8b553973154dbe1e8b9b7d9ad81c3 | |
parent | 691286b5561aab2e1b00119bc328598c01250548 (diff) | |
parent | e8564b710c6df2c3aeb56c507c22f4bcfa4c0b2d (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
User visible changes:
* Add period data column and make it default in 'perf script' (Jiri Olsa)
Infrastructure changes:
* Move exit stuff from perf_evsel__delete to perf_evsel__exit, delete
should be just a front end for exit + free (Arnaldo Carvalho de Melo)
* Add missing 'struct option' forward declaration (Arnaldo Carvalho de Melo)
* No need to drag util/cgroup.h into evsel.h (Arnaldo Carvalho de Melo)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | tools/perf/Documentation/perf-script.txt | 2 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 1 | ||||
-rw-r--r-- | tools/perf/builtin-script.c | 21 | ||||
-rw-r--r-- | tools/perf/builtin-stat.c | 1 | ||||
-rw-r--r-- | tools/perf/util/evlist.h | 2 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 11 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 3 |
7 files changed, 30 insertions, 11 deletions
diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt index 5a0160d359a1..21494806c0ab 100644 --- a/tools/perf/Documentation/perf-script.txt +++ b/tools/perf/Documentation/perf-script.txt | |||
@@ -115,7 +115,7 @@ OPTIONS | |||
115 | -f:: | 115 | -f:: |
116 | --fields:: | 116 | --fields:: |
117 | Comma separated list of fields to print. Options are: | 117 | Comma separated list of fields to print. Options are: |
118 | comm, tid, pid, time, cpu, event, trace, ip, sym, dso, addr, symoff, srcline. | 118 | comm, tid, pid, time, cpu, event, trace, ip, sym, dso, addr, symoff, srcline, period. |
119 | Field list can be prepended with the type, trace, sw or hw, | 119 | Field list can be prepended with the type, trace, sw or hw, |
120 | to indicate to which event type the field list applies. | 120 | to indicate to which event type the field list applies. |
121 | e.g., -f sw:comm,tid,time,ip,sym and -f trace:time,cpu,trace | 121 | e.g., -f sw:comm,tid,time,ip,sym and -f trace:time,cpu,trace |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index a6b2132c666f..2583a9b04317 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include "util/parse-events.h" | 15 | #include "util/parse-events.h" |
16 | 16 | ||
17 | #include "util/callchain.h" | 17 | #include "util/callchain.h" |
18 | #include "util/cgroup.h" | ||
18 | #include "util/header.h" | 19 | #include "util/header.h" |
19 | #include "util/event.h" | 20 | #include "util/event.h" |
20 | #include "util/evlist.h" | 21 | #include "util/evlist.h" |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 6b4925f65bf0..9708a1290571 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -44,6 +44,7 @@ enum perf_output_field { | |||
44 | PERF_OUTPUT_ADDR = 1U << 10, | 44 | PERF_OUTPUT_ADDR = 1U << 10, |
45 | PERF_OUTPUT_SYMOFFSET = 1U << 11, | 45 | PERF_OUTPUT_SYMOFFSET = 1U << 11, |
46 | PERF_OUTPUT_SRCLINE = 1U << 12, | 46 | PERF_OUTPUT_SRCLINE = 1U << 12, |
47 | PERF_OUTPUT_PERIOD = 1U << 13, | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | struct output_option { | 50 | struct output_option { |
@@ -63,6 +64,7 @@ struct output_option { | |||
63 | {.str = "addr", .field = PERF_OUTPUT_ADDR}, | 64 | {.str = "addr", .field = PERF_OUTPUT_ADDR}, |
64 | {.str = "symoff", .field = PERF_OUTPUT_SYMOFFSET}, | 65 | {.str = "symoff", .field = PERF_OUTPUT_SYMOFFSET}, |
65 | {.str = "srcline", .field = PERF_OUTPUT_SRCLINE}, | 66 | {.str = "srcline", .field = PERF_OUTPUT_SRCLINE}, |
67 | {.str = "period", .field = PERF_OUTPUT_PERIOD}, | ||
66 | }; | 68 | }; |
67 | 69 | ||
68 | /* default set to maintain compatibility with current format */ | 70 | /* default set to maintain compatibility with current format */ |
@@ -80,7 +82,8 @@ static struct { | |||
80 | .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | | 82 | .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | |
81 | PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | | 83 | PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | |
82 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | | 84 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | |
83 | PERF_OUTPUT_SYM | PERF_OUTPUT_DSO, | 85 | PERF_OUTPUT_SYM | PERF_OUTPUT_DSO | |
86 | PERF_OUTPUT_PERIOD, | ||
84 | 87 | ||
85 | .invalid_fields = PERF_OUTPUT_TRACE, | 88 | .invalid_fields = PERF_OUTPUT_TRACE, |
86 | }, | 89 | }, |
@@ -91,7 +94,8 @@ static struct { | |||
91 | .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | | 94 | .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | |
92 | PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | | 95 | PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | |
93 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | | 96 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | |
94 | PERF_OUTPUT_SYM | PERF_OUTPUT_DSO, | 97 | PERF_OUTPUT_SYM | PERF_OUTPUT_DSO | |
98 | PERF_OUTPUT_PERIOD, | ||
95 | 99 | ||
96 | .invalid_fields = PERF_OUTPUT_TRACE, | 100 | .invalid_fields = PERF_OUTPUT_TRACE, |
97 | }, | 101 | }, |
@@ -110,7 +114,8 @@ static struct { | |||
110 | .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | | 114 | .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID | |
111 | PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | | 115 | PERF_OUTPUT_CPU | PERF_OUTPUT_TIME | |
112 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | | 116 | PERF_OUTPUT_EVNAME | PERF_OUTPUT_IP | |
113 | PERF_OUTPUT_SYM | PERF_OUTPUT_DSO, | 117 | PERF_OUTPUT_SYM | PERF_OUTPUT_DSO | |
118 | PERF_OUTPUT_PERIOD, | ||
114 | 119 | ||
115 | .invalid_fields = PERF_OUTPUT_TRACE, | 120 | .invalid_fields = PERF_OUTPUT_TRACE, |
116 | }, | 121 | }, |
@@ -229,6 +234,11 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel, | |||
229 | PERF_OUTPUT_CPU)) | 234 | PERF_OUTPUT_CPU)) |
230 | return -EINVAL; | 235 | return -EINVAL; |
231 | 236 | ||
237 | if (PRINT_FIELD(PERIOD) && | ||
238 | perf_evsel__check_stype(evsel, PERF_SAMPLE_PERIOD, "PERIOD", | ||
239 | PERF_OUTPUT_PERIOD)) | ||
240 | return -EINVAL; | ||
241 | |||
232 | return 0; | 242 | return 0; |
233 | } | 243 | } |
234 | 244 | ||
@@ -448,6 +458,9 @@ static void process_event(union perf_event *event, struct perf_sample *sample, | |||
448 | 458 | ||
449 | print_sample_start(sample, thread, evsel); | 459 | print_sample_start(sample, thread, evsel); |
450 | 460 | ||
461 | if (PRINT_FIELD(PERIOD)) | ||
462 | printf("%10" PRIu64 " ", sample->period); | ||
463 | |||
451 | if (PRINT_FIELD(EVNAME)) { | 464 | if (PRINT_FIELD(EVNAME)) { |
452 | const char *evname = perf_evsel__name(evsel); | 465 | const char *evname = perf_evsel__name(evsel); |
453 | printf("%s: ", evname ? evname : "[unknown]"); | 466 | printf("%s: ", evname ? evname : "[unknown]"); |
@@ -1543,7 +1556,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1543 | "comma separated output fields prepend with 'type:'. " | 1556 | "comma separated output fields prepend with 'type:'. " |
1544 | "Valid types: hw,sw,trace,raw. " | 1557 | "Valid types: hw,sw,trace,raw. " |
1545 | "Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso," | 1558 | "Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso," |
1546 | "addr,symoff", parse_output_fields), | 1559 | "addr,symoff,period", parse_output_fields), |
1547 | OPT_BOOLEAN('a', "all-cpus", &system_wide, | 1560 | OPT_BOOLEAN('a', "all-cpus", &system_wide, |
1548 | "system-wide collection from all CPUs"), | 1561 | "system-wide collection from all CPUs"), |
1549 | OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]", | 1562 | OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]", |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index b22c62f80078..055ce9232c9e 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -43,6 +43,7 @@ | |||
43 | 43 | ||
44 | #include "perf.h" | 44 | #include "perf.h" |
45 | #include "builtin.h" | 45 | #include "builtin.h" |
46 | #include "util/cgroup.h" | ||
46 | #include "util/util.h" | 47 | #include "util/util.h" |
47 | #include "util/parse-options.h" | 48 | #include "util/parse-options.h" |
48 | #include "util/parse-events.h" | 49 | #include "util/parse-events.h" |
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h index bd312b01e876..649b0c597283 100644 --- a/tools/perf/util/evlist.h +++ b/tools/perf/util/evlist.h | |||
@@ -117,6 +117,8 @@ int perf_evlist__prepare_workload(struct perf_evlist *evlist, | |||
117 | void *ucontext)); | 117 | void *ucontext)); |
118 | int perf_evlist__start_workload(struct perf_evlist *evlist); | 118 | int perf_evlist__start_workload(struct perf_evlist *evlist); |
119 | 119 | ||
120 | struct option; | ||
121 | |||
120 | int perf_evlist__parse_mmap_pages(const struct option *opt, | 122 | int perf_evlist__parse_mmap_pages(const struct option *opt, |
121 | const char *str, | 123 | const char *str, |
122 | int unset); | 124 | int unset); |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index d1ecde0fd56c..2f9e68025ede 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <sys/resource.h> | 16 | #include <sys/resource.h> |
17 | #include "asm/bug.h" | 17 | #include "asm/bug.h" |
18 | #include "callchain.h" | 18 | #include "callchain.h" |
19 | #include "cgroup.h" | ||
19 | #include "evsel.h" | 20 | #include "evsel.h" |
20 | #include "evlist.h" | 21 | #include "evlist.h" |
21 | #include "util.h" | 22 | #include "util.h" |
@@ -850,17 +851,17 @@ void perf_evsel__exit(struct perf_evsel *evsel) | |||
850 | assert(list_empty(&evsel->node)); | 851 | assert(list_empty(&evsel->node)); |
851 | perf_evsel__free_fd(evsel); | 852 | perf_evsel__free_fd(evsel); |
852 | perf_evsel__free_id(evsel); | 853 | perf_evsel__free_id(evsel); |
854 | close_cgroup(evsel->cgrp); | ||
855 | zfree(&evsel->group_name); | ||
856 | if (evsel->tp_format) | ||
857 | pevent_free_format(evsel->tp_format); | ||
858 | zfree(&evsel->name); | ||
853 | perf_evsel__object.fini(evsel); | 859 | perf_evsel__object.fini(evsel); |
854 | } | 860 | } |
855 | 861 | ||
856 | void perf_evsel__delete(struct perf_evsel *evsel) | 862 | void perf_evsel__delete(struct perf_evsel *evsel) |
857 | { | 863 | { |
858 | perf_evsel__exit(evsel); | 864 | perf_evsel__exit(evsel); |
859 | close_cgroup(evsel->cgrp); | ||
860 | zfree(&evsel->group_name); | ||
861 | if (evsel->tp_format) | ||
862 | pevent_free_format(evsel->tp_format); | ||
863 | zfree(&evsel->name); | ||
864 | free(evsel); | 865 | free(evsel); |
865 | } | 866 | } |
866 | 867 | ||
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 1d5c754aebc4..163c5604e5d1 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -7,7 +7,6 @@ | |||
7 | #include <linux/perf_event.h> | 7 | #include <linux/perf_event.h> |
8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
9 | #include "xyarray.h" | 9 | #include "xyarray.h" |
10 | #include "cgroup.h" | ||
11 | #include "symbol.h" | 10 | #include "symbol.h" |
12 | 11 | ||
13 | struct perf_counts_values { | 12 | struct perf_counts_values { |
@@ -42,6 +41,8 @@ struct perf_sample_id { | |||
42 | u64 period; | 41 | u64 period; |
43 | }; | 42 | }; |
44 | 43 | ||
44 | struct cgroup_sel; | ||
45 | |||
45 | /** struct perf_evsel - event selector | 46 | /** struct perf_evsel - event selector |
46 | * | 47 | * |
47 | * @name - Can be set to retain the original event name passed by the user, | 48 | * @name - Can be set to retain the original event name passed by the user, |