Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1342612 > unrolled thread
| Started by | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| First post | 2016-02-25 03:10 +0100 |
| Last post | 2016-02-25 08:30 +0100 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-25 03:10 +0100
[PATCH 19/31] perf hists: Support filtering in hierarchy mode Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-25 03:10 +0100
[PATCH 25/31] perf hists browser: Support collapsing/expanding whole entries in hierarchy Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-25 03:10 +0100
Re: [GIT PULL 00/31] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-02-25 08:30 +0100
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-02-25 03:10 +0100 |
| Subject | [GIT PULL 00/31] perf/core improvements and fixes |
| Message-ID | <r5TnI-4WP-11@gated-at.bofh.it> |
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit c2b8d8c55c0235e21c563283f634bcfd2ba7bc1e:
Merge tag 'perf-core-for-mingo-2' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-02-24 08:20:30 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-20160224
for you to fetch changes up to c92fcfde3486fb4b9e476ee5ad5995a62e401cce:
perf top: Add --hierarchy option (2016-02-24 20:21:15 -0300)
----------------------------------------------------------------
perf/core improvements:
User visible:
- Hierarchy histogram mode for 'perf top' and 'perf report', showing multiple
levels, one per --sort entry: (Namhyung Kim)
On a mostly idle system:
# perf top --hierarchy -s comm,dso
Then expand some levels and use 'P' to take a snapshot:
# cat perf.hist.0
- 92.32% perf
58.20% perf
22.29% libc-2.22.so
5.97% [kernel]
4.18% libelf-0.165.so
1.69% [unknown]
- 4.71% qemu-system-x86
3.10% [kernel]
1.60% qemu-system-x86_64 (deleted)
+ 2.97% swapper
#
- Check availability of memory events in 'perf mem': (Jiri Olsa)
On a Intel Broadwell machine:
# perf mem record -e list
ldlat-loads : available
ldlat-stores: available
#
- Decode data_src values (e.g. perf.data files generated by 'perf mem record')
in 'perf script': (Jiri Olsa)
# perf script
perf 693 [1] 4.088652: 1 cpu/mem-loads,ldlat=30/P: ffff88007d0b0f40 68100142 L1 hit|SNP None|TLB L1 or L2 hit|LCK No <SNIP>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Print bpf-output events in 'perf script': (Wang Nan).
# perf record -e bpf-output/no-inherit,name=evt/ -e ./test_bpf_output_3.c/map:channel.event=evt/ usleep 1000
# perf script
usleep 4882 21384.532523: evt: ffffffff810e97d1 sys_nanosleep ([kernel.kallsyms])
BPF output: 0000: 52 61 69 73 65 20 61 20 Raise a
0008: 42 50 46 20 65 76 65 6e BPF even
0010: 74 21 00 00 t!..
BPF string: "Raise a BPF event!"
#
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Jiri Olsa (11):
perf mem record: Check for memory events support
perf mem: Introduce perf_mem_events__name function
perf tools: Introduce perf_mem__tlb_scnprintf function
perf tools: Introduce perf_mem__lvl_scnprintf function
perf tools: Introduce perf_mem__snp_scnprintf function
perf tools: Introduce perf_mem__lck_scnprintf function
perf tools: Change perf_mem__tlb_scnprintf to return nb of displayed bytes
perf tools: Change perf_mem__lvl_scnprintf to return nb of displayed bytes
perf tools: Change perf_mem__snp_scnprintf to return nb of displayed bytes
perf tools: Change perf_mem__lck_scnprintf to return nb of displayed bytes
perf script: Display data_src values
Namhyung Kim (18):
perf tools: Add helper functions for some sort keys
perf hists: Basic support of hierarchical report view
perf hists: Resort hist entries with hierarchy
perf hists: Add helper functions for hierarchy mode
perf hists: Introduce hist_entry__filter()
perf hists: Support filtering in hierarchy mode
perf hists: Resort after filtering hierarchy
perf hists: Count number of sort keys
perf ui/stdio: Implement hierarchy output mode
perf ui/stdio: Align column header for hierarchy output
perf hists browser: Count number of hierarchy entries
perf hists browser: Support collapsing/expanding whole entries in hierarchy
perf hists browser: Implement hierarchy output
perf hists browser: Align column header in hierarchy mode
perf ui/gtk: Implement hierarchy output mode
perf report: Add --hierarchy option
perf hists: Support decaying in hierarchy mode
perf top: Add --hierarchy option
Wang Nan (2):
perf tools: Make binary data printer code in trace_event public available
perf script: Print bpf-output events in 'perf script'
tools/perf/Documentation/perf-report.txt | 3 +
tools/perf/Documentation/perf-top.txt | 3 +
tools/perf/Documentation/tips.txt | 1 +
tools/perf/builtin-mem.c | 22 +-
tools/perf/builtin-report.c | 17 ++
tools/perf/builtin-script.c | 113 ++++++-
tools/perf/builtin-top.c | 15 +
tools/perf/ui/browsers/hists.c | 504 ++++++++++++++++++++++++++++---
tools/perf/ui/gtk/hists.c | 163 +++++++++-
tools/perf/ui/hist.c | 3 +
tools/perf/ui/stdio/hist.c | 184 ++++++++++-
tools/perf/util/ctype.c | 9 +
tools/perf/util/debug.c | 75 +++--
tools/perf/util/hist.c | 461 ++++++++++++++++++++++++++--
tools/perf/util/hist.h | 24 ++
tools/perf/util/mem-events.c | 210 ++++++++++++-
tools/perf/util/mem-events.h | 13 +
tools/perf/util/sort.c | 285 +++++++++--------
tools/perf/util/sort.h | 14 +-
tools/perf/util/symbol.h | 3 +-
tools/perf/util/util.c | 37 +++
tools/perf/util/util.h | 22 ++
22 files changed, 1940 insertions(+), 241 deletions(-)
[toc] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-02-25 03:10 +0100 |
| Subject | [PATCH 19/31] perf hists: Support filtering in hierarchy mode |
| Message-ID | <r5Txp-5iL-53@gated-at.bofh.it> |
| In reply to | #1342612 |
From: Namhyung Kim <namhyung@kernel.org>
The hists__filter_hierarchy() function implements filtering in hierarchy
mode. Now we have hist_entry__filter() so use it for entries in the
hierarchy. It returns 3 kind of values.
A negative value means that it's not filtered by this type. It marks
current entry as filtered tentatively so if a lower level entry removes
the filter it also removes the all parent so that we can find the entry
in the output.
Zero means it's filtered out by this type. A positive value means it's
not filtered so it removes the filter and shows in the output. In these
cases, it moves to next entry since lower level entry won't match by
this type of filter anymore. Thus all children will be filtered or not
together.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1456326830-30456-7-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/hist.c | 101 +++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 93 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 358af7ed07af..dbab977f3a44 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1560,6 +1560,27 @@ static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h
enum hist_filter filter)
{
h->filtered &= ~(1 << filter);
+
+ if (symbol_conf.report_hierarchy) {
+ struct hist_entry *parent = h->parent_he;
+
+ while (parent) {
+ he_stat__add_stat(&parent->stat, &h->stat);
+
+ parent->filtered &= ~(1 << filter);
+
+ if (parent->filtered)
+ goto next;
+
+ /* force fold unfiltered entry for simplicity */
+ parent->unfolded = false;
+ parent->row_offset = 0;
+ parent->nr_rows = 0;
+next:
+ parent = parent->parent_he;
+ }
+ }
+
if (h->filtered)
return;
@@ -1645,28 +1666,92 @@ static void hists__filter_by_type(struct hists *hists, int type, filter_fn_t fil
}
}
+static void hists__filter_hierarchy(struct hists *hists, int type, const void *arg)
+{
+ struct rb_node *nd;
+
+ hists->stats.nr_non_filtered_samples = 0;
+
+ hists__reset_filter_stats(hists);
+ hists__reset_col_len(hists);
+
+ nd = rb_first(&hists->entries);
+ while (nd) {
+ struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
+ int ret;
+
+ ret = hist_entry__filter(h, type, arg);
+
+ /*
+ * case 1. non-matching type
+ * zero out the period, set filter marker and move to child
+ */
+ if (ret < 0) {
+ memset(&h->stat, 0, sizeof(h->stat));
+ h->filtered |= (1 << type);
+
+ nd = __rb_hierarchy_next(&h->rb_node, HMD_FORCE_CHILD);
+ }
+ /*
+ * case 2. matched type (filter out)
+ * set filter marker and move to next
+ */
+ else if (ret == 1) {
+ h->filtered |= (1 << type);
+
+ nd = __rb_hierarchy_next(&h->rb_node, HMD_FORCE_SIBLING);
+ }
+ /*
+ * case 3. ok (not filtered)
+ * add period to hists and parents, erase the filter marker
+ * and move to next sibling
+ */
+ else {
+ hists__remove_entry_filter(hists, h, type);
+
+ nd = __rb_hierarchy_next(&h->rb_node, HMD_FORCE_SIBLING);
+ }
+ }
+}
+
void hists__filter_by_thread(struct hists *hists)
{
- hists__filter_by_type(hists, HIST_FILTER__THREAD,
- hists__filter_entry_by_thread);
+ if (symbol_conf.report_hierarchy)
+ hists__filter_hierarchy(hists, HIST_FILTER__THREAD,
+ hists->thread_filter);
+ else
+ hists__filter_by_type(hists, HIST_FILTER__THREAD,
+ hists__filter_entry_by_thread);
}
void hists__filter_by_dso(struct hists *hists)
{
- hists__filter_by_type(hists, HIST_FILTER__DSO,
- hists__filter_entry_by_dso);
+ if (symbol_conf.report_hierarchy)
+ hists__filter_hierarchy(hists, HIST_FILTER__DSO,
+ hists->dso_filter);
+ else
+ hists__filter_by_type(hists, HIST_FILTER__DSO,
+ hists__filter_entry_by_dso);
}
void hists__filter_by_symbol(struct hists *hists)
{
- hists__filter_by_type(hists, HIST_FILTER__SYMBOL,
- hists__filter_entry_by_symbol);
+ if (symbol_conf.report_hierarchy)
+ hists__filter_hierarchy(hists, HIST_FILTER__SYMBOL,
+ hists->symbol_filter_str);
+ else
+ hists__filter_by_type(hists, HIST_FILTER__SYMBOL,
+ hists__filter_entry_by_symbol);
}
void hists__filter_by_socket(struct hists *hists)
{
- hists__filter_by_type(hists, HIST_FILTER__SOCKET,
- hists__filter_entry_by_socket);
+ if (symbol_conf.report_hierarchy)
+ hists__filter_hierarchy(hists, HIST_FILTER__SOCKET,
+ &hists->socket_filter);
+ else
+ hists__filter_by_type(hists, HIST_FILTER__SOCKET,
+ hists__filter_entry_by_socket);
}
void events_stats__inc(struct events_stats *stats, u32 type)
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-02-25 03:10 +0100 |
| Subject | [PATCH 25/31] perf hists browser: Support collapsing/expanding whole entries in hierarchy |
| Message-ID | <r5Txp-5iL-55@gated-at.bofh.it> |
| In reply to | #1342612 |
From: Namhyung Kim <namhyung@kernel.org>
The 'C' and 'E' keys are to collapse/expand all hist entries. Update
nr_hierarchy_entries properly in this case.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Pekka Enberg <penberg@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1456326830-30456-13-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 58 ++++++++++++++++++++++++++++++++++--------
1 file changed, 48 insertions(+), 10 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index de1d6f0df8a7..857b9beb0aab 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -484,13 +484,38 @@ static int callchain__set_folding(struct rb_root *chain, bool unfold)
return n;
}
-static void hist_entry__set_folding(struct hist_entry *he, bool unfold)
+static int hierarchy_set_folding(struct hist_browser *hb, struct hist_entry *he,
+ bool unfold __maybe_unused)
+{
+ float percent;
+ struct rb_node *nd;
+ struct hist_entry *child;
+ int n = 0;
+
+ for (nd = rb_first(&he->hroot_out); nd; nd = rb_next(nd)) {
+ child = rb_entry(nd, struct hist_entry, rb_node);
+ percent = hist_entry__get_percent_limit(child);
+ if (!child->filtered && percent >= hb->min_pcnt)
+ n++;
+ }
+
+ return n;
+}
+
+static void hist_entry__set_folding(struct hist_entry *he,
+ struct hist_browser *hb, bool unfold)
{
hist_entry__init_have_children(he);
he->unfolded = unfold ? he->has_children : false;
if (he->has_children) {
- int n = callchain__set_folding(&he->sorted_chain, unfold);
+ int n;
+
+ if (he->leaf)
+ n = callchain__set_folding(&he->sorted_chain, unfold);
+ else
+ n = hierarchy_set_folding(hb, he, unfold);
+
he->nr_rows = unfold ? n : 0;
} else
he->nr_rows = 0;
@@ -500,19 +525,32 @@ static void
__hist_browser__set_folding(struct hist_browser *browser, bool unfold)
{
struct rb_node *nd;
- struct hists *hists = browser->hists;
+ struct hist_entry *he;
+ double percent;
- for (nd = rb_first(&hists->entries);
- (nd = hists__filter_entries(nd, browser->min_pcnt)) != NULL;
- nd = rb_next(nd)) {
- struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node);
- hist_entry__set_folding(he, unfold);
- browser->nr_callchain_rows += he->nr_rows;
+ nd = rb_first(&browser->hists->entries);
+ while (nd) {
+ he = rb_entry(nd, struct hist_entry, rb_node);
+
+ /* set folding state even if it's currently folded */
+ nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD);
+
+ hist_entry__set_folding(he, browser, unfold);
+
+ percent = hist_entry__get_percent_limit(he);
+ if (he->filtered || percent < browser->min_pcnt)
+ continue;
+
+ if (!he->depth || unfold)
+ browser->nr_hierarchy_entries++;
+ if (he->leaf)
+ browser->nr_callchain_rows += he->nr_rows;
}
}
static void hist_browser__set_folding(struct hist_browser *browser, bool unfold)
{
+ browser->nr_hierarchy_entries = 0;
browser->nr_callchain_rows = 0;
__hist_browser__set_folding(browser, unfold);
@@ -2131,7 +2169,7 @@ static void hist_browser__update_percent_limit(struct hist_browser *hb,
/* force to re-evaluate folding state of callchains */
he->init_have_children = false;
- hist_entry__set_folding(he, false);
+ hist_entry__set_folding(he, hb, false);
nd = rb_next(nd);
}
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2016-02-25 08:30 +0100 |
| Message-ID | <r5Yx3-mB-7@gated-at.bofh.it> |
| In reply to | #1342612 |
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > Hi Ingo, > > Please consider pulling, > > - Arnaldo > > The following changes since commit c2b8d8c55c0235e21c563283f634bcfd2ba7bc1e: > > Merge tag 'perf-core-for-mingo-2' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-02-24 08:20:30 +0100) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-20160224 > > for you to fetch changes up to c92fcfde3486fb4b9e476ee5ad5995a62e401cce: > > perf top: Add --hierarchy option (2016-02-24 20:21:15 -0300) > > ---------------------------------------------------------------- > perf/core improvements: > > User visible: > > - Hierarchy histogram mode for 'perf top' and 'perf report', showing multiple > levels, one per --sort entry: (Namhyung Kim) > > On a mostly idle system: > > # perf top --hierarchy -s comm,dso > > Then expand some levels and use 'P' to take a snapshot: > > # cat perf.hist.0 > - 92.32% perf > 58.20% perf > 22.29% libc-2.22.so > 5.97% [kernel] > 4.18% libelf-0.165.so > 1.69% [unknown] > - 4.71% qemu-system-x86 > 3.10% [kernel] > 1.60% qemu-system-x86_64 (deleted) > + 2.97% swapper > # > > - Check availability of memory events in 'perf mem': (Jiri Olsa) > > On a Intel Broadwell machine: > > # perf mem record -e list > ldlat-loads : available > ldlat-stores: available > # > > - Decode data_src values (e.g. perf.data files generated by 'perf mem record') > in 'perf script': (Jiri Olsa) > > # perf script > perf 693 [1] 4.088652: 1 cpu/mem-loads,ldlat=30/P: ffff88007d0b0f40 68100142 L1 hit|SNP None|TLB L1 or L2 hit|LCK No <SNIP> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > - Print bpf-output events in 'perf script': (Wang Nan). > > # perf record -e bpf-output/no-inherit,name=evt/ -e ./test_bpf_output_3.c/map:channel.event=evt/ usleep 1000 > # perf script > usleep 4882 21384.532523: evt: ffffffff810e97d1 sys_nanosleep ([kernel.kallsyms]) > BPF output: 0000: 52 61 69 73 65 20 61 20 Raise a > 0008: 42 50 46 20 65 76 65 6e BPF even > 0010: 74 21 00 00 t!.. > BPF string: "Raise a BPF event!" > # > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> > > ---------------------------------------------------------------- > Jiri Olsa (11): > perf mem record: Check for memory events support > perf mem: Introduce perf_mem_events__name function > perf tools: Introduce perf_mem__tlb_scnprintf function > perf tools: Introduce perf_mem__lvl_scnprintf function > perf tools: Introduce perf_mem__snp_scnprintf function > perf tools: Introduce perf_mem__lck_scnprintf function > perf tools: Change perf_mem__tlb_scnprintf to return nb of displayed bytes > perf tools: Change perf_mem__lvl_scnprintf to return nb of displayed bytes > perf tools: Change perf_mem__snp_scnprintf to return nb of displayed bytes > perf tools: Change perf_mem__lck_scnprintf to return nb of displayed bytes > perf script: Display data_src values > > Namhyung Kim (18): > perf tools: Add helper functions for some sort keys > perf hists: Basic support of hierarchical report view > perf hists: Resort hist entries with hierarchy > perf hists: Add helper functions for hierarchy mode > perf hists: Introduce hist_entry__filter() > perf hists: Support filtering in hierarchy mode > perf hists: Resort after filtering hierarchy > perf hists: Count number of sort keys > perf ui/stdio: Implement hierarchy output mode > perf ui/stdio: Align column header for hierarchy output > perf hists browser: Count number of hierarchy entries > perf hists browser: Support collapsing/expanding whole entries in hierarchy > perf hists browser: Implement hierarchy output > perf hists browser: Align column header in hierarchy mode > perf ui/gtk: Implement hierarchy output mode > perf report: Add --hierarchy option > perf hists: Support decaying in hierarchy mode > perf top: Add --hierarchy option > > Wang Nan (2): > perf tools: Make binary data printer code in trace_event public available > perf script: Print bpf-output events in 'perf script' > > tools/perf/Documentation/perf-report.txt | 3 + > tools/perf/Documentation/perf-top.txt | 3 + > tools/perf/Documentation/tips.txt | 1 + > tools/perf/builtin-mem.c | 22 +- > tools/perf/builtin-report.c | 17 ++ > tools/perf/builtin-script.c | 113 ++++++- > tools/perf/builtin-top.c | 15 + > tools/perf/ui/browsers/hists.c | 504 ++++++++++++++++++++++++++++--- > tools/perf/ui/gtk/hists.c | 163 +++++++++- > tools/perf/ui/hist.c | 3 + > tools/perf/ui/stdio/hist.c | 184 ++++++++++- > tools/perf/util/ctype.c | 9 + > tools/perf/util/debug.c | 75 +++-- > tools/perf/util/hist.c | 461 ++++++++++++++++++++++++++-- > tools/perf/util/hist.h | 24 ++ > tools/perf/util/mem-events.c | 210 ++++++++++++- > tools/perf/util/mem-events.h | 13 + > tools/perf/util/sort.c | 285 +++++++++-------- > tools/perf/util/sort.h | 14 +- > tools/perf/util/symbol.h | 3 +- > tools/perf/util/util.c | 37 +++ > tools/perf/util/util.h | 22 ++ > 22 files changed, 1940 insertions(+), 241 deletions(-) Pulled, thanks a lot Arnaldo! Ingo
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web