From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Paul Clarke <pc@us.ibm.com>
Cc: Jin Yao <yao.jin@linux.intel.com>, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 08/27] perf record: Record the first and last sample time in the header
Date: Thu, 11 Jan 2018 11:46:20 -0300 [thread overview]
Message-ID: <20180111144620.GA1021@kernel.org> (raw)
In-Reply-To: <eea03d85-68ef-3902-fedf-8652a429f764@us.ibm.com>
Em Thu, Jan 11, 2018 at 07:29:46AM -0600, Paul Clarke escreveu:
> On 01/10/2018 03:28 PM, Arnaldo Carvalho de Melo wrote:
> > From: Jin Yao <yao.jin@linux.intel.com>
> >
> > In the default 'perf record' configuration, all samples are processed,
> > to create the HEADER_BUILD_ID table. 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().
> >
> > Later, at post processing time, perf report/script will fetch the time
> > from perf file header.
> >
> > Committer testing:
> >
> > # perf record -a sleep 1
> > [ perf record: Woken up 1 times to write data ]
> > [ perf record: Captured and wrote 2.099 MB perf.data (1101 samples) ]
> > [root@jouet home]# perf report --header | grep "time of "
> > # time of first sample : 22947.909226
> > # time of last sample : 22948.910704
> > #
> > # perf report -D | grep PERF_RECORD_SAMPLE\(
> > 0 22947909226101 0x20bb68 [0x30]: PERF_RECORD_SAMPLE(IP, 0x4001): 0/0: 0xffffffffa21b1af3 period: 1 addr: 0
> > 0 22947909229928 0x20bb98 [0x30]: PERF_RECORD_SAMPLE(IP, 0x4001): 0/0: 0xffffffffa200d204 period: 1 addr: 0
> > <SNIP>
> > 3 22948910397351 0x219360 [0x30]: PERF_RECORD_SAMPLE(IP, 0x4001): 28251/28251: 0xffffffffa22071d8 period: 169518 addr: 0
> > 0 22948910652380 0x20f120 [0x30]: PERF_RECORD_SAMPLE(IP, 0x4001): 0/0: 0xffffffffa2856816 period: 198807 addr: 0
> > 2 22948910704034 0x2172d0 [0x30]: PERF_RECORD_SAMPLE(IP, 0x4001): 0/0: 0xffffffffa2856816 period: 88111 addr: 0
> > #
> This would be really useful to incorporate within "trace_begin" for
> perf script language support. How difficult would that be?
> Within perf scripts, it could be used to more efficiently compute
> deltas from the start of the trace within the functions. For example,
> every time a function is invoked, like raw_syscalls__sys_enter, the
> only context one has is the current timestamp. To determine the delta
> since the start of the trace, one has to know if this is the first
> event. So, *every* event function needs something like:
> def event_family__event(event_name, context, common_cpu, common_secs, common_nsecs, common_pid, common_comm, common_callchain, ..., perf_sample_dict):
> global start_timestamp
> current_timestamp = nsecs(common_secs, common_nsecs)
> if (start_timestamp == 0):
> start_timestamp = current_timestamp
> If start_timestamp could be set in trace_begin, the conditional
> assignment of start_timestamp could be eliminated in *every* function.
> (More generally, perhaps "trace_begin" could have access to the full
> set of information in the perf.data header? Like, how many events are
> in the trace, so "% complete" tickers could be displayed during
> processing.)
Yeah, I think this is something worth exported to python/perl scripts in
some sane way, via classes or a simple dict.
- Arnaldo
next prev parent reply other threads:[~2018-01-11 14:46 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 21:28 [GIT PULL 00/27] perf/core improvements and fixes Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 01/27] perf test bpf: Improve message about expected samples Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 02/27] perf test bpf: Use designated struct field initializers Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 03/27] perf test bpf: Hook on epoll_pwait() Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 04/27] perf tools: Fix compile error with libunwind x86 Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 05/27] perf report: Fix a wrong offset issue when using /proc/kcore Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 06/27] perf report: Fix a no annotate browser displayed issue Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 07/27] perf header: Add infrastructure to record first and last sample time Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 08/27] perf record: Record the first and last sample time in the header Arnaldo Carvalho de Melo
2018-01-11 13:29 ` Paul Clarke
2018-01-11 14:46 ` Arnaldo Carvalho de Melo [this message]
2018-01-10 21:28 ` [PATCH 09/27] perf tools: Create function to parse time percent Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 10/27] perf tools: Create function to perform multiple time range checking Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 11/27] perf report: Support time percent and multiple time ranges Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 12/27] perf script: " Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 13/27] perf tools: Enable LIBBABELTRACE by default Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 14/27] perf tools: Display perf_event_attr::namespaces debug info Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 15/27] perf: Allocate context task_ctx_data for child event Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 16/27] perf: Add sample_id to PERF_RECORD_ITRACE_START event comment Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 17/27] perf: Make perf_callchain function static Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 18/27] perf: Return empty callchain instead of NULL Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 19/27] perf: Update PERF_RECORD_MISC_* comment for perf_event_header::misc bit 13 Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 20/27] perf script: Add support to display sample misc field Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 21/27] perf script: Add support to display lost events Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 22/27] perf tools: Make the tool's warning messages optional Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 23/27] perf report: Add --stats option to display quick data statistics Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 24/27] perf trace: Beautify 'gettid' syscall result Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 25/27] perf report: Add --tasks option to display monitored tasks Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 26/27] perf report: Introduce --mmaps Arnaldo Carvalho de Melo
2018-01-10 21:28 ` [PATCH 27/27] tools headers: Synchronize kernel <-> tooling headers Arnaldo Carvalho de Melo
2018-01-11 5:54 ` [GIT PULL 00/27] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180111144620.GA1021@kernel.org \
--to=acme@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=pc@us.ibm.com \
--cc=yao.jin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).