Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f9db0d0f authored by Kan Liang's avatar Kan Liang Committed by Arnaldo Carvalho de Melo
Browse files

perf callchain: Allow disabling call graphs per event



This patch introduce "call-graph=no" to disable per-event callgraph.

Here is an example.

  perf record -e 'cpu/cpu-cycles,call-graph=fp/,cpu/instructions,call-graph=no/' sleep 1

  perf report --stdio

  # To display the perf.data header info, please use
  --header/--header-only options.
  #
  #
  # Total Lost Samples: 0
  #
  # Samples: 6  of event 'cpu/cpu-cycles,call-graph=fp/'
  # Event count (approx.): 774218
  #
  # Children      Self  Command  Shared Object     Symbol
  # ........  ........  .......  ................  ........................................
  #
    61.94%     0.00%  sleep    [kernel.vmlinux]  [k] entry_SYSCALL_64_fastpath
              |
              ---entry_SYSCALL_64_fastpath
                 |
                 |--97.30%-- __brk
                 |
                  --2.70%-- mmap64
                            _dl_check_map_versions
                            _dl_check_all_versions

    61.94%     0.00%  sleep    [kernel.vmlinux]  [k] perf_event_mmap
              |
              ---perf_event_mmap
                 |
                 |--97.30%-- do_brk
                 |          sys_brk
                 |          entry_SYSCALL_64_fastpath
                 |          __brk
                 |
                  --2.70%-- mmap_region
                            do_mmap_pgoff
                            vm_mmap_pgoff
                            sys_mmap_pgoff
                            sys_mmap
                            entry_SYSCALL_64_fastpath
                            mmap64
                            _dl_check_map_versions
                            _dl_check_all_versions
  ......

  # Samples: 6  of event 'cpu/instructions,call-graph=no/'
  # Event count (approx.): 359692
  #
  # Children      Self  Command  Shared Object     Symbol
  # ........  ........  .......  ................  .................................
  #
     89.03%     0.00%  sleep    [unknown]         [.] 0xffff6598ffff6598
     89.03%     0.00%  sleep    ld-2.17.so        [.] _dl_resolve_conflicts
     89.03%     0.00%  sleep    [kernel.vmlinux]  [k] page_fault

Signed-off-by: default avatarKan Liang <kan.liang@intel.com>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1439289050-40510-2-git-send-email-kan.liang@intel.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent d457c963
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -54,7 +54,8 @@ OPTIONS
		    enabling time stamping. 0 for disabling time stamping.
		    The default is 1.
	  - 'call-graph': Disable/enable callgraph. Acceptable str are "fp" for
			 FP mode, "dwarf" for DWARF mode, "lbr" for LBR mode.
			 FP mode, "dwarf" for DWARF mode, "lbr" for LBR mode and
			 "no" for disable callgraph.
	  - 'stack-size': user stack size for dwarf mode
	  Note: If user explicitly sets options which conflict with the params,
	  the value set by the params will be overridden.
+2 −0
Original line number Diff line number Diff line
@@ -239,6 +239,8 @@ static int __cmd_annotate(struct perf_annotate *ann)
		if (nr_samples > 0) {
			total_nr_samples += nr_samples;
			hists__collapse_resort(hists, NULL);
			/* Don't sort callchain */
			perf_evsel__reset_sample_bit(pos, CALLCHAIN);
			hists__output_resort(hists, NULL);

			if (symbol_conf.event_group &&
+3 −0
Original line number Diff line number Diff line
@@ -722,6 +722,9 @@ static void data_process(void)
		if (verbose || data__files_cnt > 2)
			data__fprintf();

		/* Don't sort callchain for perf diff */
		perf_evsel__reset_sample_bit(evsel_base, CALLCHAIN);

		hists__process(hists_base);
	}
}
+4 −0
Original line number Diff line number Diff line
@@ -279,6 +279,7 @@ static int test1(struct perf_evsel *evsel, struct machine *machine)

	symbol_conf.use_callchain = false;
	symbol_conf.cumulate_callchain = false;
	perf_evsel__reset_sample_bit(evsel, CALLCHAIN);

	setup_sorting();
	callchain_register_param(&callchain_param);
@@ -425,6 +426,7 @@ static int test2(struct perf_evsel *evsel, struct machine *machine)

	symbol_conf.use_callchain = true;
	symbol_conf.cumulate_callchain = false;
	perf_evsel__set_sample_bit(evsel, CALLCHAIN);

	setup_sorting();
	callchain_register_param(&callchain_param);
@@ -482,6 +484,7 @@ static int test3(struct perf_evsel *evsel, struct machine *machine)

	symbol_conf.use_callchain = false;
	symbol_conf.cumulate_callchain = true;
	perf_evsel__reset_sample_bit(evsel, CALLCHAIN);

	setup_sorting();
	callchain_register_param(&callchain_param);
@@ -665,6 +668,7 @@ static int test4(struct perf_evsel *evsel, struct machine *machine)

	symbol_conf.use_callchain = true;
	symbol_conf.cumulate_callchain = true;
	perf_evsel__set_sample_bit(evsel, CALLCHAIN);

	setup_sorting();
	callchain_register_param(&callchain_param);
+11 −6
Original line number Diff line number Diff line
@@ -651,6 +651,10 @@ static void apply_config_terms(struct perf_evsel *evsel,

		/* parse callgraph parameters */
		if (callgraph_buf != NULL) {
			if (!strcmp(callgraph_buf, "no")) {
				param.enabled = false;
				param.record_mode = CALLCHAIN_NONE;
			} else {
				param.enabled = true;
				if (parse_callchain_record(callgraph_buf, &param)) {
					pr_err("per-event callgraph setting for %s failed. "
@@ -659,6 +663,7 @@ static void apply_config_terms(struct perf_evsel *evsel,
					return;
				}
			}
		}
		if (dump_size > 0) {
			dump_size = round_up(dump_size, sizeof(u64));
			param.dump_size = dump_size;
Loading