From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752814AbdI0NA2 (ORCPT ); Wed, 27 Sep 2017 09:00:28 -0400 Received: from mga01.intel.com ([192.55.52.88]:7962 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752104AbdI0NA1 (ORCPT ); Wed, 27 Sep 2017 09:00:27 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,445,1500966000"; d="scan'208";a="1199604322" Subject: Re: [PATCH v2 2/6] perf record: Get the first sample time and last sample time 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: <1506423482-16894-1-git-send-email-yao.jin@linux.intel.com> <1506423482-16894-3-git-send-email-yao.jin@linux.intel.com> <20170927121614.GA563@krava> From: "Jin, Yao" Message-ID: <4b51147f-4afe-636b-9ec5-152d1a8922b8@linux.intel.com> Date: Wed, 27 Sep 2017 21:00:05 +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: <20170927121614.GA563@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 9/27/2017 8:16 PM, Jiri Olsa wrote: > On Tue, Sep 26, 2017 at 06:57:58PM +0800, Jin Yao wrote: >> In perf record, it's walked on all samples yet. So it's very easy to get >> the first/last samples and save the time to perf file header via the >> function write_sample_time(). >> >> In later, perf report/script will fetch the time from perf file header. >> >> Signed-off-by: Jin Yao >> --- >> tools/perf/builtin-record.c | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> >> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c >> index 9b379f3..3428633 100644 >> --- a/tools/perf/builtin-record.c >> +++ b/tools/perf/builtin-record.c >> @@ -80,6 +80,8 @@ struct record { >> bool timestamp_filename; >> struct switch_output switch_output; >> unsigned long long samples; >> + u64 first_sample_time; >> + u64 last_sample_time; > > so we have those 2 u64 already in 3 structs: evlist, session and now record > > can't we do that with just in one? I'd think all of them should be available > and reachable everywhere > > jirka > Thanks! Yes, you are right. It looks we only need to define them in evlist. If no other comments, I will prepare v3 to fix this. Thanks Jin Yao