From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
David Ahern <dsahern@gmail.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 62/64] perf tools: Move TUI-specific fields out of map_symbol
Date: Tue, 28 Apr 2015 10:30:54 -0300 [thread overview]
Message-ID: <1430227856-25825-63-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1430227856-25825-1-git-send-email-acme@kernel.org>
From: Namhyung Kim <namhyung@kernel.org>
The has_children and unfolded fields don't belong to struct map_symbol
since they're used by TUI only. Move those fields out of map_symbol
since the struct is also used by other places.
This will also help to compact the sizeof struct hist_entry.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1429687101-4360-11-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 57 +++++++++++++++++++-----------------------
tools/perf/util/callchain.h | 4 +++
tools/perf/util/hist.c | 2 +-
tools/perf/util/sort.h | 2 ++
tools/perf/util/symbol.h | 2 --
5 files changed, 33 insertions(+), 34 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 8733d577db78..f422e5e82a6a 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -63,7 +63,7 @@ static int hist_browser__get_folding(struct hist_browser *browser)
struct hist_entry *he =
rb_entry(nd, struct hist_entry, rb_node);
- if (he->ms.unfolded)
+ if (he->unfolded)
unfolded_rows += he->nr_rows;
}
return unfolded_rows;
@@ -139,24 +139,19 @@ static char tree__folded_sign(bool unfolded)
return unfolded ? '-' : '+';
}
-static char map_symbol__folded(const struct map_symbol *ms)
-{
- return ms->has_children ? tree__folded_sign(ms->unfolded) : ' ';
-}
-
static char hist_entry__folded(const struct hist_entry *he)
{
- return map_symbol__folded(&he->ms);
+ return he->has_children ? tree__folded_sign(he->unfolded) : ' ';
}
static char callchain_list__folded(const struct callchain_list *cl)
{
- return map_symbol__folded(&cl->ms);
+ return cl->has_children ? tree__folded_sign(cl->unfolded) : ' ';
}
-static void map_symbol__set_folding(struct map_symbol *ms, bool unfold)
+static void callchain_list__set_folding(struct callchain_list *cl, bool unfold)
{
- ms->unfolded = unfold ? ms->has_children : false;
+ cl->unfolded = unfold ? cl->has_children : false;
}
static int callchain_node__count_rows_rb_tree(struct callchain_node *node)
@@ -192,7 +187,7 @@ static int callchain_node__count_rows(struct callchain_node *node)
list_for_each_entry(chain, &node->val, list) {
++n;
- unfolded = chain->ms.unfolded;
+ unfolded = chain->unfolded;
}
if (unfolded)
@@ -214,15 +209,15 @@ static int callchain__count_rows(struct rb_root *chain)
return n;
}
-static bool map_symbol__toggle_fold(struct map_symbol *ms)
+static bool hist_entry__toggle_fold(struct hist_entry *he)
{
- if (!ms)
+ if (!he)
return false;
- if (!ms->has_children)
+ if (!he->has_children)
return false;
- ms->unfolded = !ms->unfolded;
+ he->unfolded = !he->unfolded;
return true;
}
@@ -238,10 +233,10 @@ static void callchain_node__init_have_children_rb_tree(struct callchain_node *no
list_for_each_entry(chain, &child->val, list) {
if (first) {
first = false;
- chain->ms.has_children = chain->list.next != &child->val ||
+ chain->has_children = chain->list.next != &child->val ||
!RB_EMPTY_ROOT(&child->rb_root);
} else
- chain->ms.has_children = chain->list.next == &child->val &&
+ chain->has_children = chain->list.next == &child->val &&
!RB_EMPTY_ROOT(&child->rb_root);
}
@@ -255,11 +250,11 @@ static void callchain_node__init_have_children(struct callchain_node *node,
struct callchain_list *chain;
chain = list_entry(node->val.next, struct callchain_list, list);
- chain->ms.has_children = has_sibling;
+ chain->has_children = has_sibling;
if (!list_empty(&node->val)) {
chain = list_entry(node->val.prev, struct callchain_list, list);
- chain->ms.has_children = !RB_EMPTY_ROOT(&node->rb_root);
+ chain->has_children = !RB_EMPTY_ROOT(&node->rb_root);
}
callchain_node__init_have_children_rb_tree(node);
@@ -279,7 +274,7 @@ static void callchain__init_have_children(struct rb_root *root)
static void hist_entry__init_have_children(struct hist_entry *he)
{
if (!he->init_have_children) {
- he->ms.has_children = !RB_EMPTY_ROOT(&he->sorted_chain);
+ he->has_children = !RB_EMPTY_ROOT(&he->sorted_chain);
callchain__init_have_children(&he->sorted_chain);
he->init_have_children = true;
}
@@ -287,14 +282,14 @@ static void hist_entry__init_have_children(struct hist_entry *he)
static bool hist_browser__toggle_fold(struct hist_browser *browser)
{
- if (map_symbol__toggle_fold(browser->selection)) {
+ if (hist_entry__toggle_fold(browser->he_selection)) {
struct hist_entry *he = browser->he_selection;
hist_entry__init_have_children(he);
browser->b.nr_entries -= he->nr_rows;
browser->nr_callchain_rows -= he->nr_rows;
- if (he->ms.unfolded)
+ if (he->unfolded)
he->nr_rows = callchain__count_rows(&he->sorted_chain);
else
he->nr_rows = 0;
@@ -321,8 +316,8 @@ static int callchain_node__set_folding_rb_tree(struct callchain_node *node, bool
list_for_each_entry(chain, &child->val, list) {
++n;
- map_symbol__set_folding(&chain->ms, unfold);
- has_children = chain->ms.has_children;
+ callchain_list__set_folding(chain, unfold);
+ has_children = chain->has_children;
}
if (has_children)
@@ -340,8 +335,8 @@ static int callchain_node__set_folding(struct callchain_node *node, bool unfold)
list_for_each_entry(chain, &node->val, list) {
++n;
- map_symbol__set_folding(&chain->ms, unfold);
- has_children = chain->ms.has_children;
+ callchain_list__set_folding(chain, unfold);
+ has_children = chain->has_children;
}
if (has_children)
@@ -366,9 +361,9 @@ static int callchain__set_folding(struct rb_root *chain, bool unfold)
static void hist_entry__set_folding(struct hist_entry *he, bool unfold)
{
hist_entry__init_have_children(he);
- map_symbol__set_folding(&he->ms, unfold);
+ hist_entry__set_folding(he, unfold);
- if (he->ms.has_children) {
+ if (he->has_children) {
int n = callchain__set_folding(&he->sorted_chain, unfold);
he->nr_rows = unfold ? n : 0;
} else
@@ -1019,7 +1014,7 @@ do_offset:
if (offset > 0) {
do {
h = rb_entry(nd, struct hist_entry, rb_node);
- if (h->ms.unfolded) {
+ if (h->unfolded) {
u16 remaining = h->nr_rows - h->row_offset;
if (offset > remaining) {
offset -= remaining;
@@ -1040,7 +1035,7 @@ do_offset:
} else if (offset < 0) {
while (1) {
h = rb_entry(nd, struct hist_entry, rb_node);
- if (h->ms.unfolded) {
+ if (h->unfolded) {
if (first) {
if (-offset > h->row_offset) {
offset += h->row_offset;
@@ -1077,7 +1072,7 @@ do_offset:
* row_offset at its last entry.
*/
h = rb_entry(nd, struct hist_entry, rb_node);
- if (h->ms.unfolded)
+ if (h->unfolded)
h->row_offset = h->nr_rows;
break;
}
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 6033a0a212ca..679c2c6d8ade 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -72,6 +72,10 @@ extern struct callchain_param callchain_param;
struct callchain_list {
u64 ip;
struct map_symbol ms;
+ struct /* for TUI */ {
+ bool unfolded;
+ bool has_children;
+ };
char *srcline;
struct list_head list;
};
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index cc22b9158b93..338770679863 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1163,7 +1163,7 @@ static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h
return;
/* force fold unfiltered entry for simplicity */
- h->ms.unfolded = false;
+ h->unfolded = false;
h->row_offset = 0;
h->nr_rows = 0;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 4d923e6e0069..e97cd476d336 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -109,6 +109,8 @@ struct hist_entry {
u16 row_offset;
u16 nr_rows;
bool init_have_children;
+ bool unfolded;
+ bool has_children;
};
};
char *srcline;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 09561500164a..8483a864a915 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -158,8 +158,6 @@ struct ref_reloc_sym {
struct map_symbol {
struct map *map;
struct symbol *sym;
- bool unfolded;
- bool has_children;
};
struct addr_map_symbol {
--
1.9.3
next prev parent reply other threads:[~2015-04-28 13:35 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-28 13:29 [GIT PULL 00/64] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-04-28 13:29 ` [PATCH 01/64] perf hists: Get rid of position field from struct hist_entry Arnaldo Carvalho de Melo
2015-04-28 13:29 ` [PATCH 02/64] perf diff: Make hist_entry_diff fields union Arnaldo Carvalho de Melo
2015-04-28 13:29 ` [PATCH 03/64] perf data: Show error message when conversion failed Arnaldo Carvalho de Melo
2015-04-28 13:29 ` [PATCH 04/64] tools lib traceevent: Add alias field to struct format_field Arnaldo Carvalho de Melo
2015-04-28 13:29 ` [PATCH 05/64] tools build: No need to make libapi for perf explicitly Arnaldo Carvalho de Melo
2015-04-28 13:29 ` [PATCH 06/64] tools build: Fix Makefile(s) to properly invoke tools build Arnaldo Carvalho de Melo
2015-04-28 13:29 ` [PATCH 07/64] perf tests: Add build tests for building perf from kernel source root and tools Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 08/64] perf data: Switch to multiple cpu stream files Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 09/64] perf data: Enable stream flush within processing Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 10/64] perf data: Add support for setting ordered_events queue size Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 11/64] perf data: Fix duplicate field names and avoid reserved keywords Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 12/64] perf data: Fix signedness of value Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 13/64] perf header: Add AUX area tracing feature Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 14/64] perf evlist: Add support for mmapping an AUX area buffer Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 15/64] perf tools: Add user events for AUX area tracing Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 16/64] perf auxtrace: Add support for AUX area recording Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 17/64] perf record: Add basic AUX area tracing support Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 18/64] perf record: Extend -m option for AUX area tracing mmap pages Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 19/64] perf tools: Add a user event for AUX area tracing errors Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 20/64] perf session: Add hooks to allow transparent decoding of AUX area tracing data Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 21/64] perf session: Add instruction tracing options Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 22/64] perf auxtrace: Add helpers for AUX area tracing errors Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 23/64] perf auxtrace: Add helpers for queuing AUX area tracing data Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 24/64] perf auxtrace: Add a heap for sorting AUX area tracing queues Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 25/64] perf auxtrace: Add processing for AUX area tracing events Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 26/64] perf auxtrace: Add a hashtable for caching Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 27/64] perf tools: Add member to struct dso for an instruction cache Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 28/64] perf script: Add Instruction Tracing support Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 29/64] perf inject: Re-pipe AUX area tracing events Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 30/64] perf inject: Add Instruction Tracing support Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 31/64] perf script: Add field option 'flags' to print sample flags Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 32/64] perf tools: Add aux_watermark member of struct perf_event_attr Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 33/64] perf tools: Add parse_events_error interface Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 34/64] perf tools: Add flex support for parse_events_error Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 35/64] perf tools: Always bail out when config_attr function fails Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 36/64] perf tools: Change parse_events_add_pmu interface Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 37/64] perf tools: Add location to pmu event terms Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 38/64] perf tools: Add term support for parse_events_error Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 39/64] perf tools: Add static terms " Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 40/64] perf tools: Add tracepoint " Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 41/64] perf tools: Add symbolic events " Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 42/64] perf probe: Make --funcs option exclusive Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 43/64] perf probe: Remove all probes matches given pattern at once Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 44/64] perf trace: Fix --filter-pids OPTION description Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 45/64] perf trace: Clarify that -e is about syscalls, not perf events in general Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 46/64] perf stat: Fix metrics calculation with event qualifiers Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 47/64] perf stat: Change metrics context calculation Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 48/64] perf stat: Add metrics support for exclude_hv Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 49/64] perf stat: Add metrics support for exclude_(host|guest) Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 50/64] perf stat: Add metrics support for exclude_idle Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 51/64] perf tools: Document --children option in more detail Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 52/64] perf tools: Move TUI-specific fields into unnamed union Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 53/64] perf tools: Move init_have_children field to the " Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 54/64] perf hists browser: Fix possible memory leak Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 55/64] perf hists browser: Save hist_browser_timer pointer in hist_browser Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 56/64] perf hists browser: Save pstack in the hist_browser Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 57/64] perf hists browser: Save perf_session_env " Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 58/64] perf hists browser: Split popup menu actions Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 59/64] perf hists browser: Split popup menu actions - part 2 Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 60/64] perf tools: Introduce pstack_peek() Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 61/64] perf hists browser: Simplify zooming code using pstack_peek() Arnaldo Carvalho de Melo
2015-04-28 13:30 ` Arnaldo Carvalho de Melo [this message]
2015-04-28 13:30 ` [PATCH 63/64] perf tools: Use getconf to determine number of online CPUs Arnaldo Carvalho de Melo
2015-04-28 13:30 ` [PATCH 64/64] perf bench numa: Show more stats of particular threads in verbose mode Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430227856-25825-63-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome