All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH/RFC] perf ui/tui: Show column header in hist browser
Date: Wed, 15 Jan 2014 11:13:14 -0300	[thread overview]
Message-ID: <20140115141314.GA16016@ghostprotocols.net> (raw)
In-Reply-To: <20140115121044.GA1669@krava.redhat.com>

Em Wed, Jan 15, 2014 at 01:10:44PM +0100, Jiri Olsa escreveu:
> On Wed, Jan 15, 2014 at 02:08:45PM +0900, Namhyung Kim wrote:
> > Add a line for showing column headers like --stdio.
> 
> https://git.kernel.org/cgit/linux/kernel/git/jolsa/perf.git/commit/?h=perf/lock12&id=1a06d77629cb8870838132688f443b9ca1436026
> 
> ;-) I'll check your change

>From a quick view, your change looks better, i.e. being able to toggle
the header line.

Please let me know what you guys end up agreeing is best.

- Arnaldo
 
> jirka
> 
> > 
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/perf/ui/browser.c        |  4 +--
> >  tools/perf/ui/browsers/hists.c | 55 ++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 57 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c
> > index d11541d4d7d7..441470ba8d2c 100644
> > --- a/tools/perf/ui/browser.c
> > +++ b/tools/perf/ui/browser.c
> > @@ -278,8 +278,8 @@ void ui_browser__hide(struct ui_browser *browser)
> >  static void ui_browser__scrollbar_set(struct ui_browser *browser)
> >  {
> >  	int height = browser->height, h = 0, pct = 0,
> > -	    col = browser->width,
> > -	    row = browser->y - 1;
> > +	    col = browser->width, row = 0;
> > +
> >  
> >  	if (browser->nr_entries > 1) {
> >  		pct = ((browser->index * (browser->height - 1)) /
> > diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> > index e0ab399d431d..5b94de48f23c 100644
> > --- a/tools/perf/ui/browsers/hists.c
> > +++ b/tools/perf/ui/browsers/hists.c
> > @@ -25,6 +25,7 @@ struct hist_browser {
> >  	struct map_symbol   *selection;
> >  	int		     print_seq;
> >  	bool		     show_dso;
> > +	bool		     show_column_header;
> >  	float		     min_pcnt;
> >  	u64		     nr_pcnt_entries;
> >  };
> > @@ -312,6 +313,57 @@ static void ui_browser__warn_lost_events(struct ui_browser *browser)
> >  
> >  static void hist_browser__update_pcnt_entries(struct hist_browser *hb);
> >  
> > +static void hist_browser__column_header(struct hist_browser *browser)
> > +{
> > +	struct perf_hpp_fmt *fmt;
> > +	struct sort_entry *se;
> > +	struct hists *hists = browser->hists;
> > +	bool show = browser->show_column_header;
> > +	unsigned int width;
> > +
> > +	pthread_mutex_lock(&ui__lock);
> > +
> > +	if (!show)
> > +		goto out;
> > +
> > +	ui_browser__gotorc(&browser->b, 0, 0);
> > +
> > +	perf_hpp__for_each_format(fmt) {
> > +		char buf[128];
> > +		struct perf_hpp hpp = {
> > +			.buf	= buf,
> > +			.size	= sizeof(buf),
> > +			.ptr	= hists_to_evsel(hists),
> > +		};
> > +
> > +		width = fmt->width(fmt, &hpp);
> > +		fmt->header(fmt, &hpp);
> > +
> > +		slsmg_printf(" %-*s", width, hpp.buf);
> > +	}
> > +
> > +	list_for_each_entry(se, &hist_entry__sort_list, list) {
> > +		if (se->elide)
> > +			continue;
> > +
> > +		width = strlen(se->se_header);
> > +		if (!hists__new_col_len(hists, se->se_width_idx, width))
> > +			width = hists__col_len(hists, se->se_width_idx);
> > +
> > +		slsmg_printf("  %-*s", width, se->se_header);
> > +	}
> > +
> > +	/*
> > +	 * We just called ui_browser__refresh_dimensions().
> > +	 * Update it to honor a new column header line.
> > +	 */
> > +	browser->b.y++;
> > +	browser->b.height--;
> > +
> > +out:
> > +	pthread_mutex_unlock(&ui__lock);
> > +}
> > +
> >  static int hist_browser__run(struct hist_browser *browser, const char *ev_name,
> >  			     struct hist_browser_timer *hbt)
> >  {
> > @@ -331,6 +383,8 @@ static int hist_browser__run(struct hist_browser *browser, const char *ev_name,
> >  			     "Press '?' for help on key bindings") < 0)
> >  		return -1;
> >  
> > +	hist_browser__column_header(browser);
> > +
> >  	while (1) {
> >  		key = ui_browser__run(&browser->b, delay_secs);
> >  
> > @@ -1198,6 +1252,7 @@ static struct hist_browser *hist_browser__new(struct hists *hists)
> >  		browser->b.refresh = hist_browser__refresh;
> >  		browser->b.seek = ui_browser__hists_seek;
> >  		browser->b.use_navkeypressed = true;
> > +		browser->show_column_header = true;
> >  	}
> >  
> >  	return browser;
> > -- 
> > 1.7.11.7
> > 

  reply	other threads:[~2014-01-15 14:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15  5:08 [PATCH/RFC] perf ui/tui: Show column header in hist browser Namhyung Kim
2014-01-15 12:10 ` Jiri Olsa
2014-01-15 14:13   ` Arnaldo Carvalho de Melo [this message]
2014-01-16  0:42     ` Namhyung Kim
2014-01-16  8:24       ` Jiri Olsa

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=20140115141314.GA16016@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=dsahern@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.