diff options
author | Ingo Molnar <mingo@kernel.org> | 2014-06-12 07:54:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-06-12 07:54:42 -0400 |
commit | 7184062b94b4bfac08715fb786fd2df399c5d6ee (patch) | |
tree | 1d6a975c5998bbbc2ff34edf9f67260145795cdd /tools/perf | |
parent | 94eb153130ce2c5f5f4959c96ea8197475bd66b6 (diff) | |
parent | f48e00cead1f7574147e6bd0d203c8331714d35b (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements from Arnaldo Carvalho de Melo:
User visible:
* Improve 'perf probe' error messages, moving some diagnostic messages to
only appear in --verbose mode and fixing up some error reporting related
to variables and struct members. (Masami Hiramatsu)
* Reflow 'perf timechart' man page. (Stanislav Fomichev)
Developer stuff:
* Be more precise when reporting missing libraries in a static tool build.
(Arnaldo Carvalho de Melo)
* Show error messages from the multiple make invoked from 'make build-test'.
(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/perf')
-rw-r--r-- | tools/perf/Documentation/perf-timechart.txt | 41 | ||||
-rw-r--r-- | tools/perf/builtin-probe.c | 23 | ||||
-rw-r--r-- | tools/perf/config/Makefile | 6 | ||||
-rw-r--r-- | tools/perf/tests/make | 7 | ||||
-rw-r--r-- | tools/perf/util/probe-event.c | 13 | ||||
-rw-r--r-- | tools/perf/util/probe-finder.c | 11 |
6 files changed, 57 insertions, 44 deletions
diff --git a/tools/perf/Documentation/perf-timechart.txt b/tools/perf/Documentation/perf-timechart.txt index bc5990c33dc0..5e0f986dff38 100644 --- a/tools/perf/Documentation/perf-timechart.txt +++ b/tools/perf/Documentation/perf-timechart.txt | |||
@@ -43,27 +43,6 @@ TIMECHART OPTIONS | |||
43 | 43 | ||
44 | --symfs=<directory>:: | 44 | --symfs=<directory>:: |
45 | Look for files with symbols relative to this directory. | 45 | Look for files with symbols relative to this directory. |
46 | |||
47 | EXAMPLES | ||
48 | -------- | ||
49 | |||
50 | $ perf timechart record git pull | ||
51 | |||
52 | [ perf record: Woken up 13 times to write data ] | ||
53 | [ perf record: Captured and wrote 4.253 MB perf.data (~185801 samples) ] | ||
54 | |||
55 | $ perf timechart | ||
56 | |||
57 | Written 10.2 seconds of trace to output.svg. | ||
58 | |||
59 | Record system-wide timechart: | ||
60 | |||
61 | $ perf timechart record | ||
62 | |||
63 | then generate timechart and highlight 'gcc' tasks: | ||
64 | |||
65 | $ perf timechart --highlight gcc | ||
66 | |||
67 | -n:: | 46 | -n:: |
68 | --proc-num:: | 47 | --proc-num:: |
69 | Print task info for at least given number of tasks. | 48 | Print task info for at least given number of tasks. |
@@ -88,6 +67,26 @@ RECORD OPTIONS | |||
88 | --callchain:: | 67 | --callchain:: |
89 | Do call-graph (stack chain/backtrace) recording | 68 | Do call-graph (stack chain/backtrace) recording |
90 | 69 | ||
70 | EXAMPLES | ||
71 | -------- | ||
72 | |||
73 | $ perf timechart record git pull | ||
74 | |||
75 | [ perf record: Woken up 13 times to write data ] | ||
76 | [ perf record: Captured and wrote 4.253 MB perf.data (~185801 samples) ] | ||
77 | |||
78 | $ perf timechart | ||
79 | |||
80 | Written 10.2 seconds of trace to output.svg. | ||
81 | |||
82 | Record system-wide timechart: | ||
83 | |||
84 | $ perf timechart record | ||
85 | |||
86 | then generate timechart and highlight 'gcc' tasks: | ||
87 | |||
88 | $ perf timechart --highlight gcc | ||
89 | |||
91 | SEE ALSO | 90 | SEE ALSO |
92 | -------- | 91 | -------- |
93 | linkperf:perf-record[1] | 92 | linkperf:perf-record[1] |
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index cdcd4eb3a57d..c63fa2925075 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
@@ -288,6 +288,13 @@ static void cleanup_params(void) | |||
288 | memset(¶ms, 0, sizeof(params)); | 288 | memset(¶ms, 0, sizeof(params)); |
289 | } | 289 | } |
290 | 290 | ||
291 | static void pr_err_with_code(const char *msg, int err) | ||
292 | { | ||
293 | pr_err("%s", msg); | ||
294 | pr_debug(" Reason: %s (Code: %d)", strerror(-err), err); | ||
295 | pr_err("\n"); | ||
296 | } | ||
297 | |||
291 | static int | 298 | static int |
292 | __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | 299 | __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) |
293 | { | 300 | { |
@@ -379,7 +386,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
379 | } | 386 | } |
380 | ret = parse_probe_event_argv(argc, argv); | 387 | ret = parse_probe_event_argv(argc, argv); |
381 | if (ret < 0) { | 388 | if (ret < 0) { |
382 | pr_err(" Error: Parse Error. (%d)\n", ret); | 389 | pr_err_with_code(" Error: Command Parse Error.", ret); |
383 | return ret; | 390 | return ret; |
384 | } | 391 | } |
385 | } | 392 | } |
@@ -419,8 +426,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
419 | } | 426 | } |
420 | ret = show_perf_probe_events(); | 427 | ret = show_perf_probe_events(); |
421 | if (ret < 0) | 428 | if (ret < 0) |
422 | pr_err(" Error: Failed to show event list. (%d)\n", | 429 | pr_err_with_code(" Error: Failed to show event list.", ret); |
423 | ret); | ||
424 | return ret; | 430 | return ret; |
425 | } | 431 | } |
426 | if (params.show_funcs) { | 432 | if (params.show_funcs) { |
@@ -445,8 +451,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
445 | strfilter__delete(params.filter); | 451 | strfilter__delete(params.filter); |
446 | params.filter = NULL; | 452 | params.filter = NULL; |
447 | if (ret < 0) | 453 | if (ret < 0) |
448 | pr_err(" Error: Failed to show functions." | 454 | pr_err_with_code(" Error: Failed to show functions.", ret); |
449 | " (%d)\n", ret); | ||
450 | return ret; | 455 | return ret; |
451 | } | 456 | } |
452 | 457 | ||
@@ -464,7 +469,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
464 | 469 | ||
465 | ret = show_line_range(¶ms.line_range, params.target); | 470 | ret = show_line_range(¶ms.line_range, params.target); |
466 | if (ret < 0) | 471 | if (ret < 0) |
467 | pr_err(" Error: Failed to show lines. (%d)\n", ret); | 472 | pr_err_with_code(" Error: Failed to show lines.", ret); |
468 | return ret; | 473 | return ret; |
469 | } | 474 | } |
470 | if (params.show_vars) { | 475 | if (params.show_vars) { |
@@ -485,7 +490,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
485 | strfilter__delete(params.filter); | 490 | strfilter__delete(params.filter); |
486 | params.filter = NULL; | 491 | params.filter = NULL; |
487 | if (ret < 0) | 492 | if (ret < 0) |
488 | pr_err(" Error: Failed to show vars. (%d)\n", ret); | 493 | pr_err_with_code(" Error: Failed to show vars.", ret); |
489 | return ret; | 494 | return ret; |
490 | } | 495 | } |
491 | #endif | 496 | #endif |
@@ -493,7 +498,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
493 | if (params.dellist) { | 498 | if (params.dellist) { |
494 | ret = del_perf_probe_events(params.dellist); | 499 | ret = del_perf_probe_events(params.dellist); |
495 | if (ret < 0) { | 500 | if (ret < 0) { |
496 | pr_err(" Error: Failed to delete events. (%d)\n", ret); | 501 | pr_err_with_code(" Error: Failed to delete events.", ret); |
497 | return ret; | 502 | return ret; |
498 | } | 503 | } |
499 | } | 504 | } |
@@ -504,7 +509,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
504 | params.target, | 509 | params.target, |
505 | params.force_add); | 510 | params.force_add); |
506 | if (ret < 0) { | 511 | if (ret < 0) { |
507 | pr_err(" Error: Failed to add events. (%d)\n", ret); | 512 | pr_err_with_code(" Error: Failed to add events.", ret); |
508 | return ret; | 513 | return ret; |
509 | } | 514 | } |
510 | } | 515 | } |
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 4f100b54ba8b..f30ac5e5d271 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -299,7 +299,11 @@ else | |||
299 | NO_LIBUNWIND := 1 | 299 | NO_LIBUNWIND := 1 |
300 | NO_LIBDW_DWARF_UNWIND := 1 | 300 | NO_LIBDW_DWARF_UNWIND := 1 |
301 | else | 301 | else |
302 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); | 302 | ifneq ($(filter s% -static%,$(LDFLAGS),),) |
303 | msg := $(error No static glibc found, please install glibc-static); | ||
304 | else | ||
305 | msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]); | ||
306 | endif | ||
303 | endif | 307 | endif |
304 | else | 308 | else |
305 | ifndef NO_LIBDW_DWARF_UNWIND | 309 | ifndef NO_LIBDW_DWARF_UNWIND |
diff --git a/tools/perf/tests/make b/tools/perf/tests/make index 2f92d6e7ee00..69a71ff84e01 100644 --- a/tools/perf/tests/make +++ b/tools/perf/tests/make | |||
@@ -205,8 +205,7 @@ $(run): | |||
205 | ( eval $$cmd ) >> $@ 2>&1; \ | 205 | ( eval $$cmd ) >> $@ 2>&1; \ |
206 | echo " test: $(call test,$@)" >> $@ 2>&1; \ | 206 | echo " test: $(call test,$@)" >> $@ 2>&1; \ |
207 | $(call test,$@) && \ | 207 | $(call test,$@) && \ |
208 | rm -f $@ \ | 208 | rm -rf $@ $$TMP_DEST || (cat $@ ; false) |
209 | rm -rf $$TMP_DEST | ||
210 | 209 | ||
211 | $(run_O): | 210 | $(run_O): |
212 | $(call clean) | 211 | $(call clean) |
@@ -217,9 +216,7 @@ $(run_O): | |||
217 | ( eval $$cmd ) >> $@ 2>&1 && \ | 216 | ( eval $$cmd ) >> $@ 2>&1 && \ |
218 | echo " test: $(call test_O,$@)" >> $@ 2>&1; \ | 217 | echo " test: $(call test_O,$@)" >> $@ 2>&1; \ |
219 | $(call test_O,$@) && \ | 218 | $(call test_O,$@) && \ |
220 | rm -f $@ && \ | 219 | rm -rf $@ $$TMP_O $$TMP_DEST || (cat $@ ; false) |
221 | rm -rf $$TMP_O \ | ||
222 | rm -rf $$TMP_DEST | ||
223 | 220 | ||
224 | tarpkg: | 221 | tarpkg: |
225 | @cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \ | 222 | @cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \ |
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 0d1542f33d87..9a0a1839a377 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -628,11 +628,11 @@ static int __show_line_range(struct line_range *lr, const char *module) | |||
628 | 628 | ||
629 | ret = debuginfo__find_line_range(dinfo, lr); | 629 | ret = debuginfo__find_line_range(dinfo, lr); |
630 | debuginfo__delete(dinfo); | 630 | debuginfo__delete(dinfo); |
631 | if (ret == 0) { | 631 | if (ret == 0 || ret == -ENOENT) { |
632 | pr_warning("Specified source line is not found.\n"); | 632 | pr_warning("Specified source line is not found.\n"); |
633 | return -ENOENT; | 633 | return -ENOENT; |
634 | } else if (ret < 0) { | 634 | } else if (ret < 0) { |
635 | pr_warning("Debuginfo analysis failed. (%d)\n", ret); | 635 | pr_warning("Debuginfo analysis failed.\n"); |
636 | return ret; | 636 | return ret; |
637 | } | 637 | } |
638 | 638 | ||
@@ -641,7 +641,7 @@ static int __show_line_range(struct line_range *lr, const char *module) | |||
641 | ret = get_real_path(tmp, lr->comp_dir, &lr->path); | 641 | ret = get_real_path(tmp, lr->comp_dir, &lr->path); |
642 | free(tmp); /* Free old path */ | 642 | free(tmp); /* Free old path */ |
643 | if (ret < 0) { | 643 | if (ret < 0) { |
644 | pr_warning("Failed to find source file. (%d)\n", ret); | 644 | pr_warning("Failed to find source file path.\n"); |
645 | return ret; | 645 | return ret; |
646 | } | 646 | } |
647 | 647 | ||
@@ -721,9 +721,14 @@ static int show_available_vars_at(struct debuginfo *dinfo, | |||
721 | ret = debuginfo__find_available_vars_at(dinfo, pev, &vls, | 721 | ret = debuginfo__find_available_vars_at(dinfo, pev, &vls, |
722 | max_vls, externs); | 722 | max_vls, externs); |
723 | if (ret <= 0) { | 723 | if (ret <= 0) { |
724 | pr_err("Failed to find variables at %s (%d)\n", buf, ret); | 724 | if (ret == 0 || ret == -ENOENT) { |
725 | pr_err("Failed to find the address of %s\n", buf); | ||
726 | ret = -ENOENT; | ||
727 | } else | ||
728 | pr_warning("Debuginfo analysis failed.\n"); | ||
725 | goto end; | 729 | goto end; |
726 | } | 730 | } |
731 | |||
727 | /* Some variables are found */ | 732 | /* Some variables are found */ |
728 | fprintf(stdout, "Available variables at %s\n", buf); | 733 | fprintf(stdout, "Available variables at %s\n", buf); |
729 | for (i = 0; i < ret; i++) { | 734 | for (i = 0; i < ret; i++) { |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 9d8eb26f0533..98e304766416 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -573,14 +573,13 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf) | |||
573 | if (!die_find_variable_at(sc_die, pf->pvar->var, pf->addr, &vr_die)) { | 573 | if (!die_find_variable_at(sc_die, pf->pvar->var, pf->addr, &vr_die)) { |
574 | /* Search again in global variables */ | 574 | /* Search again in global variables */ |
575 | if (!die_find_variable_at(&pf->cu_die, pf->pvar->var, 0, &vr_die)) | 575 | if (!die_find_variable_at(&pf->cu_die, pf->pvar->var, 0, &vr_die)) |
576 | pr_warning("Failed to find '%s' in this function.\n", | ||
577 | pf->pvar->var); | ||
576 | ret = -ENOENT; | 578 | ret = -ENOENT; |
577 | } | 579 | } |
578 | if (ret >= 0) | 580 | if (ret >= 0) |
579 | ret = convert_variable(&vr_die, pf); | 581 | ret = convert_variable(&vr_die, pf); |
580 | 582 | ||
581 | if (ret < 0) | ||
582 | pr_warning("Failed to find '%s' in this function.\n", | ||
583 | pf->pvar->var); | ||
584 | return ret; | 583 | return ret; |
585 | } | 584 | } |
586 | 585 | ||
@@ -1281,7 +1280,11 @@ out: | |||
1281 | return ret; | 1280 | return ret; |
1282 | } | 1281 | } |
1283 | 1282 | ||
1284 | /* Find available variables at given probe point */ | 1283 | /* |
1284 | * Find available variables at given probe point | ||
1285 | * Return the number of found probe points. Return 0 if there is no | ||
1286 | * matched probe point. Return <0 if an error occurs. | ||
1287 | */ | ||
1285 | int debuginfo__find_available_vars_at(struct debuginfo *dbg, | 1288 | int debuginfo__find_available_vars_at(struct debuginfo *dbg, |
1286 | struct perf_probe_event *pev, | 1289 | struct perf_probe_event *pev, |
1287 | struct variable_list **vls, | 1290 | struct variable_list **vls, |