From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751441AbdJBNlW (ORCPT ); Mon, 2 Oct 2017 09:41:22 -0400 Received: from mga03.intel.com ([134.134.136.65]:29108 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751084AbdJBNlT (ORCPT ); Mon, 2 Oct 2017 09:41:19 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,469,1500966000"; d="scan'208";a="134322538" Subject: Re: [PATCH v3 6/6] perf script: support time percent and multiple time ranges To: Jiri Olsa 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 References: <1506602721-3784-1-git-send-email-yao.jin@linux.intel.com> <1506602721-3784-7-git-send-email-yao.jin@linux.intel.com> <20171002115836.GC16128@krava> From: "Jin, Yao" Message-ID: Date: Mon, 2 Oct 2017 21:41:09 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171002115836.GC16128@krava> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks Jin Yao