diff options
| author | Ingo Molnar <mingo@kernel.org> | 2014-10-15 05:54:14 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2014-10-15 05:54:14 -0400 |
| commit | ec4212d88a77eb6caec10777ddd629b702a5ebbd (patch) | |
| tree | 03b4b08df9d633e15df8c0ff27444324adf4a312 /tools | |
| parent | 77654908ff1a58cee4886298968b5262884aff0b (diff) | |
| parent | 2c241bd35e6f626ad6f867dcf9fefdc2315f125f (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:
Infrastructure fixes and changes:
* Fix off-by-one bugs in map->end handling (Stephane Eranian)
* Fix off-by-one bug in maps__find(), also related to map->end handling (Namhyung Kim)
* Make struct symbol->end be the first addr after the symbol range, to make it
match the convention used for struct map->end. (Arnaldo Carvalho de Melo)
* Fix perf_evlist__add_pollfd() error handling in 'perf kvm stat live' (Jiri Olsa)
* Fix python test build by moving callchain_param to an object linked into the
python binding (Jiri Olsa)
* Do not include a struct hists per perf_evsel, untangling the histogram code
from perf_evsel, to pave the way for exporting a minimalistic
tools/lib/api/perf/ library usable by tools/perf and initially by the rasd
daemon being developed by Borislav Petkov, Robert Richter and Jean Pihet.
(Arnaldo Carvalho de Melo)
* Make perf_evlist__open(evlist, NULL, NULL), i.e. without cpu and thread
maps mean syswide monitoring, reducing the boilerplate for tools that
only want system wide mode. (Arnaldo Carvalho de Melo)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
35 files changed, 392 insertions, 229 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index be5939418425..e7417fe97a97 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
| @@ -51,6 +51,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel, | |||
| 51 | struct addr_location *al, | 51 | struct addr_location *al, |
| 52 | struct perf_annotate *ann) | 52 | struct perf_annotate *ann) |
| 53 | { | 53 | { |
| 54 | struct hists *hists = evsel__hists(evsel); | ||
| 54 | struct hist_entry *he; | 55 | struct hist_entry *he; |
| 55 | int ret; | 56 | int ret; |
| 56 | 57 | ||
| @@ -66,13 +67,12 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel, | |||
| 66 | return 0; | 67 | return 0; |
| 67 | } | 68 | } |
| 68 | 69 | ||
| 69 | he = __hists__add_entry(&evsel->hists, al, NULL, NULL, NULL, 1, 1, 0, | 70 | he = __hists__add_entry(hists, al, NULL, NULL, NULL, 1, 1, 0, true); |
| 70 | true); | ||
| 71 | if (he == NULL) | 71 | if (he == NULL) |
| 72 | return -ENOMEM; | 72 | return -ENOMEM; |
| 73 | 73 | ||
| 74 | ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 74 | ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); |
| 75 | hists__inc_nr_samples(&evsel->hists, true); | 75 | hists__inc_nr_samples(hists, true); |
| 76 | return ret; | 76 | return ret; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| @@ -214,6 +214,7 @@ static int __cmd_annotate(struct perf_annotate *ann) | |||
| 214 | 214 | ||
| 215 | if (dump_trace) { | 215 | if (dump_trace) { |
| 216 | perf_session__fprintf_nr_events(session, stdout); | 216 | perf_session__fprintf_nr_events(session, stdout); |
| 217 | perf_evlist__fprintf_nr_events(session->evlist, stdout); | ||
| 217 | goto out; | 218 | goto out; |
| 218 | } | 219 | } |
| 219 | 220 | ||
| @@ -225,7 +226,7 @@ static int __cmd_annotate(struct perf_annotate *ann) | |||
| 225 | 226 | ||
| 226 | total_nr_samples = 0; | 227 | total_nr_samples = 0; |
| 227 | evlist__for_each(session->evlist, pos) { | 228 | evlist__for_each(session->evlist, pos) { |
| 228 | struct hists *hists = &pos->hists; | 229 | struct hists *hists = evsel__hists(pos); |
| 229 | u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; | 230 | u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; |
| 230 | 231 | ||
| 231 | if (nr_samples > 0) { | 232 | if (nr_samples > 0) { |
| @@ -325,7 +326,10 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused) | |||
| 325 | "Show event group information together"), | 326 | "Show event group information together"), |
| 326 | OPT_END() | 327 | OPT_END() |
| 327 | }; | 328 | }; |
| 328 | int ret; | 329 | int ret = hists__init(); |
| 330 | |||
| 331 | if (ret < 0) | ||
| 332 | return ret; | ||
| 329 | 333 | ||
| 330 | argc = parse_options(argc, argv, options, annotate_usage, 0); | 334 | argc = parse_options(argc, argv, options, annotate_usage, 0); |
| 331 | 335 | ||
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index a3ce19f7aebd..8c5c11ca8c53 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
| @@ -327,6 +327,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused, | |||
| 327 | struct machine *machine) | 327 | struct machine *machine) |
| 328 | { | 328 | { |
| 329 | struct addr_location al; | 329 | struct addr_location al; |
| 330 | struct hists *hists = evsel__hists(evsel); | ||
| 330 | 331 | ||
| 331 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { | 332 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { |
| 332 | pr_warning("problem processing %d event, skipping it.\n", | 333 | pr_warning("problem processing %d event, skipping it.\n", |
| @@ -334,7 +335,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused, | |||
| 334 | return -1; | 335 | return -1; |
| 335 | } | 336 | } |
| 336 | 337 | ||
| 337 | if (hists__add_entry(&evsel->hists, &al, sample->period, | 338 | if (hists__add_entry(hists, &al, sample->period, |
| 338 | sample->weight, sample->transaction)) { | 339 | sample->weight, sample->transaction)) { |
| 339 | pr_warning("problem incrementing symbol period, skipping event\n"); | 340 | pr_warning("problem incrementing symbol period, skipping event\n"); |
| 340 | return -1; | 341 | return -1; |
| @@ -346,9 +347,9 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused, | |||
| 346 | * hists__output_resort() and precompute needs the total | 347 | * hists__output_resort() and precompute needs the total |
| 347 | * period in order to sort entries by percentage delta. | 348 | * period in order to sort entries by percentage delta. |
| 348 | */ | 349 | */ |
| 349 | evsel->hists.stats.total_period += sample->period; | 350 | hists->stats.total_period += sample->period; |
| 350 | if (!al.filtered) | 351 | if (!al.filtered) |
| 351 | evsel->hists.stats.total_non_filtered_period += sample->period; | 352 | hists->stats.total_non_filtered_period += sample->period; |
| 352 | 353 | ||
| 353 | return 0; | 354 | return 0; |
| 354 | } | 355 | } |
| @@ -382,7 +383,7 @@ static void perf_evlist__collapse_resort(struct perf_evlist *evlist) | |||
| 382 | struct perf_evsel *evsel; | 383 | struct perf_evsel *evsel; |
| 383 | 384 | ||
| 384 | evlist__for_each(evlist, evsel) { | 385 | evlist__for_each(evlist, evsel) { |
| 385 | struct hists *hists = &evsel->hists; | 386 | struct hists *hists = evsel__hists(evsel); |
| 386 | 387 | ||
| 387 | hists__collapse_resort(hists, NULL); | 388 | hists__collapse_resort(hists, NULL); |
| 388 | } | 389 | } |
| @@ -631,24 +632,26 @@ static void data_process(void) | |||
| 631 | bool first = true; | 632 | bool first = true; |
| 632 | 633 | ||
| 633 | evlist__for_each(evlist_base, evsel_base) { | 634 | evlist__for_each(evlist_base, evsel_base) { |
| 635 | struct hists *hists_base = evsel__hists(evsel_base); | ||
| 634 | struct data__file *d; | 636 | struct data__file *d; |
| 635 | int i; | 637 | int i; |
| 636 | 638 | ||
| 637 | data__for_each_file_new(i, d) { | 639 | data__for_each_file_new(i, d) { |
| 638 | struct perf_evlist *evlist = d->session->evlist; | 640 | |
