Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1344828
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 15/19] perf report: Update column width of dynamic entries |
| Date | 2016-02-27 00:30 +0100 |
| Message-ID | <r6zZD-2as-1@gated-at.bofh.it> (permalink) |
| References | <r6zPY-26L-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Namhyung Kim <namhyung@kernel.org>
The column width of dynamic entries is updated when comparing hist
entries. However some unique entries can miss the chance to update. So
move the update to output resort stage to make sure every entry will get
called before display.
To do that, abuse ->sort callback to update the width when the third
argument is NULL. When resorting entries in normal path, it never be
NULL so it should be fine IMHO.
Before:
# Overhead ptr / bytes_req / gfp_flags
# .............. ..........................................
#
37.50% 0xffff8803f7669400
37.50% 448
37.50% GFP_ATOMIC|GFP_NOWARN|GFP_NOMEMALLOC
10.42% 0xffff8803f766be00
8.33% 96
8.33% GFP_ATOMIC|GFP_NOWARN|GFP_NOMEMALLOC
2.08% 512
2.08% GFP_KERNEL|GFP_NOWARN|GFP_REPEAT|GFP <-- here
After:
# Overhead ptr / bytes_req / gfp_flags
# .............. .....................................................
#
37.50% 0xffff8803f7669400
37.50% 448
37.50% GFP_ATOMIC|GFP_NOWARN|GFP_NOMEMALLOC
10.42% 0xffff8803f766be00
8.33% 96
8.33% GFP_ATOMIC|GFP_NOWARN|GFP_NOMEMALLOC
2.08% 512
2.08% GFP_KERNEL|GFP_NOWARN|GFP_REPEAT|GFP_NOMEMALLOC
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1456512767-1164-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/hist.c | 11 +++++++++++
tools/perf/util/sort.c | 8 +++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 9b3f582867d6..4b8b67bc0cd8 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1371,6 +1371,10 @@ static void hierarchy_insert_output_entry(struct rb_root *root,
rb_link_node(&he->rb_node, parent, p);
rb_insert_color(&he->rb_node, root);
+
+ /* update column width of dynamic entry */
+ if (perf_hpp__is_dynamic_entry(he->fmt))
+ he->fmt->sort(he->fmt, he, NULL);
}
static void hists__hierarchy_output_resort(struct hists *hists,
@@ -1440,6 +1444,7 @@ static void __hists__insert_output_entry(struct rb_root *entries,
struct rb_node **p = &entries->rb_node;
struct rb_node *parent = NULL;
struct hist_entry *iter;
+ struct perf_hpp_fmt *fmt;
if (use_callchain) {
if (callchain_param.mode == CHAIN_GRAPH_REL) {
@@ -1466,6 +1471,12 @@ static void __hists__insert_output_entry(struct rb_root *entries,
rb_link_node(&he->rb_node, parent, p);
rb_insert_color(&he->rb_node, entries);
+
+ perf_hpp_list__for_each_sort_list(&perf_hpp_list, fmt) {
+ if (perf_hpp__is_dynamic_entry(fmt) &&
+ perf_hpp__defined_dynamic_entry(fmt, he->hists))
+ fmt->sort(fmt, he, NULL); /* update column width */
+ }
}
static void output_resort(struct hists *hists, struct ui_progress *prog,
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index d26c6b9fe348..5888bfe9a193 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1816,6 +1816,11 @@ static int64_t __sort__hde_cmp(struct perf_hpp_fmt *fmt,
hde = container_of(fmt, struct hpp_dynamic_entry, hpp);
+ if (b == NULL) {
+ update_dynamic_len(hde, a);
+ return 0;
+ }
+
field = hde->field;
if (field->flags & FIELD_IS_DYNAMIC) {
unsigned long long dyn;
@@ -1830,9 +1835,6 @@ static int64_t __sort__hde_cmp(struct perf_hpp_fmt *fmt,
} else {
offset = field->offset;
size = field->size;
-
- update_dynamic_len(hde, a);
- update_dynamic_len(hde, b);
}
return memcmp(a->raw_data + offset, b->raw_data + offset, size);
--
2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:20 +0100 [PATCH 04/19] perf script: Exception handling when the print fmt is empty Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:20 +0100 [PATCH 13/19] perf report: Left align dynamic entries in hierarchy Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:20 +0100 [PATCH 11/19] perf hists: Fix comparing of dynamic entries Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:20 +0100 [PATCH 15/19] perf report: Update column width of dynamic entries Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 10/19] perf report: Show message for percent limit on gtk Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 06/19] perf hists: Add more helper functions for the hierarchy mode Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 18/19] perf trace: Call bpf__apply_obj_config in 'perf trace' Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 14/19] perf hists: Fix dynamic entry display in hierarchy Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 03/19] perf tools: Fix parsing of pmu events with empty list of modifiers Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 16/19] perf config: Bring perf_default_config to the very beginning at main() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 08/19] perf hists browser: Cleanup hist_browser__update_percent_limit() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 01/19] perf tools: Use asprintf() for simple string formatting/allocation Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 02/19] perf jvmti: improve error message in Makefile Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 19/19] perf trace: Print content of bpf-output event Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 09/19] perf hists browser: Show message for percent limit Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 05/19] perf script: Remove duplicated code and needless script_spec__findnew() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 [PATCH 07/19] perf report: Show message for percent limit on stdio Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-27 00:30 +0100 Re: [GIT PULL 00/19] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-02-27 10:40 +0100
csiph-web