Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+57 -44
+20 -21
tools/perf/Documentation/perf-timechart.txt
··· 43 43 44 44 --symfs=<directory>:: 45 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 46 -n:: 68 47 --proc-num:: 69 48 Print task info for at least given number of tasks. ··· 66 87 -g:: 67 88 --callchain:: 68 89 Do call-graph (stack chain/backtrace) recording 90 + 91 + EXAMPLES 92 + -------- 93 + 94 + $ perf timechart record git pull 95 + 96 + [ perf record: Woken up 13 times to write data ] 97 + [ perf record: Captured and wrote 4.253 MB perf.data (~185801 samples) ] 98 + 99 + $ perf timechart 100 + 101 + Written 10.2 seconds of trace to output.svg. 102 + 103 + Record system-wide timechart: 104 + 105 + $ perf timechart record 106 + 107 + then generate timechart and highlight 'gcc' tasks: 108 + 109 + $ perf timechart --highlight gcc 69 110 70 111 SEE ALSO 71 112 --------
+14 -9
tools/perf/builtin-probe.c
··· 288 288 memset(&params, 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 298 static int 292 299 __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) 293 300 { ··· 386 379 } 387 380 ret = parse_probe_event_argv(argc, argv); 388 381 if (ret < 0) { 389 - pr_err(" Error: Parse Error. (%d)\n", ret); 382 + pr_err_with_code(" Error: Command Parse Error.", ret); 390 383 return ret; 391 384 } 392 385 } ··· 426 419 } 427 420 ret = show_perf_probe_events(); 428 421 if (ret < 0) 429 - pr_err(" Error: Failed to show event list. (%d)\n", 430 - ret); 422 + pr_err_with_code(" Error: Failed to show event list.", ret); 431 423 return ret; 432 424 } 433 425 if (params.show_funcs) { ··· 451 445 strfilter__delete(params.filter); 452 446 params.filter = NULL; 453 447 if (ret < 0) 454 - pr_err(" Error: Failed to show functions." 455 - " (%d)\n", ret); 448 + pr_err_with_code(" Error: Failed to show functions.", ret); 456 449 return ret; 457 450 } 458 451 ··· 469 464 470 465 ret = show_line_range(&params.line_range, params.target); 471 466 if (ret < 0) 472 - pr_err(" Error: Failed to show lines. (%d)\n", ret); 467 + pr_err_with_code(" Error: Failed to show lines.", ret); 473 468 return ret; 474 469 } 475 470 if (params.show_vars) { ··· 490 485 strfilter__delete(params.filter); 491 486 params.filter = NULL; 492 487 if (ret < 0) 493 - pr_err(" Error: Failed to show vars. (%d)\n", ret); 488 + pr_err_with_code(" Error: Failed to show vars.", ret); 494 489 return ret; 495 490 } 496 491 #endif ··· 498 493 if (params.dellist) { 499 494 ret = del_perf_probe_events(params.dellist); 500 495 if (ret < 0) { 501 - pr_err(" Error: Failed to delete events. (%d)\n", ret); 496 + pr_err_with_code(" Error: Failed to delete events.", ret); 502 497 return ret; 503 498 } 504 499 } ··· 509 504 params.target, 510 505 params.force_add); 511 506 if (ret < 0) { 512 - pr_err(" Error: Failed to add events. (%d)\n", ret); 507 + pr_err_with_code(" Error: Failed to add events.", ret); 513 508 return ret; 514 509 } 515 510 }
+5 -1
tools/perf/config/Makefile
··· 299 299 NO_LIBUNWIND := 1 300 300 NO_LIBDW_DWARF_UNWIND := 1 301 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 307 endif 304 308 else 305 309 ifndef NO_LIBDW_DWARF_UNWIND
+2 -5
tools/perf/tests/make
··· 205 205 ( eval $$cmd ) >> $@ 2>&1; \ 206 206 echo " test: $(call test,$@)" >> $@ 2>&1; \ 207 207 $(call test,$@) && \ 208 - rm -f $@ \ 209 - rm -rf $$TMP_DEST 208 + rm -rf $@ $$TMP_DEST || (cat $@ ; false) 210 209 211 210 $(run_O): 212 211 $(call clean) ··· 216 217 ( eval $$cmd ) >> $@ 2>&1 && \ 217 218 echo " test: $(call test_O,$@)" >> $@ 2>&1; \ 218 219 $(call test_O,$@) && \ 219 - rm -f $@ && \ 220 - rm -rf $$TMP_O \ 221 - rm -rf $$TMP_DEST 220 + rm -rf $@ $$TMP_O $$TMP_DEST || (cat $@ ; false) 222 221 223 222 tarpkg: 224 223 @cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \
+9 -4
tools/perf/util/probe-event.c
··· 628 628 629 629 ret = debuginfo__find_line_range(dinfo, lr); 630 630 debuginfo__delete(dinfo); 631 - if (ret == 0) { 631 + if (ret == 0 || ret == -ENOENT) { 632 632 pr_warning("Specified source line is not found.\n"); 633 633 return -ENOENT; 634 634 } else if (ret < 0) { 635 - pr_warning("Debuginfo analysis failed. (%d)\n", ret); 635 + pr_warning("Debuginfo analysis failed.\n"); 636 636 return ret; 637 637 } 638 638 ··· 641 641 ret = get_real_path(tmp, lr->comp_dir, &lr->path); 642 642 free(tmp); /* Free old path */ 643 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 645 return ret; 646 646 } 647 647 ··· 721 721 ret = debuginfo__find_available_vars_at(dinfo, pev, &vls, 722 722 max_vls, externs); 723 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 729 goto end; 726 730 } 731 + 727 732 /* Some variables are found */ 728 733 fprintf(stdout, "Available variables at %s\n", buf); 729 734 for (i = 0; i < ret; i++) {
+7 -4
tools/perf/util/probe-finder.c
··· 573 573 if (!die_find_variable_at(sc_die, pf->pvar->var, pf->addr, &vr_die)) { 574 574 /* Search again in global variables */ 575 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 578 ret = -ENOENT; 577 579 } 578 580 if (ret >= 0) 579 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 583 return ret; 585 584 } 586 585 ··· 1280 1281 return ret; 1281 1282 } 1282 1283 1283 - /* Find available variables at given probe point */ 1284 + /* 1285 + * Find available variables at given probe point 1286 + * Return the number of found probe points. Return 0 if there is no 1287 + * matched probe point. Return <0 if an error occurs. 1288 + */ 1284 1289 int debuginfo__find_available_vars_at(struct debuginfo *dbg, 1285 1290 struct perf_probe_event *pev, 1286 1291 struct variable_list **vls,