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

Commit 361459f1 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo
Browse files

perf tools: Skip dynamic fields not defined for current event



When there are multiple events, each dynamic sort key is defined just
for one event.  In this case other events will always show "N/A" for
those fields.  But they are meaningless and consume precious screen
width.

Let's skip those undefined dynamic fields.

  $ perf record -e kmem:kmalloc,kmem:kfree -a sleep 1

  $ perf report -s 'comm,kmalloc.*' --stdio
  # To display the perf.data header info, please use --header/--header-only options.
  #
  #
  # Total Lost Samples: 0
  #
  # Samples: 20K of event 'kmem:kmalloc'
  # Event count (approx.): 20533
  #
  # Overhead  Command           call_site                 ptr  bytes_req  bytes_alloc            gfp_flags
  # ........  .......  ..................  ..................  .........  ...........  ...................
  #
      99.89%  perf       ffffffffa01d4396  0xffff8803ffb79720         96           96    GFP_NOFS|GFP_ZERO
       0.06%  sleep      ffffffff8114e1cd  0xffff8803d228a000       4096         4096           GFP_KERNEL
       0.03%  perf       ffffffff811d6ae6  0xffff8803f7678f00        240          256  GFP_KERNEL|GFP_ZERO
       0.00%  perf       ffffffff812263c1  0xffff880406172380        128          128           GFP_KERNEL
       0.00%  perf       ffffffff812264b9  0xffff8803ffac1600        504          512           GFP_KERNEL
       0.00%  perf       ffffffff81226634  0xffff880401dc5280         28           32           GFP_KERNEL
       0.00%  sleep      ffffffff81226da9  0xffff8803ffac3a00        392          512           GFP_KERNEL

  # Samples: 20K of event 'kmem:kfree'
  # Event count (approx.): 20597
  #
  # Overhead  Command
  # ........  ..............
  #
      99.63%  perf
       0.14%  sleep
       0.11%  irq/36-iwlwifi
       0.11%  kworker/u16:0
       0.01%  Xorg
       0.00%  firefox

Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1450804030-29193-12-git-send-email-namhyung@kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 3b099bf5
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -1041,7 +1041,8 @@ static int hist_browser__show_entry(struct hist_browser *browser,
		hist_browser__gotorc(browser, row, 0);
		hist_browser__gotorc(browser, row, 0);


		perf_hpp__for_each_format(fmt) {
		perf_hpp__for_each_format(fmt) {
			if (perf_hpp__should_skip(fmt) || column++ < browser->b.horiz_scroll)
			if (perf_hpp__should_skip(fmt, entry->hists) ||
			    column++ < browser->b.horiz_scroll)
				continue;
				continue;


			if (current_entry && browser->b.navkeypressed) {
			if (current_entry && browser->b.navkeypressed) {
@@ -1144,7 +1145,7 @@ static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *
	}
	}


	perf_hpp__for_each_format(fmt) {
	perf_hpp__for_each_format(fmt) {
		if (perf_hpp__should_skip(fmt)  || column++ < browser->b.horiz_scroll)
		if (perf_hpp__should_skip(fmt, hists)  || column++ < browser->b.horiz_scroll)
			continue;
			continue;


		ret = fmt->header(fmt, &dummy_hpp, hists_to_evsel(hists));
		ret = fmt->header(fmt, &dummy_hpp, hists_to_evsel(hists));
@@ -1414,7 +1415,7 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser,
		printed += fprintf(fp, "%c ", folded_sign);
		printed += fprintf(fp, "%c ", folded_sign);


	perf_hpp__for_each_format(fmt) {
	perf_hpp__for_each_format(fmt) {
		if (perf_hpp__should_skip(fmt))
		if (perf_hpp__should_skip(fmt, he->hists))
			continue;
			continue;


		if (!first) {
		if (!first) {
+2 −2
Original line number Original line Diff line number Diff line
@@ -318,7 +318,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
	col_idx = 0;
	col_idx = 0;


	perf_hpp__for_each_format(fmt) {
	perf_hpp__for_each_format(fmt) {
		if (perf_hpp__should_skip(fmt))
		if (perf_hpp__should_skip(fmt, hists))
			continue;
			continue;


		/*
		/*
@@ -368,7 +368,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
		col_idx = 0;
		col_idx = 0;


		perf_hpp__for_each_format(fmt) {
		perf_hpp__for_each_format(fmt) {
			if (perf_hpp__should_skip(fmt))
			if (perf_hpp__should_skip(fmt, h->hists))
				continue;
				continue;


			if (fmt->color)
			if (fmt->color)
+1 −1
Original line number Original line Diff line number Diff line
@@ -619,7 +619,7 @@ unsigned int hists__sort_list_width(struct hists *hists)
	struct perf_hpp dummy_hpp;
	struct perf_hpp dummy_hpp;


	perf_hpp__for_each_format(fmt) {
	perf_hpp__for_each_format(fmt) {
		if (perf_hpp__should_skip(fmt))
		if (perf_hpp__should_skip(fmt, hists))
			continue;
			continue;


		if (first)
		if (first)
+3 −3
Original line number Original line Diff line number Diff line
@@ -385,7 +385,7 @@ static int hist_entry__snprintf(struct hist_entry *he, struct perf_hpp *hpp)
		return 0;
		return 0;


	perf_hpp__for_each_format(fmt) {
	perf_hpp__for_each_format(fmt) {
		if (perf_hpp__should_skip(fmt))
		if (perf_hpp__should_skip(fmt, he->hists))
			continue;
			continue;


		/*
		/*
@@ -464,7 +464,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
	fprintf(fp, "# ");
	fprintf(fp, "# ");


	perf_hpp__for_each_format(fmt) {
	perf_hpp__for_each_format(fmt) {
		if (perf_hpp__should_skip(fmt))
		if (perf_hpp__should_skip(fmt, hists))
			continue;
			continue;


		if (!first)
		if (!first)
@@ -490,7 +490,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
	perf_hpp__for_each_format(fmt) {
	perf_hpp__for_each_format(fmt) {
		unsigned int i;
		unsigned int i;


		if (perf_hpp__should_skip(fmt))
		if (perf_hpp__should_skip(fmt, hists))
			continue;
			continue;


		if (!first)
		if (!first)
+1 −1
Original line number Original line Diff line number Diff line
@@ -1112,7 +1112,7 @@ static int hist_entry__sort(struct hist_entry *a, struct hist_entry *b)
	int64_t cmp = 0;
	int64_t cmp = 0;


	perf_hpp__for_each_sort_list(fmt) {
	perf_hpp__for_each_sort_list(fmt) {
		if (perf_hpp__should_skip(fmt))
		if (perf_hpp__should_skip(fmt, a->hists))
			continue;
			continue;


		cmp = fmt->sort(fmt, a, b);
		cmp = fmt->sort(fmt, a, b);
Loading