From: Jin Yao <yao.jin@linux.intel.com>
To: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
mingo@redhat.com, alexander.shishkin@linux.intel.com
Cc: Linux-kernel@vger.kernel.org, ak@linux.intel.com,
kan.liang@intel.com, yao.jin@intel.com,
Jin Yao <yao.jin@linux.intel.com>
Subject: [PATCH v1 4/4] perf annotate: Display multiple events for gtk mode
Date: Wed, 16 Aug 2017 18:18:36 +0800 [thread overview]
Message-ID: <1502878716-30817-5-git-send-email-yao.jin@linux.intel.com> (raw)
In-Reply-To: <1502878716-30817-1-git-send-email-yao.jin@linux.intel.com>
For example:
perf record -e cycles,branches ./div
perf annotate main --gtk
Both the cycles and branches are displayed at the left column in
gtk window.
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
tools/perf/ui/gtk/annotate.c | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c
index 0217619..f314654 100644
--- a/tools/perf/ui/gtk/annotate.c
+++ b/tools/perf/ui/gtk/annotate.c
@@ -88,7 +88,8 @@ static int perf_gtk__get_line(char *buf, size_t size, struct disasm_line *dl)
static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym,
struct map *map, struct perf_evsel *evsel,
- struct hist_browser_timer *hbt __maybe_unused)
+ struct hist_browser_timer *hbt __maybe_unused,
+ struct hist_entry *he)
{
struct disasm_line *pos, *n;
struct annotation *notes;
@@ -98,6 +99,7 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym,
GtkWidget *view;
int i;
char s[512];
+ struct hist_event *hevt;
notes = symbol__annotation(sym);
@@ -124,17 +126,18 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym,
gtk_list_store_append(store, &iter);
- if (perf_evsel__is_group_event(evsel)) {
- for (i = 0; i < evsel->nr_members; i++) {
+ if (evsel) {
+ ret = perf_gtk__get_percent(s, sizeof(s), sym, pos,
+ evsel->idx);
+ } else if (he) {
+ for (i = 0; i < he->event_nr; i++) {
+ hevt = &he->events[i];
ret += perf_gtk__get_percent(s + ret,
sizeof(s) - ret,
- sym, pos,
- evsel->idx + i);
+ hevt->ms.sym, pos,
+ hevt->idx);
ret += scnprintf(s + ret, sizeof(s) - ret, " ");
}
- } else {
- ret = perf_gtk__get_percent(s, sizeof(s), sym, pos,
- evsel->idx);
}
if (ret)
@@ -157,19 +160,25 @@ static int perf_gtk__annotate_symbol(GtkWidget *window, struct symbol *sym,
static int symbol__gtk_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel,
- struct hist_browser_timer *hbt)
+ struct hist_browser_timer *hbt,
+ struct hist_entry *he)
{
GtkWidget *window;
GtkWidget *notebook;
GtkWidget *scrolled_window;
GtkWidget *tab_label;
int err;
+ char *arch;
+
+ if (!evsel)
+ arch = perf_evsel__env_arch(he->events[0].evsel);
+ else
+ arch = perf_evsel__env_arch(evsel);
if (map->dso->annotate_warned)
return -1;
- err = symbol__disassemble(sym, map, perf_evsel__env_arch(evsel),
- 0, NULL, NULL);
+ err = symbol__disassemble(sym, map, arch, 0, NULL, NULL);
if (err) {
char msg[BUFSIZ];
symbol__strerror_disassemble(sym, map, err, msg, sizeof(msg));
@@ -228,7 +237,7 @@ static int symbol__gtk_annotate(struct symbol *sym, struct map *map,
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window,
tab_label);
- perf_gtk__annotate_symbol(scrolled_window, sym, map, evsel, hbt);
+ perf_gtk__annotate_symbol(scrolled_window, sym, map, evsel, hbt, he);
return 0;
}
@@ -236,7 +245,7 @@ int hist_entry__gtk_annotate(struct hist_entry *he,
struct perf_evsel *evsel,
struct hist_browser_timer *hbt)
{
- return symbol__gtk_annotate(he->ms.sym, he->ms.map, evsel, hbt);
+ return symbol__gtk_annotate(he->ms.sym, he->ms.map, evsel, hbt, he);
}
void perf_gtk__show_annotations(void)
--
2.7.4
next prev parent reply other threads:[~2017-08-16 2:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 10:18 [PATCH v1 0/4] perf annotate: Display multiple events on the left side of annotate view Jin Yao
2017-08-16 10:18 ` [PATCH v1 1/4] perf annotate: create a new hists to manage multiple events samples Jin Yao
2017-09-08 13:43 ` Arnaldo Carvalho de Melo
2017-09-11 1:33 ` Jin, Yao
2017-09-14 1:03 ` Jin, Yao
2017-09-14 14:05 ` Arnaldo Carvalho de Melo
2017-09-14 14:31 ` Jin, Yao
2017-10-05 13:21 ` Arnaldo Carvalho de Melo
2017-10-06 16:31 ` Jin, Yao
2017-10-06 18:54 ` Arnaldo Carvalho de Melo
2017-10-09 1:40 ` Jin, Yao
2017-10-12 1:39 ` Jin, Yao
2017-08-16 10:18 ` [PATCH v1 2/4] perf annotate: Display multiple events for stdio mode Jin Yao
2017-08-16 10:18 ` [PATCH v1 3/4] perf annotate: Display multiple events for tui mode Jin Yao
2017-08-16 10:18 ` Jin Yao [this message]
2017-09-08 7:31 ` [PATCH v1 0/4] perf annotate: Display multiple events on the left side of annotate view Jin, Yao
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=1502878716-30817-5-git-send-email-yao.jin@linux.intel.com \
--to=yao.jin@linux.intel.com \
--cc=Linux-kernel@vger.kernel.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=yao.jin@intel.com \
/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