From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Jiri Olsa <jolsa@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
David Ahern <dsahern@gmail.com>
Subject: [PATCH 09/10] perf hists browser: Simplify zooming code a bit
Date: Wed, 22 Apr 2015 16:18:20 +0900 [thread overview]
Message-ID: <1429687101-4360-10-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1429687101-4360-1-git-send-email-namhyung@kernel.org>
Introduce pstack_peek() and reuse do_zoom_dso/thread() function.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/ui/browsers/hists.c | 18 +++++-------------
tools/perf/util/pstack.c | 7 +++++++
tools/perf/util/pstack.h | 1 +
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 9bd7b38de64c..a0da3f9f0513 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1860,19 +1860,11 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
goto out_free_stack;
continue;
}
- top = pstack__pop(browser->pstack);
- if (top == &browser->hists->dso_filter) {
- perf_hpp__set_elide(HISTC_DSO, false);
- browser->hists->dso_filter = NULL;
- hists__filter_by_dso(browser->hists);
- }
- if (top == &browser->hists->thread_filter) {
- perf_hpp__set_elide(HISTC_THREAD, false);
- thread__zput(browser->hists->thread_filter);
- hists__filter_by_thread(browser->hists);
- }
- ui_helpline__pop();
- hist_browser__reset(browser);
+ top = pstack__peek(browser->pstack);
+ if (top == &browser->hists->dso_filter)
+ do_zoom_dso(browser, actions);
+ if (top == &browser->hists->thread_filter)
+ do_zoom_thread(browser, actions);
continue;
}
case K_ESC:
diff --git a/tools/perf/util/pstack.c b/tools/perf/util/pstack.c
index a126e6cc6e73..b234a6e3d0d4 100644
--- a/tools/perf/util/pstack.c
+++ b/tools/perf/util/pstack.c
@@ -74,3 +74,10 @@ void *pstack__pop(struct pstack *pstack)
pstack->entries[pstack->top] = NULL;
return ret;
}
+
+void *pstack__peek(struct pstack *pstack)
+{
+ if (pstack->top == 0)
+ return NULL;
+ return pstack->entries[pstack->top - 1];
+}
diff --git a/tools/perf/util/pstack.h b/tools/perf/util/pstack.h
index c3cb6584d527..ded7f2e36624 100644
--- a/tools/perf/util/pstack.h
+++ b/tools/perf/util/pstack.h
@@ -10,5 +10,6 @@ bool pstack__empty(const struct pstack *pstack);
void pstack__remove(struct pstack *pstack, void *key);
void pstack__push(struct pstack *pstack, void *key);
void *pstack__pop(struct pstack *pstack);
+void *pstack__peek(struct pstack *pstack);
#endif /* _PERF_PSTACK_ */
--
2.3.5
next prev parent reply other threads:[~2015-04-22 7:19 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 7:18 [PATCHSET 00/10] perf tools: Assorted cleanup for TUI (v3) Namhyung Kim
2015-04-22 7:18 ` [PATCH 01/10] perf tools: Move TUI-specific fields into unnamed union Namhyung Kim
2015-04-22 11:57 ` Arnaldo Carvalho de Melo
2015-05-06 3:19 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-22 7:18 ` [PATCH 02/10] perf tools: Move init_have_children field to the " Namhyung Kim
2015-05-06 3:20 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-22 7:18 ` [PATCH 03/10] perf hists browser: Fix possible memory leak Namhyung Kim
2015-05-06 3:20 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-22 7:18 ` [PATCH 04/10] perf hists browser: Save hist_browser_timer pointer in hist_browser Namhyung Kim
2015-05-06 3:20 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-22 7:18 ` [PATCH 05/10] perf hists browser: Save pstack in the hist_browser Namhyung Kim
2015-05-06 3:21 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-22 7:18 ` [PATCH 06/10] perf hists browser: Save perf_session_env " Namhyung Kim
2015-05-06 3:21 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-22 7:18 ` [PATCH 07/10] perf hists browser: Split popup menu actions Namhyung Kim
2015-05-06 3:21 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-22 7:18 ` [PATCH 08/10] perf hists browser: Split popup menu actions - part 2 Namhyung Kim
2015-04-22 10:54 ` Jiri Olsa
2015-04-22 13:03 ` Namhyung Kim
2015-04-22 13:25 ` Arnaldo Carvalho de Melo
2015-04-22 13:32 ` Namhyung Kim
2015-04-22 13:41 ` Jiri Olsa
2015-04-22 13:53 ` Namhyung Kim
2015-04-22 14:02 ` Jiri Olsa
2015-05-06 3:21 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-22 7:18 ` Namhyung Kim [this message]
2015-04-23 22:30 ` [PATCH 09/10] perf hists browser: Simplify zooming code a bit Arnaldo Carvalho de Melo
2015-04-24 1:15 ` [PATCH v2 9/10] perf tools: Introduce pstack_peek() Namhyung Kim
2015-04-24 1:15 ` [PATCH v2 9.5/10] perf hists browser: Simplify zooming code using pstack_peek() Namhyung Kim
2015-05-06 3:22 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-05-06 3:22 ` [tip:perf/core] perf tools: Introduce pstack_peek() tip-bot for Namhyung Kim
2015-04-22 7:18 ` [PATCH 10/10] perf tools: Move TUI-specific fields out of map_symbol Namhyung Kim
2015-04-27 17:20 ` Arnaldo Carvalho de Melo
2015-04-28 7:30 ` Namhyung Kim
2015-04-28 12:29 ` Arnaldo Carvalho de Melo
2015-05-04 15:42 ` Arnaldo Carvalho de Melo
2015-05-04 15:51 ` Arnaldo Carvalho de Melo
2015-05-05 1:12 ` Namhyung Kim
2015-05-05 14:07 ` Arnaldo Carvalho de Melo
2015-05-05 14:22 ` Namhyung Kim
2015-05-05 1:18 ` [PATCH v2 " Namhyung Kim
2015-05-05 14:22 ` Arnaldo Carvalho de Melo
2015-05-05 14:26 ` Arnaldo Carvalho de Melo
2015-05-05 14:40 ` Namhyung Kim
2015-05-05 14:55 ` [PATCH v3 " Namhyung Kim
2015-05-05 16:00 ` Arnaldo Carvalho de Melo
2015-05-06 3:22 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-04-22 11:12 ` [PATCHSET 00/10] perf tools: Assorted cleanup for TUI (v3) Jiri Olsa
2015-04-22 13:05 ` Namhyung Kim
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=1429687101-4360-10-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=dsahern@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@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;
as well as URLs for NNTP newsgroup(s).