On 10/2/2017 10:21 PM, Jiri Olsa wrote: > 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 >
I will make a single call for this. Thanks Jin Yao