public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: "Jin, Yao" <yao.jin@linux.intel.com>
Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
	mingo@redhat.com, alexander.shishkin@linux.intel.com,
	Linux-kernel@vger.kernel.org, ak@linux.intel.com,
	kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH v6 7/7] perf report: Sort by sampled cycles percent per block for tui
Date: Thu, 7 Nov 2019 10:26:33 +0100	[thread overview]
Message-ID: <20191107092633.GA14657@krava> (raw)
In-Reply-To: <cddb7e55-ae98-62c7-db9f-70e6fc734579@linux.intel.com>

On Thu, Nov 07, 2019 at 02:19:10PM +0800, Jin, Yao wrote:
> 
> 
> On 11/7/2019 5:01 AM, Jiri Olsa wrote:
> > On Tue, Nov 05, 2019 at 11:36:11AM +0800, Jin Yao wrote:
> > 
> > SNIP
> > 
> > > 
> > > Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
> > > ---
> > >   tools/perf/builtin-report.c    | 27 ++++++++++++---
> > >   tools/perf/ui/browsers/hists.c | 62 +++++++++++++++++++++++++++++++++-
> > >   tools/perf/ui/browsers/hists.h |  2 ++
> > >   tools/perf/util/block-info.c   | 12 +++++++
> > >   tools/perf/util/block-info.h   |  3 ++
> > >   tools/perf/util/hist.h         | 12 +++++++
> > >   6 files changed, 112 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> > > index 7a8b0be8f09a..af5a57d06f12 100644
> > > --- a/tools/perf/builtin-report.c
> > > +++ b/tools/perf/builtin-report.c
> > > @@ -485,6 +485,22 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
> > >   	return ret + fprintf(fp, "\n#\n");
> > >   }
> > > +static int perf_evlist__tui_block_hists_browse(struct evlist *evlist,
> > > +					       struct report *rep)
> > > +{
> > > +	struct evsel *pos;
> > > +	int i = 0, ret;
> > > +
> > > +	evlist__for_each_entry(evlist, pos) {
> > > +		ret = report__tui_browse_block_hists(&rep->block_reports[i++].hist,
> > > +						     rep->min_percent, pos);
> > > +		if (ret != 0)
> > > +			return ret;
> > > +	}
> > > +
> > > +	return 0;
> > > +}
> > > +
> > >   static int perf_evlist__tty_browse_hists(struct evlist *evlist,
> > >   					 struct report *rep,
> > >   					 const char *help)
> > > @@ -595,6 +611,11 @@ static int report__browse_hists(struct report *rep)
> > >   	switch (use_browser) {
> > >   	case 1:
> > > +		if (rep->total_cycles_mode) {
> > > +			ret = perf_evlist__tui_block_hists_browse(evlist, rep);
> > > +			break;
> > > +		}
> > 
> > it's good that most of it is in the block-info.c,
> > however what I mean was to have a single report
> > function for rep->total_cycles_mode, like:
> > 
> > 	report__browse_block_hists()
> > 	{
> > 		switch (use_browser) {
> > 		case 1:
> > 			ret = perf_evlist__tui_block_hists_browse(evlist, rep);
> > 			break;
> > 		case 0:
> > 			ret = perf_evlist__tty_block_hists_browse(evlist, rep);
> > 			break;
> > 		...
> > 	}
> > 
> > preferable in block-info.c as well
> > 
> > which would be hooked in report__browse_hists:
> > 
> > 	report__browse_hists()
> > 	{
> > 		if (rep->total_cycles_mode)
> > 			return report__browse_block_hists();
> > 		...
> > 	}
> > 
> 
> If we move all block implementations from builtin-report.c to block-info.c,
> one difficulty is that we can't reuse some codes in builtin-report.c. For
> example, reuse the function which prints the event stats
> (hists__fprintf_nr_sample_events)

aah so that's why it's deep in perf_evlist__tty_browse_hists, I see
ok it's close enough then ;-)

thanks,
jirka


      reply	other threads:[~2019-11-07  9:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05  3:36 [PATCH v6 0/7] perf report: Support sorting all blocks by cycles Jin Yao
2019-11-05  3:36 ` [PATCH v6 1/7] perf diff: Don't use hack to skip column length calculation Jin Yao
2019-11-05  3:36 ` [PATCH v6 2/7] perf util: Cleanup and refactor block info functions Jin Yao
2019-11-05  3:36 ` [PATCH v6 3/7] perf util: Count the total cycles of all samples Jin Yao
2019-11-05  3:36 ` [PATCH v6 4/7] perf util: Support block formats with compare/sort/display Jin Yao
2019-11-05  3:36 ` [PATCH v6 5/7] perf report: Sort by sampled cycles percent per block for stdio Jin Yao
2019-11-05  3:36 ` [PATCH v6 6/7] perf report: Support --percent-limit for --total-cycles Jin Yao
2019-11-05  3:36 ` [PATCH v6 7/7] perf report: Sort by sampled cycles percent per block for tui Jin Yao
2019-11-06 21:01   ` Jiri Olsa
2019-11-07  6:19     ` Jin, Yao
2019-11-07  9:26       ` Jiri Olsa [this message]

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=20191107092633.GA14657@krava \
    --to=jolsa@redhat.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 \
    --cc=yao.jin@linux.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