All of lore.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 v3 6/6] perf script: support time percent and multiple time ranges
Date: Mon, 2 Oct 2017 16:21:32 +0200	[thread overview]
Message-ID: <20171002142132.GB24613@krava> (raw)
In-Reply-To: <a5435c28-6a44-7cd6-e85a-94089ff02e8a@linux.intel.com>

On Mon, Oct 02, 2017 at 09:41:09PM +0800, Jin, Yao wrote:
> 
> 
> On 10/2/2017 7:58 PM, Jiri Olsa wrote:
> > On Thu, Sep 28, 2017 at 08:45:21PM +0800, Jin Yao wrote:
> > 
> > SNIP
> > 
> >> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> >> index 9092de0..7fd3063 100644
> >> --- a/tools/perf/builtin-script.c
> >> +++ b/tools/perf/builtin-script.c
> >> @@ -1357,6 +1357,8 @@ static void print_sample_synth(struct perf_sample *sample,
> >>  	}
> >>  }
> >>  
> >> +#define PTIME_RANGE_MAX	10
> >> +
> >>  struct perf_script {
> >>  	struct perf_tool	tool;
> >>  	struct perf_session	*session;
> >> @@ -1370,6 +1372,8 @@ struct perf_script {
> >>  	int			name_width;
> >>  	const char              *time_str;
> >>  	struct perf_time_interval ptime;
> >> +	struct perf_time_interval ptime_range[PTIME_RANGE_MAX];
> >> +	int			range_num;
> >>  };
> >>  
> >>  static int perf_evlist__max_name_len(struct perf_evlist *evlist)
> >> @@ -1565,8 +1569,11 @@ static int process_sample_event(struct perf_tool *tool,
> >>  	struct perf_script *scr = container_of(tool, struct perf_script, tool);
> >>  	struct addr_location al;
> >>  
> >> -	if (perf_time__skip_sample(&scr->ptime, sample->time))
> >> +	if (perf_time__skip_sample(&scr->ptime, sample->time) ||
> >> +	    perf_time__ranges_skip_sample(scr->ptime_range, scr->range_num,
> >> +					  sample->time)) {
> > 
> > any reason for why dont use ptime_range[1] with range_num = 1
> > and use just a single call here?
> > 
> > jirka
> > 
> 
> Just want the code to be easy reading.
> 
> perf_time__range_skip_sample doesn't allow the invalid time range.
> 
> But perf_time__skip_sample allows the time range to be invalid (ptime->start or ptime->end can be 0). 
> 
> I don't want to mix them up because the code might be not clear.
> 
> Are 2 calls OK here? If you think a single call is better, I will change.

well, would be nice to have single call for this.. but not big deal for me ;-)

jirka

  reply	other threads:[~2017-10-02 14:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 12:45 [PATCH v3 0/6] perf report/script: Support percent and multiple range in --time option Jin Yao
2017-09-28 12:45 ` [PATCH v3 1/6] perf header: Record first sample time and last sample time in perf file header Jin Yao
2017-10-02 11:50   ` Jiri Olsa
2017-10-02 12:52     ` Jin, Yao
2017-10-02 13:00       ` Jiri Olsa
2017-10-02 13:48         ` Jin, Yao
2017-10-02 14:15           ` Jiri Olsa
2017-09-28 12:45 ` [PATCH v3 2/6] perf record: Get the first sample time and last sample time Jin Yao
2017-09-28 12:45 ` [PATCH v3 3/6] perf util: Create function to parse time percent Jin Yao
2017-09-28 12:45 ` [PATCH v3 4/6] perf util: Create function to perform multiple time range checking Jin Yao
2017-09-28 12:45 ` [PATCH v3 5/6] perf report: support time percent and multiple time ranges Jin Yao
2017-10-02 11:52   ` Jiri Olsa
2017-10-02 12:57     ` Jin, Yao
2017-09-28 12:45 ` [PATCH v3 6/6] perf script: " Jin Yao
2017-10-02 11:58   ` Jiri Olsa
2017-10-02 13:41     ` Jin, Yao
2017-10-02 14:21       ` Jiri Olsa [this message]
2017-10-02 14:28         ` 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=20171002142132.GB24613@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 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.