Re: [PATCH v3 6/6] perf script: support time percent and multiple time ranges
From: Jiri Olsa
Date: Mon Oct 02 2017 - 07:58:42 EST
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