Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1486451 > unrolled thread

[PATCH 47/61] perf c2c report: Add cacheline browser

Started byJiri Olsa <jolsa@kernel.org>
First post2016-09-19 15:20 +0200
Last post2016-09-21 21:40 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 47/61] perf c2c report: Add cacheline browser Jiri Olsa <jolsa@kernel.org> - 2016-09-19 15:20 +0200
    Re: [PATCH 47/61] perf c2c report: Add cacheline browser Kim Phillips <kim.phillips@arm.com> - 2016-09-20 22:20 +0200
      Re: [PATCH 47/61] perf c2c report: Add cacheline browser Jiri Olsa <jolsa@redhat.com> - 2016-09-21 10:30 +0200
        Re: [PATCH 47/61] perf c2c report: Add cacheline browser Jiri Olsa <jolsa@redhat.com> - 2016-09-21 15:00 +0200
          Re: [PATCH 47/61] perf c2c report: Add cacheline browser Kim Phillips <kim.phillips@arm.com> - 2016-09-21 21:40 +0200

#1486451 — [PATCH 47/61] perf c2c report: Add cacheline browser

FromJiri Olsa <jolsa@kernel.org>
Date2016-09-19 15:20 +0200
Subject[PATCH 47/61] perf c2c report: Add cacheline browser
Message-ID<sj6Ei-5Vj-41@gated-at.bofh.it>
Adding single cacheline TUI browser. It triggers when
you press 'd' in the main browser on the specific cacheline.

It allows to navigate through cacheline's offsets and display
callchains (implemented in following patches).

Link: http://lkml.kernel.org/n/tip-fovjwgyusv3rz5qxk3hnahtl@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/builtin-c2c.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 47d5408aeff8..b380cdf0e6aa 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -1829,6 +1829,84 @@ static void c2c_browser__update_nr_entries(struct hist_browser *hb)
 	hb->nr_non_filtered_entries = nr_entries;
 }
 
+struct c2c_cacheline_browser {
+	struct hist_browser	 hb;
+	struct hist_entry	*he;
+};
+
+static int
+perf_c2c_cacheline_browser__title(struct hist_browser *browser,
+				  char *bf, size_t size)
+{
+	struct c2c_cacheline_browser *cl_browser;
+	struct hist_entry *he;
+	uint64_t addr = 0;
+
+	cl_browser = container_of(browser, struct c2c_cacheline_browser, hb);
+	he = cl_browser->he;
+
+	if (he->mem_info)
+		addr = cl_address(he->mem_info->daddr.addr);
+
+	scnprintf(bf, size, "Cacheline 0x%lx", addr);
+	return 0;
+}
+
+static struct c2c_cacheline_browser*
+c2c_cacheline_browser__new(struct hists *hists, struct hist_entry *he)
+{
+	struct c2c_cacheline_browser *browser;
+
+	browser = zalloc(sizeof(*browser));
+	if (browser) {
+		hist_browser__init(&browser->hb, hists);
+		browser->hb.c2c_filter	= true;
+		browser->hb.title	= perf_c2c_cacheline_browser__title;
+		browser->he		= he;
+	}
+
+	return browser;
+}
+
+static int perf_c2c__browse_cacheline(struct hist_entry *he)
+{
+	struct c2c_hist_entry *c2c_he;
+	struct c2c_hists *c2c_hists;
+	struct c2c_cacheline_browser *cl_browser;
+	struct hist_browser *browser;
+	int key = -1;
+
+	c2c_he = container_of(he, struct c2c_hist_entry, he);
+	c2c_hists = c2c_he->hists;
+
+	cl_browser = c2c_cacheline_browser__new(&c2c_hists->hists, he);
+	if (cl_browser == NULL)
+		return -1;
+
+	browser = &cl_browser->hb;
+
+	/* reset abort key so that it can get Ctrl-C as a key */
+	SLang_reset_tty();
+	SLang_init_tty(0, 0, 0);
+
+	c2c_browser__update_nr_entries(browser);
+
+	while (1) {
+		key = hist_browser__run(browser, "help");
+
+		switch (key) {
+		case 'q':
+			goto out;
+		default:
+			break;
+		}
+	}
+
+out:
+	free(cl_browser);
+	return 0;
+}
+
 static int perf_c2c_browser__title(struct hist_browser *browser,
 				   char *bf, size_t size)
 {
@@ -1872,6 +1950,9 @@ static int perf_c2c__hists_browse(struct hists *hists)
 		switch (key) {
 		case 'q':
 			goto out;
+		case 'd':
+			perf_c2c__browse_cacheline(browser->he_selection);
+			break;
 		default:
 			break;
 		}
-- 
2.7.4

[toc] | [next] | [standalone]


#1487613

FromKim Phillips <kim.phillips@arm.com>
Date2016-09-20 22:20 +0200
Message-ID<sjzGh-7MY-7@gated-at.bofh.it>
In reply to#1486451
On Mon, 19 Sep 2016 15:09:56 +0200
Jiri Olsa <jolsa@kernel.org> wrote:

> +	/* reset abort key so that it can get Ctrl-C as a key */
> +	SLang_reset_tty();
> +	SLang_init_tty(0, 0, 0);

this fails to build on systems without slang:

  CC       builtin-c2c.o
builtin-c2c.c: In function ‘perf_c2c__browse_cacheline’:
builtin-c2c.c:2211:2: error: implicit declaration of function ‘SLang_reset_tty’ [-Werror=implicit-function-declaration]
  SLang_reset_tty();
  ^
builtin-c2c.c:2211:2: error: nested extern declaration of ‘SLang_reset_tty’ [-Werror=nested-externs]
builtin-c2c.c:2212:2: error: implicit declaration of function ‘SLang_init_tty’ [-Werror=implicit-function-declaration]
  SLang_init_tty(0, 0, 0);
  ^
builtin-c2c.c:2212:2: error: nested extern declaration of ‘SLang_init_tty’ [-Werror=nested-externs]
cc1: all warnings being treated as errors
mv: cannot stat ‘./.builtin-c2c.o.tmp’: No such file or directory
tools/build/Makefile.build:77: recipe for target 'builtin-c2c.o' failed

Thanks,

Kim

[toc] | [prev] | [next] | [standalone]


#1487905

FromJiri Olsa <jolsa@redhat.com>
Date2016-09-21 10:30 +0200
Message-ID<sjL4J-6Cq-5@gated-at.bofh.it>
In reply to#1487613
On Tue, Sep 20, 2016 at 03:10:07PM -0500, Kim Phillips wrote:
> On Mon, 19 Sep 2016 15:09:56 +0200
> Jiri Olsa <jolsa@kernel.org> wrote:
> 
> > +	/* reset abort key so that it can get Ctrl-C as a key */
> > +	SLang_reset_tty();
> > +	SLang_init_tty(0, 0, 0);
> 
> this fails to build on systems without slang:
> 
>   CC       builtin-c2c.o
> builtin-c2c.c: In function ‘perf_c2c__browse_cacheline’:
> builtin-c2c.c:2211:2: error: implicit declaration of function ‘SLang_reset_tty’ [-Werror=implicit-function-declaration]
>   SLang_reset_tty();

will fix, thanks

jirka

[toc] | [prev] | [next] | [standalone]


#1488109

FromJiri Olsa <jolsa@redhat.com>
Date2016-09-21 15:00 +0200
Message-ID<sjPi2-Ff-25@gated-at.bofh.it>
In reply to#1487905
On Wed, Sep 21, 2016 at 10:21:55AM +0200, Jiri Olsa wrote:
> On Tue, Sep 20, 2016 at 03:10:07PM -0500, Kim Phillips wrote:
> > On Mon, 19 Sep 2016 15:09:56 +0200
> > Jiri Olsa <jolsa@kernel.org> wrote:
> > 
> > > +	/* reset abort key so that it can get Ctrl-C as a key */
> > > +	SLang_reset_tty();
> > > +	SLang_init_tty(0, 0, 0);
> > 
> > this fails to build on systems without slang:
> > 
> >   CC       builtin-c2c.o
> > builtin-c2c.c: In function ‘perf_c2c__browse_cacheline’:
> > builtin-c2c.c:2211:2: error: implicit declaration of function ‘SLang_reset_tty’ [-Werror=implicit-function-declaration]
> >   SLang_reset_tty();
> 
> will fix, thanks

fixed branch pushed in perf/c2c_v4

jirka

[toc] | [prev] | [next] | [standalone]


#1488353

FromKim Phillips <kim.phillips@arm.com>
Date2016-09-21 21:40 +0200
Message-ID<sjVx8-4Eu-29@gated-at.bofh.it>
In reply to#1488109
On Wed, 21 Sep 2016 14:55:40 +0200
Jiri Olsa <jolsa@redhat.com> wrote:

> On Wed, Sep 21, 2016 at 10:21:55AM +0200, Jiri Olsa wrote:
> > On Tue, Sep 20, 2016 at 03:10:07PM -0500, Kim Phillips wrote:
> > > this fails to build on systems without slang:
> > > 
> > >   CC       builtin-c2c.o
> > > builtin-c2c.c: In function ‘perf_c2c__browse_cacheline’:
> > > builtin-c2c.c:2211:2: error: implicit declaration of function ‘SLang_reset_tty’ [-Werror=implicit-function-declaration]
> > >   SLang_reset_tty();
> > 
> > will fix, thanks
> 
> fixed branch pushed in perf/c2c_v4

that works much better, thanks.

Kim

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web