From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751505AbdJBNsm (ORCPT ); Mon, 2 Oct 2017 09:48:42 -0400 Received: from mga02.intel.com ([134.134.136.20]:53301 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751166AbdJBNsl (ORCPT ); Mon, 2 Oct 2017 09:48:41 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,469,1500966000"; d="scan'208";a="134326409" Subject: Re: [PATCH v3 1/6] perf header: Record first sample time and last sample time in perf file header 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-2-git-send-email-yao.jin@linux.intel.com> <20171002115057.GA16128@krava> <20171002130057.GA22359@krava> From: "Jin, Yao" Message-ID: <2e7c593d-48e1-414c-9132-52fcdc0311f7@linux.intel.com> Date: Mon, 2 Oct 2017 21:48:31 +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: <20171002130057.GA22359@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 9:00 PM, Jiri Olsa wrote: > On Mon, Oct 02, 2017 at 08:52:59PM +0800, Jin, Yao wrote: >> >> >> On 10/2/2017 7:50 PM, Jiri Olsa wrote: >>> On Thu, Sep 28, 2017 at 08:45:16PM +0800, Jin Yao wrote: >>> >>> SNIP >>> >>>> + return ret; >>>> + >>>> + return do_write(ff, &evlist->last_sample_time, >>>> + sizeof(evlist->last_sample_time)); >>>> +} >>>> + >>>> static void print_hostname(struct feat_fd *ff, FILE *fp) >>>> { >>>> fprintf(fp, "# hostname : %s\n", ff->ph->env.hostname); >>>> @@ -1506,6 +1520,19 @@ static void print_group_desc(struct feat_fd *ff, FILE *fp) >>>> } >>>> } >>>> >>>> +static void print_sample_time(struct feat_fd *ff, FILE *fp) >>>> +{ >>>> + struct perf_session *session; >>>> + >>>> + session = container_of(ff->ph, struct perf_session, header); >>>> + >>>> + fprintf(fp, "# time of first sample : %" PRIu64 "\n", >>>> + session->evlist->first_sample_time); >>>> + >>>> + fprintf(fp, "# time of last sample : %" PRIu64 "\n", >>>> + session->evlist->last_sample_time); >>> >>> this could be done in some follow up patch, but could we >>> display this in some human readable way.. >>> >>> # time of first sample : 218077073264620 >>> # time of last sample : 218077073395488 >>> >>> jirka >>> >> >> Could I add the printing of duration? For example, >> >> duration = (double)(last_sample_time - first_sample_time) / NSEC_PER_MSEC; >> fprintf(fp, "# sample duration: %10.3f (ms)\n", duration); >> >> fprintf(fp, "# time of first sample : %" PRIu64 "\n", >> first_sample_time); >> >> fprintf(fp, "# time of last sample : %" PRIu64 "\n", >> last_sample_time); > > could be, but mainly please display the time same way the perf script does: > > 218482.819815 > > jirka > Fine. I think I can use timestamp__scnprintf_usec() to print the timestamp. BTW, do we need the duration printing here? Thanks Jin Yao