perf events: Add realtime clock event and timehist option
PATCH 2/3 perf events: Introduce realtime clock event
In reply to David AhernThe motivation for this event is to convert perf_clock() time stamps to wall-clock (gettimeofday()) equivalents, including adjustments made by NTP (e.g., for comparing perf events to other log files).
This patch is based on the monotonic patch by Arnaldo Carvalho de Melo <[email protected]>.
(NOTE: Comments from the last review of the timehist patch series suggested calling this a monotonic clock. I am not trying to be dense here; since gettimeofday maps to realtime clock I think that is the better name for it.)
--- include/linux/perf_event.h | 1 + kernel/perf_event.c | 72 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 0 deletions(-)
include/linux/perf_event.h +1 -0
@@ -105,6 +105,7 @@ enum perf_sw_ids {PERF_COUNT_SW_PAGE_FAULTS_MAJ =6 ,PERF_COUNT_SW_ALIGNMENT_FAULTS =7 ,PERF_COUNT_SW_EMULATION_FAULTS =8 , +PERF_COUNT_SW_REALTIME_CLOCK =9 , PERF_COUNT_SW_MAX, /* non-ABI */ };
kernel/perf_event.c +72 -0
102 lines not on this page · raw message
Signature · 1 line
1.7.3.4
PATCH 3/3 perf events: add timehist option to record and report
In reply to David AhernThe intent of the timehist option is to 'pretty-print' the samples recorded rather than generating a histogram. This is done by sampling the realtime clock event and correlating perf_clock time stamps to wall-clock.
If the realtime-clock event is not available (e.g, older kernels) fallback to a synthesized event. (I realize there is resistance to new synthesized events, but it is a simple way to gain this feature on older kernels without the new to modify the kernel code).
NOTE: Commit ba3dd36 needs to be reverted else this causes the system to spin. Ironically, ba3dd36 was created to resolve a lockup.
--- tools/perf/Documentation/perf-record.txt | 4 + tools/perf/Documentation/perf-report.txt | 6 + tools/perf/builtin-record.c | 78 +++++++++++- tools/perf/builtin-report.c | 208 +++++++++++++++++++++++++++++- tools/perf/util/event.c | 1 + tools/perf/util/event.h | 8 + tools/perf/util/parse-events.c | 2 + tools/perf/util/session.c | 4 + tools/perf/util/session.h | 3 +- 9 files changed, 310 insertions(+), 4 deletions(-)
tools/perf/Documentation/perf-record.txt +4 -0
@@ -148,6 +148,10 @@ an empty cgroup (monitor all the time) using, e.g., -G foo,,bar. Cgroups must ha corresponding events, i.e., they always refer to events defined earlier on the command line. +--timehist:: +Collect data for time history report. This generates reference time samples +which are used to convert perf timestamps to time-of-day. + SEE ALSO -------- linkperf:perf-stat[1], linkperf:perf-list[1]
tools/perf/Documentation/perf-report.txt +6 -0
@@ -119,6 +119,12 @@ OPTIONS --symfs=<directory>:: Look for files with symbols relative to this directory. +--timehist:: + Generate time history output. This shows each sample with a wall-clock + timestamp and address to symbol conversions. The samples are output in + the same order they exist in the perf.data file. The --timehist option + must be used with the record to get wall-clock timestamps. + SEE ALSO -------- linkperf:perf-stat[1]
tools/perf/builtin-record.c +77 -1
120 lines not on this page · raw message
tools/perf/builtin-report.c +206 -2
262 lines not on this page · raw message
tools/perf/util/event.c +1 -0
@@ -24,6 +24,7 @@ static const char *perf_event__names[] = { [PERF_RECORD_HEADER_TRACING_DATA] = "TRACING_DATA", [PERF_RECORD_HEADER_BUILD_ID] = "BUILD_ID", [PERF_RECORD_FINISHED_ROUND] = "FINISHED_ROUND", + [PERF_RECORD_REFTIME] = "REF_TIME", };const char *perf_event__name (unsigned int id)
tools/perf/util/event.h +8 -0
@@ -91,6 +91,7 @@ enum perf_user_event_type { /* above any possible kernel type */PERF_RECORD_HEADER_TRACING_DATA =66 ,PERF_RECORD_HEADER_BUILD_ID =67 ,PERF_RECORD_FINISHED_ROUND =68 , +PERF_RECORD_REFTIME =69 , PERF_RECORD_HEADER_MAX };
@@ -117,6 +118,12 @@ struct tracing_data_event {u32 size; }; +struct reftime_event { +struct perf_event_header header; +struct timeval tv; +u64 nsec; +}; +union perf_event {struct perf_event_header header;struct ip_event ip;
@@ -130,6 +137,7 @@ union perf_event {struct event_type_event event_type;struct tracing_data_event tracing_data;struct build_id_event build_id; +struct reftime_event reftime; };void perf_event__print_totals (void );
tools/perf/util/parse-events.c +2 -0
@@ -40,6 +40,7 @@ static struct event_symbol event_symbols[] = { { CHW(BUS_CYCLES), "bus-cycles", "" }, { CSW(CPU_CLOCK), "cpu-clock", "" }, + { CSW(REALTIME_CLOCK), "realtime-clock", "rclk" }, { CSW(TASK_CLOCK), "task-clock", "" }, { CSW(PAGE_FAULTS), "page-faults", "faults" }, { CSW(PAGE_FAULTS_MIN), "minor-faults", "" },
@@ -78,6 +79,7 @@ static const char *sw_event_names[] = {"major-faults" ,"alignment-faults" ,"emulation-faults" , + "realtime-clock-msecs", };#define MAX_ALIASES 8
tools/perf/util/session.c +4 -0
@@ -779,6 +779,10 @@ static int perf_session__process_user_event(struct perf_session *session, unionreturn ops->build_id (event, session);case PERF_RECORD_FINISHED_ROUND :return ops->finished_round (event, session, ops); +case PERF_RECORD_REFTIME : +if (ops->reftime) +return ops->reftime (event, session); +return -EINVAL ;default :return -EINVAL ; }
tools/perf/util/session.h +2 -1
@@ -77,7 +77,8 @@ struct perf_event_ops {event_synth_op attr, event_type, tracing_data, - build_id; + build_id, + reftime;event_op2 finished_round;bool ordered_samples;bool ordering_requires_timestamps;
Signature · 1 line
1.7.3.4
cover perf events: Add realtime clock event and timehist option
David Ahern (3):
perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events perf events: Introduce realtime clock event
perf events: add timehist option to record and report
include/linux/perf_event.h | 1 + kernel/perf_event.c | 74 +++++++++++- tools/perf/Documentation/perf-record.txt | 4 + tools/perf/Documentation/perf-report.txt | 6 + tools/perf/builtin-record.c | 78 +++++++++++- tools/perf/builtin-report.c | 208 +++++++++++++++++++++++++++++- tools/perf/util/event.c | 1 + tools/perf/util/event.h | 8 + tools/perf/util/parse-events.c | 2 + tools/perf/util/session.c | 4 + tools/perf/util/session.h | 3 +- 11 files changed, 384 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.3.4
PATCH 1/3 perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events
This check does not work out for 64-bit counter:
sizeof(u32) + sizeof(u64) = 4 + 8 = 12
which does not pass the WARN_ON_ONCE test. I'm guessing (hoping really) that the intent is that the size of the raw data is a multiple of 4 bytes, not 8.
--- kernel/perf_event.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/perf_event.c +1 -1
@@ -4351,7 +4351,7 @@ void perf_prepare_sample(struct perf_event_header *header,else size +=sizeof (u32); -WARN_ON_ONCE (size & (sizeof (u64)-1 )); +WARN_ON_ONCE (size & (sizeof (u32)-1 )); header->size += size; } }
Signature · 1 line
1.7.3.4
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to David Aherntools/perf/Documentation/perf-report.txt OPTIONS · line 126
Quoted 5 lines · David Ahern
+--timehist::
tools/perf/Documentation/perf-report.txt +4
-0+ Generate time history output. This shows each sample with a wall-clock + timestamp and address to symbol conversions. The samples are output in + the same order they exist in the perf.data file. The --timehist option + must be used with the record to get wall-clock timestamps.
Displaying samples this way is very useful, but how is this different from trace output - i.e. 'perf script' output?
There's a 'live logging mode' feature:
perf record ./myworkload | perf inject -v -b | perf script -i -
( There's also some work going on to have a separate 'perf trace' utility that will
output a linear trace of whatever events in perf.data are. )
So unless i'm missing something it would be more useful to extend 'perf script' (or the upcoming 'perf trace') to list regular samples in a perf.data (i.e. not rely on -R raw trace data alone), and of course allow a straightforward utilization of real timestamps, when available.
Thanks,
Ingo
Peter Zijlstra
maintainerRe: [PATCH 1/3] perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events
In reply to David AhernQuoted 7 lines · David Ahern
This check does not work out for 64-bit counter:
sizeof(u32) + sizeof(u64) = 4 + 8 = 12which does not pass the
WARN_ON_ONCEtest. I'm guessing (hoping really) that the intent is that the size of the raw data is a multiple of 4 bytes, not 8.
No the data must come in 8bytes strides.
Peter Zijlstra
maintainerRe: [PATCH 2/3] perf events: Introduce realtime clock event
In reply to David AhernQuoted 11 lines · David Ahern
The motivation for this event is to convert
perf_clock()time stamps to wall-clock (gettimeofday()) equivalents, including adjustments made by NTP (e.g., for comparing perf events to other log files).This patch is based on the monotonic patch by Arnaldo Carvalho de Melo <[email protected]>.
(NOTE: Comments from the last review of the timehist patch series suggested calling this a monotonic clock. I am not trying to be dense here; since gettimeofday maps to realtime clock I think that is the better name for it.)
Well, the idea was to use CLOCK_MONOTONIC, not to call CLOCK_REALTIME monotonic.
I'm really not sure why you want CLOCK_REALTIME and I think CLOCK_MONOTONIC is more useful (I'd argue you want your system logs to contain both, every admin who's ever had to untangle what happened during DST switches will agree)
Quoted 4 lines
kernel/perf_event.c +0
-0@@ -5610,6 +5612,13 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)perf_sample_data_init (&data,0 ); data.period = event->hw.last_period;
kernel/perf_event.c static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer) · line 5624
Quoted 10 lines
kernel/perf_event.c +7
-0+if (event->attr.sample_type &PERF_SAMPLE_RAW ) + { + raw.size =sizeof (u64); + raw.data = &event->count; + data.raw = &raw; + } + regs =get_irq_regs ();if (regs && !perf_exclude_event (event, regs)) {
Why!? you already keep ->count = ktime_get_real(), so simply reading the count value will get you the timestamp.. this is superfluous at best.
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to Ingo MolnarQuoted 16 lines · Ingo Molnar
tools/perf/Documentation/perf-report.txt OPTIONS · line 126
Quoted 5 lines · David Ahern
+--timehist::
tools/perf/Documentation/perf-report.txt +4
-0+ Generate time history output. This shows each sample with a wall-clock + timestamp and address to symbol conversions. The samples are output in + the same order they exist in the perf.data file. The --timehist option + must be used with the record to get wall-clock timestamps.Displaying samples this way is very useful, but how is this different from trace output - i.e. 'perf script' output?
There's a 'live logging mode' feature:
perf record ./myworkload | perf inject -v -b | perf script -i -
Quoted 7 lines
( There's also some work going on to have a separate 'perf trace' utility that will
output a linear trace of whatever events in perf.data are. )So unless i'm missing something it would be more useful to extend 'perf script' (or the upcoming 'perf trace') to list regular samples in a perf.data (i.e. not rely on -R raw trace data alone), and of course allow a straightforward utilization of real timestamps, when available.
To date I have not seen any option to show samples with wall-clock timestamps. In a sense it pretty-prints the -R format. This allows perf samples to be compared to other log files / sources of data to resolve an issue.
For example:
Time-of-Day Kernel Timestamp cpu Event Command PID
IP Symbol Name (DSO Name)
22:40:13.831567 858005051634 1 context-switches kworker/1:0 8ffffffff8103251e perf_event_task_sched_out ([kernel.kallsyms])
22:40:13.831683 858005168139 1 context-switches sshd 897ffffffff8103251e perf_event_task_sched_out ([kernel.kallsyms])
With the stack callchain option it dumps a line for each address in the stack (columns abbreviated here for email):
07:24:37.527728 1 sshd 819 ffffffff8103251e perf_event_task_sched_out ([kernel.kallsyms])
07:24:37.527728 1 sshd 819 ffffffff81377231 schedule ([kernel.kallsyms]) 07:24:37.527728 1 sshd 819 ffffffff81377f3a
schedule_hrtimeout_range_clock ([kernel.kallsyms]) 07:24:37.527728 1 sshd 819 ffffffff81378016 schedule_hrtimeout_range ([kernel.kallsyms])
07:24:37.527728 1 sshd 819 ffffffff81103e15 poll_schedule_timeout ([kernel.kallsyms])
07:24:37.527728 1 sshd 819 ffffffff8110463c do_select ([kernel.kallsyms]) 07:24:37.527728 1 sshd 819 ffffffff811047f4 core_sys_select
([kernel.kallsyms])
07:24:37.527728 1 sshd 819 ffffffff81104929 sys_select ([kernel.kallsyms])
07:24:37.527728 1 sshd 819 ffffffff81002bc2 system_call ([kernel.kallsyms])
07:24:37.527728 1 sshd 819 7f56d4814e93 __GI_select
(/lib64/libc-2.12.90.so)
07:24:37.527728 1 sshd 819 40560b run_builtin
(/tmp/build-perf/perf)
07:24:37.527728 1 sshd 819 40580d handle_internal_command
(/tmp/build-perf/perf)
07:24:37.527728 1 sshd 819 405959 run_argv
(/tmp/build-perf/perf)
07:24:37.527728 1 sshd 819 405b63 main (/tmp/build-perf/perf) 07:24:37.527728 1 sshd 819 7fa49de9fe7d __libc_start_main
(/lib64/libc-2.12.90.so)
This format has allowed us to do an in-depth analysis of scheduling (record -e cs -c 1): we can see when was process running, for how long it ran, why it was kicked off the processor, how long was it off the processor, what ran in between schedulings, etc. If a log file shows a process missing a heartbeat you can look at the perf data in the time range and see if it had a chance to run. If not where was it blocked.
David
Quoted 4 lines
Thanks,
Ingo
Re: [PATCH 1/3] perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events
In reply to Peter ZijlstraQuoted 11 lines · Peter Zijlstra
Quoted 7 lines · David Ahern
This check does not work out for 64-bit counter:
sizeof(u32) + sizeof(u64) = 4 + 8 = 12which does not pass the
WARN_ON_ONCEtest. I'm guessing (hoping really) that the intent is that the size of the raw data is a multiple of 4 bytes, not 8.No the data must come in 8bytes strides.
Then the sizeof the size field needs to be moved to u64; right now it is u32:
struct perf_raw_record {
u32 size;
void *data;
};So size should be changed to u64 rather than modifying the WARN_ON_ONCE?
Another gotcha is in perf_output_sample there is:
struct {
u32 size;
u32 data;
} raw = {
.size = sizeof(u32),
.data = 0,
};While that meets the 8-byte stride I was concerned that changing the size field to u64 breaks ABI.
David
Re: [PATCH 2/3] perf events: Introduce realtime clock event
In reply to Peter ZijlstraQuoted 13 lines · Peter Zijlstra
Quoted 11 lines · David Ahern
The motivation for this event is to convert
perf_clock()time stamps to wall-clock (gettimeofday()) equivalents, including adjustments made by NTP (e.g., for comparing perf events to other log files).This patch is based on the monotonic patch by Arnaldo Carvalho de Melo <[email protected]>.
(NOTE: Comments from the last review of the timehist patch series suggested calling this a monotonic clock. I am not trying to be dense here; since gettimeofday maps to realtime clock I think that is the better name for it.)
Quoted 7 lines
Well, the idea was to use
CLOCK_MONOTONIC, not to callCLOCK_REALTIMEmonotonic.I'm really not sure why you want
CLOCK_REALTIMEand I thinkCLOCK_MONOTONICis more useful (I'd argue you want your system logs to contain both, every admin who's ever had to untangle what happened during DST switches will agree)
I believe CLOCK_MONOTONIC is what perf_clock is tied to -- the timestamps for PERF_SAMPLE_TIME -- so we already have that.
Programs that generate time-of-day output are using gettimeofday which is tied to CLOCK_REALTIME. We want to be able to correlate a perf sample to an entry in an applications log file.
David
Quoted 14 lines
Quoted 14 lines
kernel/perf_event.c +7
-0@@ -5610,6 +5612,13 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)perf_sample_data_init (&data,0 ); data.period = event->hw.last_period; +if (event->attr.sample_type &PERF_SAMPLE_RAW ) + { + raw.size =sizeof (u64); + raw.data = &event->count; + data.raw = &raw; + } + regs =get_irq_regs ();
Quoted 5 lines
kernel/perf_event.c static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer) · line 5624
Quoted 1 line
kernel/perf_event.c +0
-0if (regs && !perf_exclude_event (event, regs)) {Why!? you already keep ->count =
ktime_get_real(), so simply reading the count value will get you the timestamp.. this is superfluous at best.
And that is a conundrum I was stuck on for a while. perf record does not sample counters; it only creates sample events. I looked at having perf record sample the clock event, but then I would have to synthesize an event for the output file. Similarly perf record for hardware counters does not show the value of the counter.
David
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events
In reply to David AhernEm Fri, Feb 18, 2011 at 07:33:28AM -0700, David Ahern escreveu:
Quoted 16 lines · Peter Zijlstra
Quoted 11 lines · David Ahern
Quoted 7 lines
This check does not work out for 64-bit counter:
sizeof(u32) + sizeof(u64) = 4 + 8 = 12which does not pass the
WARN_ON_ONCEtest. I'm guessing (hoping really) that the intent is that the size of the raw data is a multiple of 4 bytes, not 8.No the data must come in 8bytes strides.
Then the sizeof the size field needs to be moved to u64; right now it is u32:
Quoted 6 lines
struct perf_raw_record { u32 size; void *data; };So size should be changed to u64 rather than modifying the
WARN_ON_ONCE?
Yeah, I guess so, 32-bit has to die it seems, gets in the way of testing :-)
- Arnaldo
Peter Zijlstra
maintainerRe: [PATCH 1/3] perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events
In reply to David AhernQuoted 11 lines · David Ahern
Quoted 9 lines · Peter Zijlstra
Quoted 7 lines · David Ahern
This check does not work out for 64-bit counter:
sizeof(u32) + sizeof(u64) = 4 + 8 = 12which does not pass the
WARN_ON_ONCEtest. I'm guessing (hoping really) that the intent is that the size of the raw data is a multiple of 4 bytes, not 8.
Quoted 5 lines
Quoted 2 lines
No the data must come in 8bytes strides.
Then the sizeof the size field needs to be moved to u64; right now it is u32:
That's a false conclusion.
Quoted 6 lines
struct perf_raw_record { u32 size; void *data; };So size should be changed to u64 rather than modifying the
WARN_ON_ONCE?
No.
Quoted 11 lines
Another gotcha is in
perf_output_samplethere is:struct { u32 size; u32 data; } raw = { .size = sizeof(u32), .data = 0, };While that meets the 8-byte stride I was concerned that changing the size field to u64 breaks ABI.
It would.
No, what you need to do is provide data that is sized such that it matches the 8b stride adding padding where needed.
Anyway, I don't think you need RAW at all.
Peter Zijlstra
maintainerRe: [PATCH 2/3] perf events: Introduce realtime clock event
In reply to David AhernQuoted 18 lines · David Ahern
Quoted 16 lines · Peter Zijlstra
Quoted 11 lines · David Ahern
The motivation for this event is to convert
perf_clock()time stamps to wall-clock (gettimeofday()) equivalents, including adjustments made by NTP (e.g., for comparing perf events to other log files).This patch is based on the monotonic patch by Arnaldo Carvalho de Melo <[email protected]>.
(NOTE: Comments from the last review of the timehist patch series suggested calling this a monotonic clock. I am not trying to be dense here; since gettimeofday maps to realtime clock I think that is the better name for it.)
Well, the idea was to use
CLOCK_MONOTONIC, not to callCLOCK_REALTIMEmonotonic.
Quoted 7 lines
Quoted 4 lines
I'm really not sure why you want
CLOCK_REALTIMEand I thinkCLOCK_MONOTONICis more useful (I'd argue you want your system logs to contain both, every admin who's ever had to untangle what happened during DST switches will agree)I believe
CLOCK_MONOTONICis whatperf_clockis tied to -- the timestamps forPERF_SAMPLE_TIME-- so we already have that.
Its not (it mere _can_ be), it could be tied to the TSC which can significantly drift wrt CLOCK_MONOTONIC.
Quoted 3 lines
Programs that generate time-of-day output are using gettimeofday which is tied to
CLOCK_REALTIME. We want to be able to correlate a perf sample to an entry in an applications log file.
Well, you can argue those programs are broken :-), Imagine the joys of trying to figure out wth happens when DST jumps the clock back an hour and you have an hour of duplicate data.
Quoted 19 lines
Quoted 13 lines
Quoted 13 lines
kernel/perf_event.c +7
-0@@ -5610,6 +5612,13 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)perf_sample_data_init (&data,0 ); data.period = event->hw.last_period; +if (event->attr.sample_type &PERF_SAMPLE_RAW ) + { + raw.size =sizeof (u64); + raw.data = &event->count; + data.raw = &raw; + } + regs =get_irq_regs ();Quoted 5 lines
kernel/perf_event.c static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer) · line 5624
Quoted 1 line
kernel/perf_event.c +0
-0if (regs && !perf_exclude_event (event, regs)) {Why!? you already keep ->count =
ktime_get_real(), so simply reading the count value will get you the timestamp.. this is superfluous at best.
Quoted 5 lines
And that is a conundrum I was stuck on for a while. perf record does not sample counters; it only creates sample events. I looked at having perf record sample the clock event, but then I would have to synthesize an event for the output file. Similarly perf record for hardware counters does not show the value of the counter.
Well, but you can fix that, simply add PERF_SAMPLE_READ, no need to abuse the raw crap.
Peter Zijlstra
maintainerRe: [PATCH 1/3] perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events
In reply to Arnaldo Carvalho de MeloQuoted 7 lines · Arnaldo Carvalho de Melo
Quoted 2 lines
So size should be changed to u64 rather than modifying the
WARN_ON_ONCE?Yeah, I guess so, 32-bit has to die it seems, gets in the way of testing
:-)
No!
1) don't use RAW unless you have to
2) you don't have to, goto 1
3) if you do anyway, ensure its properly padded
Re: [PATCH 1/3] perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events
In reply to Peter ZijlstraQuoted 9 lines · Peter Zijlstra
Quoted 9 lines
Another gotcha is in
perf_output_samplethere is:struct { u32 size; u32 data; } raw = { .size = sizeof(u32), .data = 0, };
Quoted 7 lines
Quoted 2 lines
While that meets the 8-byte stride I was concerned that changing the size field to u64 breaks ABI.
It would.
No, what you need to do is provide data that is sized such that it matches the 8b stride adding padding where needed.
I want to push a 64-bit counter to userspace. By definition it meets the 8-byte stride. Now how do I get sizeof(size field) + sizeof(data) to meet an 8-byte stride? I can't when sizeof(size field) = 4. Ok, I can pad the data with 4 bytes, but then I an api to tell the user to strip the 4-byte pad. Seems like an odd way to go.
Why is an 8-byte stride preferred over a 4-bytes?
David
Quoted 3 lines
Anyway, I don't think you need RAW at all.
Re: [PATCH 2/3] perf events: Introduce realtime clock event
In reply to Peter ZijlstraQuoted 3 lines · Peter Zijlstra
Well, but you can fix that, simply add
PERF_SAMPLE_READ, no need to abuse the raw crap.
Ok I see how this option works kernel side. It's not plumbed userspace side:
if (type & PERF_SAMPLE_READ) {
fprintf(stderr, "PERF_SAMPLE_READ is unsuported for now\n");
return -1;
}I'll take a look at that.
David
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] perf events: Introduce realtime clock event
In reply to Peter ZijlstraQuoted 10 lines · Peter Zijlstra
Quoted 7 lines
Quoted 4 lines
I'm really not sure why you want
CLOCK_REALTIMEand I thinkCLOCK_MONOTONICis more useful (I'd argue you want your system logs to contain both, every admin who's ever had to untangle what happened during DST switches will agree)I believe
CLOCK_MONOTONICis whatperf_clockis tied to -- the timestamps forPERF_SAMPLE_TIME-- so we already have that.Its not (it mere _can_ be), it could be tied to the TSC which can significantly drift wrt
CLOCK_MONOTONIC.
Ok, either way I would like correlation between perf_clock and the time sample data and gettimeofday.
Quoted 9 lines
Quoted 4 lines
Programs that generate time-of-day output are using gettimeofday which is tied to
CLOCK_REALTIME. We want to be able to correlate a perf sample to an entry in an applications log file.Well, you can argue those programs are broken :-), Imagine the joys of trying to figure out wth happens when DST jumps the clock back an hour and you have an hour of duplicate data.
Luckily DST only happens twice a year. Of course reboots happen a little more often and those reset the monotonic clock.
I can't change the known universe of programs that create pretty HH:MM:SS MM/DD/YY time strings. What I do want is to know why a program missed a heartbeat as noted by a log entry. Correlating with a perf event and seeing the backtrace is quite handy.
David
Peter Zijlstra
maintainerRe: [PATCH 1/3] perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events
In reply to David AhernQuoted 1 line · David Ahern
Why is an 8-byte stride preferred over a 4-bytes?
So as to avoid having to deal with unaligned u64 reads.
Re: [PATCH 1/3] perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events
In reply to Peter ZijlstraEm Fri, Feb 18, 2011 at 04:01:31PM +0100, Peter Zijlstra escreveu:
Quoted 8 lines · Arnaldo Carvalho de Melo
Quoted 6 lines
Quoted 1 line
So size should be changed to u64 rather than modifying the
WARN_ON_ONCE?Yeah, I guess so, 32-bit has to die it seems, gets in the way of testing
:-)
Quoted 5 lines
No!
1) don't use RAW unless you have to
2) you don't have to, goto 1
3) if you do anyway, ensure its properly padded
Ok, but using that struct definition on 32-bit land, will lead to non 8 byte alignment, right?
- Arnaldo
Peter Zijlstra
maintainerRe: [PATCH 1/3] perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events
Quoted 9 lines · Arnaldo Carvalho de Melo
Em Fri, Feb 18, 2011 at 04:01:31PM +0100, Peter Zijlstra escreveu:
Quoted 8 lines · Arnaldo Carvalho de Melo
Quoted 6 lines
Quoted 1 line
So size should be changed to u64 rather than modifying the
WARN_ON_ONCE?Yeah, I guess so, 32-bit has to die it seems, gets in the way of testing
:-)
Quoted 8 lines
Quoted 5 lines
No!
1) don't use RAW unless you have to
2) you don't have to, goto 1
3) if you do anyway, ensure its properly paddedOk, but using that struct definition on 32-bit land, will lead to non 8 byte alignment, right?
Nope, its just fine.. it defaults to an empty 4byte payload ;-)
Its just that any custom payload must be of size 4+8*n bytes.
Re: [PATCH 1/3] perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events
Quoted 16 lines · Peter Zijlstra
Quoted 15 lines · Arnaldo Carvalho de Melo
Em Fri, Feb 18, 2011 at 04:01:31PM +0100, Peter Zijlstra escreveu:
Quoted 13 lines · Arnaldo Carvalho de Melo
Quoted 6 lines
Quoted 1 line
So size should be changed to u64 rather than modifying the
WARN_ON_ONCE?Yeah, I guess so, 32-bit has to die it seems, gets in the way of testing
:-)No!
1) don't use RAW unless you have to
2) you don't have to, goto 1
3) if you do anyway, ensure its properly padded
Quoted 6 lines
Quoted 2 lines
Ok, but using that struct definition on 32-bit land, will lead to non 8 byte alignment, right?
Nope, its just fine.. it defaults to an empty 4byte payload ;-)
Its just that any custom payload must be of size 4+8*n bytes.
4 + 8*n != 8-byte aligned for any whole number n.
David
Re: [PATCH 1/3] perf events: fix WARN_ON_ONCE for 64-bit raw data, SW events
Quoted 3 lines · David Ahern
Quoted 1 line
Its just that any custom payload must be of size 4+8*n bytes.
4 + 8*n != 8-byte aligned for any whole number n.
nevermind. you are referring to the payload only; I was thinking full raw sample.
Quoted 6 lines
David
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to David AhernQuoted 74 lines · David Ahern
Quoted 16 lines · Ingo Molnar
tools/perf/Documentation/perf-report.txt OPTIONS · line 126
Quoted 5 lines · David Ahern
+--timehist::
tools/perf/Documentation/perf-report.txt +4
-0+ Generate time history output. This shows each sample with a wall-clock + timestamp and address to symbol conversions. The samples are output in + the same order they exist in the perf.data file. The --timehist option + must be used with the record to get wall-clock timestamps.Displaying samples this way is very useful, but how is this different from trace output - i.e. 'perf script' output?
There's a 'live logging mode' feature:
perf record ./myworkload | perf inject -v -b | perf script -i -
Quoted 7 lines
( There's also some work going on to have a separate 'perf trace' utility that will
output a linear trace of whatever events in perf.data are. )So unless i'm missing something it would be more useful to extend 'perf script' (or the upcoming 'perf trace') to list regular samples in a perf.data (i.e. not rely on -R raw trace data alone), and of course allow a straightforward utilization of real timestamps, when available.
To date I have not seen any option to show samples with wall-clock timestamps. In a sense it pretty-prints the -R format. This allows perf samples to be compared to other log files / sources of data to resolve an issue.
For example:
Time-of-Day Kernel Timestamp cpu Event Command PID
IP Symbol Name (DSO Name)
22:40:13.831567 858005051634 1 context-switches kworker/1:0 8ffffffff8103251eperf_event_task_sched_out([kernel.kallsyms])22:40:13.831683 858005168139 1 context-switches sshd 897
ffffffff8103251eperf_event_task_sched_out([kernel.kallsyms])With the stack callchain option it dumps a line for each address in the stack (columns abbreviated here for email):
07:24:37.527728 1 sshd 819
ffffffff8103251eperf_event_task_sched_out([kernel.kallsyms])07:24:37.527728 1 sshd 819 ffffffff81377231 schedule ([kernel.kallsyms]) 07:24:37.527728 1 sshd 819 ffffffff81377f3a
schedule_hrtimeout_range_clock([kernel.kallsyms]) 07:24:37.527728 1 sshd 819ffffffff81378016schedule_hrtimeout_range([kernel.kallsyms])
07:24:37.527728 1 sshd 819ffffffff81103e15poll_schedule_timeout([kernel.kallsyms])07:24:37.527728 1 sshd 819 ffffffff8110463c do_select ([kernel.kallsyms]) 07:24:37.527728 1 sshd 819 ffffffff811047f4 core_sys_select([kernel.kallsyms])
07:24:37.527728 1 sshd 819ffffffff81104929sys_select([kernel.kallsyms])
07:24:37.527728 1 sshd 819ffffffff81002bc2system_call([kernel.kallsyms])
07:24:37.527728 1 sshd 8197f56d4814e93__GI_select
(/lib64/libc-2.12.90.so)
07:24:37.527728 1 sshd 819 40560brun_builtin
(/tmp/build-perf/perf)
07:24:37.527728 1 sshd 819 40580dhandle_internal_command
(/tmp/build-perf/perf)
07:24:37.527728 1 sshd 819 405959run_argv
(/tmp/build-perf/perf)07:24:37.527728 1 sshd 819 405b63 main (/tmp/build-perf/perf) 07:24:37.527728 1 sshd 819 7fa49de9fe7d __libc_start_main(
/lib64/libc-2.12.90.so)
Quoted 6 lines
This format has allowed us to do an in-depth analysis of scheduling (record -e cs -c 1): we can see when was process running, for how long it ran, why it was kicked off the processor, how long was it off the processor, what ran in between schedulings, etc. If a log file shows a process missing a heartbeat you can look at the perf data in the time range and see if it had a chance to run. If not where was it blocked.
Oh, in this case I strongly suggest you to use the tracepoint events.
Look at the output of "perf list" and seek the events which name start with "sched:"
sched:sched_kthread_stop [Tracepoint event] sched:sched_kthread_stop_ret [Tracepoint event] sched:sched_wait_task [Tracepoint event] sched:sched_wakeup [Tracepoint event] sched:sched_wakeup_new [Tracepoint event] sched:sched_switch [Tracepoint event] sched:sched_migrate_task [Tracepoint event] sched:sched_process_free [Tracepoint event] sched:sched_process_exit [Tracepoint event] sched:sched_process_wait [Tracepoint event] sched:sched_process_fork [Tracepoint event] sched:sched_stat_wait [Tracepoint event] sched:sched_stat_sleep [Tracepoint event] sched:sched_stat_iowait [Tracepoint event] sched:sched_stat_runtime [Tracepoint event]
You have the sched:sched_switch event and many others.
Just try:
perf record -a -e sched:*
perf script
perf-4128 [000] 19242.870025: sched_stat_runtime: comm=perf pid=4128 runtime=7430405 [ns] vruntime=3530192223488
perf-4128 [000] 19242.870042: sched_stat_runtime: comm=perf pid=4128 runtime=23142 [ns] vruntime=3530192246630 [n
perf-4128 [000] 19242.870045: sched_stat_sleep: comm=kondemand/0 pid=59 delay=9979163 [ns]
perf-4128 [000] 19242.870048: sched_wakeup: comm=kondemand/0 pid=59 prio=120 success=1 target_cpu=000
perf-4128 [000] 19242.870063: sched_stat_runtime: comm=perf pid=4128 runtime=21581 [ns] vruntime=3530192268211 [n
perf-4128 [000] 19242.870066: sched_stat_wait: comm=kondemand/0 pid=59 delay=21581 [ns]
perf-4128 [000] 19242.870069: sched_switch: prev_comm=perf prev_pid=4128 prev_prio=120 prev_state=R ==> next_comm
kondemand/0-59 [000] 19242.870091: sched_stat_runtime: comm=kondemand/0 pid=59 runtime=27362 [ns] vruntime=35301862739
kondemand/0-59 [000] 19242.870094: sched_stat_wait: comm=perf pid=4128 delay=27362 [ns]
kondemand/0-59 [000] 19242.870095: sched_switch: prev_comm=kondemand/0 prev_pid=59 prev_prio=120 prev_state=S ==> nextAnd you can run your own script on these events:
$ sudo ./perf script -g python generated Python script: perf-script.py
Edit perf-script.py and then run it:
$ perf script -s ./perf-script.py
That also works for perl.
The timestamps will be the cpu time and not the walltime, but at least that seems to be partly what you seek?
Re: [PATCH 3/3] perf events: add timehist option to record and report
Quoted 127 lines · Frederic Weisbecker
Quoted 74 lines · David Ahern
Quoted 16 lines · Ingo Molnar
tools/perf/Documentation/perf-report.txt OPTIONS · line 126
Quoted 5 lines · David Ahern
+--timehist::
tools/perf/Documentation/perf-report.txt +4
-0+ Generate time history output. This shows each sample with a wall-clock + timestamp and address to symbol conversions. The samples are output in + the same order they exist in the perf.data file. The --timehist option + must be used with the record to get wall-clock timestamps.Displaying samples this way is very useful, but how is this different from trace output - i.e. 'perf script' output?
There's a 'live logging mode' feature:
perf record ./myworkload | perf inject -v -b | perf script -i -
Quoted 7 lines
( There's also some work going on to have a separate 'perf trace' utility that will
output a linear trace of whatever events in perf.data are. )So unless i'm missing something it would be more useful to extend 'perf script' (or the upcoming 'perf trace') to list regular samples in a perf.data (i.e. not rely on -R raw trace data alone), and of course allow a straightforward utilization of real timestamps, when available.
To date I have not seen any option to show samples with wall-clock timestamps. In a sense it pretty-prints the -R format. This allows perf samples to be compared to other log files / sources of data to resolve an issue.
For example:
Time-of-Day Kernel Timestamp cpu Event Command PID
IP Symbol Name (DSO Name)
22:40:13.831567 858005051634 1 context-switches kworker/1:0 8ffffffff8103251eperf_event_task_sched_out([kernel.kallsyms])22:40:13.831683 858005168139 1 context-switches sshd 897
ffffffff8103251eperf_event_task_sched_out([kernel.kallsyms])With the stack callchain option it dumps a line for each address in the stack (columns abbreviated here for email):
07:24:37.527728 1 sshd 819
ffffffff8103251eperf_event_task_sched_out([kernel.kallsyms])07:24:37.527728 1 sshd 819 ffffffff81377231 schedule ([kernel.kallsyms]) 07:24:37.527728 1 sshd 819 ffffffff81377f3a
schedule_hrtimeout_range_clock([kernel.kallsyms]) 07:24:37.527728 1 sshd 819ffffffff81378016schedule_hrtimeout_range([kernel.kallsyms])
07:24:37.527728 1 sshd 819ffffffff81103e15poll_schedule_timeout([kernel.kallsyms])07:24:37.527728 1 sshd 819 ffffffff8110463c do_select ([kernel.kallsyms]) 07:24:37.527728 1 sshd 819 ffffffff811047f4 core_sys_select([kernel.kallsyms])
07:24:37.527728 1 sshd 819ffffffff81104929sys_select([kernel.kallsyms])
07:24:37.527728 1 sshd 819ffffffff81002bc2system_call([kernel.kallsyms])
07:24:37.527728 1 sshd 8197f56d4814e93__GI_select
(/lib64/libc-2.12.90.so)
07:24:37.527728 1 sshd 819 40560brun_builtin
(/tmp/build-perf/perf)
07:24:37.527728 1 sshd 819 40580dhandle_internal_command
(/tmp/build-perf/perf)
07:24:37.527728 1 sshd 819 405959run_argv
(/tmp/build-perf/perf)07:24:37.527728 1 sshd 819 405b63 main (/tmp/build-perf/perf) 07:24:37.527728 1 sshd 819 7fa49de9fe7d __libc_start_main(
/lib64/libc-2.12.90.so)Quoted 6 lines
This format has allowed us to do an in-depth analysis of scheduling (record -e cs -c 1): we can see when was process running, for how long it ran, why it was kicked off the processor, how long was it off the processor, what ran in between schedulings, etc. If a log file shows a process missing a heartbeat you can look at the perf data in the time range and see if it had a chance to run. If not where was it blocked.
Oh, in this case I strongly suggest you to use the tracepoint events.
Look at the output of "perf list" and seek the events which name start with "sched:"
sched:sched_kthread_stop [Tracepoint event] sched:sched_kthread_stop_ret [Tracepoint event] sched:sched_wait_task [Tracepoint event] sched:sched_wakeup [Tracepoint event] sched:sched_wakeup_new [Tracepoint event] sched:sched_switch [Tracepoint event] sched:sched_migrate_task [Tracepoint event] sched:sched_process_free [Tracepoint event] sched:sched_process_exit [Tracepoint event] sched:sched_process_wait [Tracepoint event] sched:sched_process_fork [Tracepoint event] sched:sched_stat_wait [Tracepoint event] sched:sched_stat_sleep [Tracepoint event] sched:sched_stat_iowait [Tracepoint event] sched:sched_stat_runtime [Tracepoint event]You have the sched:sched_switch event and many others.
Just try:
perf record -a -e sched:*
perf scriptperf-4128 [000] 19242.870025: sched_stat_runtime: comm=perf pid=4128 runtime=7430405 [ns] vruntime=3530192223488 perf-4128 [000] 19242.870042: sched_stat_runtime: comm=perf pid=4128 runtime=23142 [ns] vruntime=3530192246630 [n perf-4128 [000] 19242.870045: sched_stat_sleep: comm=kondemand/0 pid=59 delay=9979163 [ns] perf-4128 [000] 19242.870048: sched_wakeup: comm=kondemand/0 pid=59 prio=120 success=1 target_cpu=000 perf-4128 [000] 19242.870063: sched_stat_runtime: comm=perf pid=4128 runtime=21581 [ns] vruntime=3530192268211 [n perf-4128 [000] 19242.870066: sched_stat_wait: comm=kondemand/0 pid=59 delay=21581 [ns] perf-4128 [000] 19242.870069: sched_switch: prev_comm=perf prev_pid=4128 prev_prio=120 prev_state=R ==> next_comm kondemand/0-59 [000] 19242.870091: sched_stat_runtime: comm=kondemand/0 pid=59 runtime=27362 [ns] vruntime=35301862739 kondemand/0-59 [000] 19242.870094: sched_stat_wait: comm=perf pid=4128 delay=27362 [ns] kondemand/0-59 [000] 19242.870095: sched_switch: prev_comm=kondemand/0 prev_pid=59 prev_prio=120 prev_state=S ==> nextAnd you can run your own script on these events:
$ sudo ./perf script -g python generated Python script: perf-script.py
Quoted 8 lines
Edit
perf-script.pyand then run it:$ perf script -s ./perf-script.pyThat also works for perl.
The timestamps will be the cpu time and not the walltime, but at least that seems to be partly what you seek?
Yes, I have looked at that output before -- essentially ftrace output.
We want not only context-switch events, but the stack trace at the switch. For example, with the stack trace you can see preemption -- when a process got booted by another and where the booted process is at the time. You can see not only which system call caused an ap to block (e.g., an ioctl) but the full code path leading to the block.
That data along with the gettimeofday timestamp has allowed us to resolve performance issues such as a system call taking longer than expected during a specific sequence of events or a process getting preempted and not scheduled for N seconds. etc., etc.
David
Peter Zijlstra
maintainerRe: [PATCH 3/3] perf events: add timehist option to record and report
Quoted 2 lines · David Ahern
We want not only context-switch events, but the stack trace at the switch.
Both ftrace and perf can do that:
perf record -ge sched:sched_switch -c 1
or
echo 1 > /debug/tracing/options/stacktrace
Quoted 4 lines
That data along with the gettimeofday timestamp has allowed us to resolve performance issues such as a system call taking longer than expected during a specific sequence of events or a process getting preempted and not scheduled for N seconds. etc., etc.
Non of that seems to require GTOD stamps.
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to Frederic WeisbeckerEm Fri, Feb 18, 2011 at 06:59:30PM +0100, Frederic Weisbecker escreveu:
Quoted 32 lines
sched:sched_wait_task [Tracepoint event] sched:sched_wakeup [Tracepoint event] sched:sched_wakeup_new [Tracepoint event] sched:sched_switch [Tracepoint event] sched:sched_migrate_task [Tracepoint event] sched:sched_process_free [Tracepoint event] sched:sched_process_exit [Tracepoint event]You have the sched:sched_switch event and many others.
Just try:
perf record -a -e sched:*
perf scriptperf-4128 [000] 19242.870025: sched_stat_runtime: comm=perf pid=4128 runtime=7430405 [ns] vruntime=3530192223488 perf-4128 [000] 19242.870042: sched_stat_runtime: comm=perf pid=4128 runtime=23142 [ns] vruntime=3530192246630 [n perf-4128 [000] 19242.870045: sched_stat_sleep: comm=kondemand/0 pid=59 delay=9979163 [ns] perf-4128 [000] 19242.870048: sched_wakeup: comm=kondemand/0 pid=59 prio=120 success=1 target_cpu=000 perf-4128 [000] 19242.870063: sched_stat_runtime: comm=perf pid=4128 runtime=21581 [ns] vruntime=3530192268211 [n perf-4128 [000] 19242.870066: sched_stat_wait: comm=kondemand/0 pid=59 delay=21581 [ns] perf-4128 [000] 19242.870069: sched_switch: prev_comm=perf prev_pid=4128 prev_prio=120 prev_state=R ==> next_comm kondemand/0-59 [000] 19242.870091: sched_stat_runtime: comm=kondemand/0 pid=59 runtime=27362 [ns] vruntime=35301862739 kondemand/0-59 [000] 19242.870094: sched_stat_wait: comm=perf pid=4128 delay=27362 [ns] kondemand/0-59 [000] 19242.870095: sched_switch: prev_comm=kondemand/0 prev_pid=59 prev_prio=120 prev_state=S ==> nextAnd you can run your own script on these events:
$ sudo ./perf script -g python generated Python script: perf-script.py
Quoted 8 lines
Edit
perf-script.pyand then run it:$ perf script -s ./perf-script.pyThat also works for perl.
The timestamps will be the cpu time and not the walltime, but at least that seems to be partly what you seek?
The whole issue for him, AFAIK, is to correlate perf events with app events.
Think about tcpdump + networking tracepoints or 'perf probe' dynamic events in the network stack, he wants to merge those logs and correlate the tcpdump packet exchange with the tracepoints events in the network stack, etc.
I.e. it doesn't matter if it is ftrace or not, having a common clock shared between apps and kernel tracing/whatever infrastructure is what David is after, right?
He can change userspace to use the clock the kernel is using in the perf/ftrace/whatever infrastructure or make the kernel use the clock userspace uses.
The issue here is who will bend, u or k ;-)
- Arnaldo
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to Peter ZijlstraQuoted 7 lines · Peter Zijlstra
Quoted 2 lines · David Ahern
We want not only context-switch events, but the stack trace at the switch.
Both ftrace and perf can do that:
perf record -ge sched:sched_switch -c 1
Yes, exactly. And that is what I am using -- well, -e cs -c 1.
Quoted 6 lines
or
echo 1 > /debug/tracing/options/stacktrace
Quoted 6 lines
Quoted 4 lines
That data along with the gettimeofday timestamp has allowed us to resolve performance issues such as a system call taking longer than expected during a specific sequence of events or a process getting preempted and not scheduled for N seconds. etc., etc.
Non of that seems to require GTOD stamps.
On 01/23/11 at 03:45:67 a syslog event noted an application restart. Checking the applications logs it went silent. Why? What does perf say?
Oh, 2 days have gone by before said event is reported to engineering, and the server was been rebooted to 'clear' the problem - hence resetting monotonic clock.
Multiply that by 100's of processes.
David
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to Arnaldo Carvalho de MeloQuoted 45 lines · Arnaldo Carvalho de Melo
Em Fri, Feb 18, 2011 at 06:59:30PM +0100, Frederic Weisbecker escreveu:
Quoted 32 lines
sched:sched_wait_task [Tracepoint event] sched:sched_wakeup [Tracepoint event] sched:sched_wakeup_new [Tracepoint event] sched:sched_switch [Tracepoint event] sched:sched_migrate_task [Tracepoint event] sched:sched_process_free [Tracepoint event] sched:sched_process_exit [Tracepoint event]You have the sched:sched_switch event and many others.
Just try:
perf record -a -e sched:*
perf scriptperf-4128 [000] 19242.870025: sched_stat_runtime: comm=perf pid=4128 runtime=7430405 [ns] vruntime=3530192223488 perf-4128 [000] 19242.870042: sched_stat_runtime: comm=perf pid=4128 runtime=23142 [ns] vruntime=3530192246630 [n perf-4128 [000] 19242.870045: sched_stat_sleep: comm=kondemand/0 pid=59 delay=9979163 [ns] perf-4128 [000] 19242.870048: sched_wakeup: comm=kondemand/0 pid=59 prio=120 success=1 target_cpu=000 perf-4128 [000] 19242.870063: sched_stat_runtime: comm=perf pid=4128 runtime=21581 [ns] vruntime=3530192268211 [n perf-4128 [000] 19242.870066: sched_stat_wait: comm=kondemand/0 pid=59 delay=21581 [ns] perf-4128 [000] 19242.870069: sched_switch: prev_comm=perf prev_pid=4128 prev_prio=120 prev_state=R ==> next_comm kondemand/0-59 [000] 19242.870091: sched_stat_runtime: comm=kondemand/0 pid=59 runtime=27362 [ns] vruntime=35301862739 kondemand/0-59 [000] 19242.870094: sched_stat_wait: comm=perf pid=4128 delay=27362 [ns] kondemand/0-59 [000] 19242.870095: sched_switch: prev_comm=kondemand/0 prev_pid=59 prev_prio=120 prev_state=S ==> nextAnd you can run your own script on these events:
$ sudo ./perf script -g python generated Python script: perf-script.pyQuoted 8 lines
Edit
perf-script.pyand then run it:$ perf script -s ./perf-script.pyThat also works for perl.
The timestamps will be the cpu time and not the walltime, but at least that seems to be partly what you seek?
The whole issue for him, AFAIK, is to correlate perf events with app events.
Quoted 8 lines
Think about tcpdump + networking tracepoints or 'perf probe' dynamic events in the network stack, he wants to merge those logs and correlate the tcpdump packet exchange with the tracepoints events in the network stack, etc.
I.e. it doesn't matter if it is ftrace or not, having a common clock shared between apps and kernel tracing/whatever infrastructure is what David is after, right?
A means of correlating the two, yes.
Quoted 6 lines
He can change userspace to use the clock the kernel is using in the perf/ftrace/whatever infrastructure or make the kernel use the clock userspace uses.
The issue here is who will bend, u or k ;-)
It makes sense for ftrace, perf, etc to use a monotonic clock. That timestamp is nonsense to users (just a string of numbers) and application writers like those pretty little strings that relate to time has humans acknowledge it.
David
Quoted 2 lines
- Arnaldo
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to Arnaldo Carvalho de MeloQuoted 5 lines · Arnaldo Carvalho de Melo
Think about tcpdump + networking tracepoints or 'perf probe' dynamic events in the network stack, he wants to merge those logs and correlate the tcpdump packet exchange with the tracepoints events in the network stack, etc.
I'm zoned in on ap logs, but tcpdump and network analysis is another very good example. packets are tagged with realtime:
static inline void __net_timestamp(struct sk_buff *skb)
{
skb->tstamp = ktime_get_real();
}David
Re: [PATCH 3/3] perf events: add timehist option to record and report
Em Fri, Feb 18, 2011 at 11:53:16AM -0700, David Ahern escreveu:
Quoted 6 lines · Arnaldo Carvalho de Melo
Quoted 4 lines
Think about tcpdump + networking tracepoints or 'perf probe' dynamic events in the network stack, he wants to merge those logs and correlate the tcpdump packet exchange with the tracepoints events in the network stack, etc.
Quoted 7 lines
I'm zoned in on ap logs, but tcpdump and network analysis is another very good example. packets are tagged with realtime:
static inline void
__net_timestamp(struct sk_buff *skb){ skb->tstamp = ktime_get_real(); }
I'd bet the original intent was to merge that with app specific logs :-)
Anyway, I think the way out of this is to have a clock_gettime like interface, let the users decide what they need (or think they do), sample it together with the other events and be done with it.
- Arnaldo
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to David AhernQuoted 139 lines · David Ahern
Quoted 127 lines · Frederic Weisbecker
Quoted 74 lines · David Ahern
Quoted 16 lines · Ingo Molnar
tools/perf/Documentation/perf-report.txt OPTIONS · line 126
Quoted 5 lines · David Ahern
+--timehist::
tools/perf/Documentation/perf-report.txt +4
-0+ Generate time history output. This shows each sample with a wall-clock + timestamp and address to symbol conversions. The samples are output in + the same order they exist in the perf.data file. The --timehist option + must be used with the record to get wall-clock timestamps.Displaying samples this way is very useful, but how is this different from trace output - i.e. 'perf script' output?
There's a 'live logging mode' feature:
perf record ./myworkload | perf inject -v -b | perf script -i -
Quoted 7 lines
( There's also some work going on to have a separate 'perf trace' utility that will
output a linear trace of whatever events in perf.data are. )So unless i'm missing something it would be more useful to extend 'perf script' (or the upcoming 'perf trace') to list regular samples in a perf.data (i.e. not rely on -R raw trace data alone), and of course allow a straightforward utilization of real timestamps, when available.
To date I have not seen any option to show samples with wall-clock timestamps. In a sense it pretty-prints the -R format. This allows perf samples to be compared to other log files / sources of data to resolve an issue.
For example:
Time-of-Day Kernel Timestamp cpu Event Command PID
IP Symbol Name (DSO Name)
22:40:13.831567 858005051634 1 context-switches kworker/1:0 8ffffffff8103251eperf_event_task_sched_out([kernel.kallsyms])22:40:13.831683 858005168139 1 context-switches sshd 897
ffffffff8103251eperf_event_task_sched_out([kernel.kallsyms])With the stack callchain option it dumps a line for each address in the stack (columns abbreviated here for email):
07:24:37.527728 1 sshd 819
ffffffff8103251eperf_event_task_sched_out([kernel.kallsyms])07:24:37.527728 1 sshd 819 ffffffff81377231 schedule ([kernel.kallsyms]) 07:24:37.527728 1 sshd 819 ffffffff81377f3a
schedule_hrtimeout_range_clock([kernel.kallsyms]) 07:24:37.527728 1 sshd 819ffffffff81378016schedule_hrtimeout_range([kernel.kallsyms])
07:24:37.527728 1 sshd 819ffffffff81103e15poll_schedule_timeout([kernel.kallsyms])07:24:37.527728 1 sshd 819 ffffffff8110463c do_select ([kernel.kallsyms]) 07:24:37.527728 1 sshd 819 ffffffff811047f4 core_sys_select([kernel.kallsyms])
07:24:37.527728 1 sshd 819ffffffff81104929sys_select([kernel.kallsyms])
07:24:37.527728 1 sshd 819ffffffff81002bc2system_call([kernel.kallsyms])
07:24:37.527728 1 sshd 8197f56d4814e93__GI_select
(/lib64/libc-2.12.90.so)
07:24:37.527728 1 sshd 819 40560brun_builtin
(/tmp/build-perf/perf)
07:24:37.527728 1 sshd 819 40580dhandle_internal_command
(/tmp/build-perf/perf)
07:24:37.527728 1 sshd 819 405959run_argv
(/tmp/build-perf/perf)07:24:37.527728 1 sshd 819 405b63 main (/tmp/build-perf/perf) 07:24:37.527728 1 sshd 819 7fa49de9fe7d __libc_start_main(
/lib64/libc-2.12.90.so)Quoted 6 lines
This format has allowed us to do an in-depth analysis of scheduling (record -e cs -c 1): we can see when was process running, for how long it ran, why it was kicked off the processor, how long was it off the processor, what ran in between schedulings, etc. If a log file shows a process missing a heartbeat you can look at the perf data in the time range and see if it had a chance to run. If not where was it blocked.
Oh, in this case I strongly suggest you to use the tracepoint events.
Look at the output of "perf list" and seek the events which name start with "sched:"
sched:sched_kthread_stop [Tracepoint event] sched:sched_kthread_stop_ret [Tracepoint event] sched:sched_wait_task [Tracepoint event] sched:sched_wakeup [Tracepoint event] sched:sched_wakeup_new [Tracepoint event] sched:sched_switch [Tracepoint event] sched:sched_migrate_task [Tracepoint event] sched:sched_process_free [Tracepoint event] sched:sched_process_exit [Tracepoint event] sched:sched_process_wait [Tracepoint event] sched:sched_process_fork [Tracepoint event] sched:sched_stat_wait [Tracepoint event] sched:sched_stat_sleep [Tracepoint event] sched:sched_stat_iowait [Tracepoint event] sched:sched_stat_runtime [Tracepoint event]You have the sched:sched_switch event and many others.
Just try:
perf record -a -e sched:*
perf scriptperf-4128 [000] 19242.870025: sched_stat_runtime: comm=perf pid=4128 runtime=7430405 [ns] vruntime=3530192223488 perf-4128 [000] 19242.870042: sched_stat_runtime: comm=perf pid=4128 runtime=23142 [ns] vruntime=3530192246630 [n perf-4128 [000] 19242.870045: sched_stat_sleep: comm=kondemand/0 pid=59 delay=9979163 [ns] perf-4128 [000] 19242.870048: sched_wakeup: comm=kondemand/0 pid=59 prio=120 success=1 target_cpu=000 perf-4128 [000] 19242.870063: sched_stat_runtime: comm=perf pid=4128 runtime=21581 [ns] vruntime=3530192268211 [n perf-4128 [000] 19242.870066: sched_stat_wait: comm=kondemand/0 pid=59 delay=21581 [ns] perf-4128 [000] 19242.870069: sched_switch: prev_comm=perf prev_pid=4128 prev_prio=120 prev_state=R ==> next_comm kondemand/0-59 [000] 19242.870091: sched_stat_runtime: comm=kondemand/0 pid=59 runtime=27362 [ns] vruntime=35301862739 kondemand/0-59 [000] 19242.870094: sched_stat_wait: comm=perf pid=4128 delay=27362 [ns] kondemand/0-59 [000] 19242.870095: sched_switch: prev_comm=kondemand/0 prev_pid=59 prev_prio=120 prev_state=S ==> nextAnd you can run your own script on these events:
$ sudo ./perf script -g python generated Python script: perf-script.pyQuoted 8 lines
Edit
perf-script.pyand then run it:$ perf script -s ./perf-script.pyThat also works for perl.
The timestamps will be the cpu time and not the walltime, but at least that seems to be partly what you seek?
Quoted 7 lines
Yes, I have looked at that output before -- essentially ftrace output.
We want not only context-switch events, but the stack trace at the switch. For example, with the stack trace you can see preemption -- when a process got booted by another and where the booted process is at the time. You can see not only which system call caused an ap to block (e.g., an ioctl) but the full code path leading to the block.
You can recognize preemption a the context switch tracepoint: if the state of the scheduled out task is R (TASK_RUNNING), which means it doesn't go to sleep but gets preempted, with an explicit preemption point like cond_resched(), or a more implicit one: spin_unlock(), preempt_enable(), an interrupt, ... Or it has been woken up while it was about to sleep, but it doesn't make much difference.
If you want to know when a process is booted by another you can use the fork tracepoint, or sched:wake_up_new, etc...
And you can use syscall tracepoints to get the syscalls you want.
I don't see much the point for you to use stacktraces. But if you do, then rather add this support to perf script, in our scripting framework.
Because what you've done is basically to add tracing support to perf report. But we have perf script for that already. It only focuses on tracepoint events but they are those people are interested in because they show logical events in the kernel. I guess people are not interested in cpu-cycles overflows events or so as they don't show a state change in the kernel.
Well, yeah I can understand if one considers the software events, that makes meaningful events from the kernel. But these software events support have been a mistake in perf. You should rather use the tracepoint events instead.
Quoted 4 lines
That data along with the gettimeofday timestamp has allowed us to resolve performance issues such as a system call taking longer than expected during a specific sequence of events or a process getting preempted and not scheduled for N seconds. etc., etc.
That's about the same here. If you really need this, you need to add the support in perf script to handle that on tracepoint events.
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to Arnaldo Carvalho de MeloQuoted 54 lines · Arnaldo Carvalho de Melo
Em Fri, Feb 18, 2011 at 06:59:30PM +0100, Frederic Weisbecker escreveu:
Quoted 32 lines
sched:sched_wait_task [Tracepoint event] sched:sched_wakeup [Tracepoint event] sched:sched_wakeup_new [Tracepoint event] sched:sched_switch [Tracepoint event] sched:sched_migrate_task [Tracepoint event] sched:sched_process_free [Tracepoint event] sched:sched_process_exit [Tracepoint event]You have the sched:sched_switch event and many others.
Just try:
perf record -a -e sched:*
perf scriptperf-4128 [000] 19242.870025: sched_stat_runtime: comm=perf pid=4128 runtime=7430405 [ns] vruntime=3530192223488 perf-4128 [000] 19242.870042: sched_stat_runtime: comm=perf pid=4128 runtime=23142 [ns] vruntime=3530192246630 [n perf-4128 [000] 19242.870045: sched_stat_sleep: comm=kondemand/0 pid=59 delay=9979163 [ns] perf-4128 [000] 19242.870048: sched_wakeup: comm=kondemand/0 pid=59 prio=120 success=1 target_cpu=000 perf-4128 [000] 19242.870063: sched_stat_runtime: comm=perf pid=4128 runtime=21581 [ns] vruntime=3530192268211 [n perf-4128 [000] 19242.870066: sched_stat_wait: comm=kondemand/0 pid=59 delay=21581 [ns] perf-4128 [000] 19242.870069: sched_switch: prev_comm=perf prev_pid=4128 prev_prio=120 prev_state=R ==> next_comm kondemand/0-59 [000] 19242.870091: sched_stat_runtime: comm=kondemand/0 pid=59 runtime=27362 [ns] vruntime=35301862739 kondemand/0-59 [000] 19242.870094: sched_stat_wait: comm=perf pid=4128 delay=27362 [ns] kondemand/0-59 [000] 19242.870095: sched_switch: prev_comm=kondemand/0 prev_pid=59 prev_prio=120 prev_state=S ==> nextAnd you can run your own script on these events:
$ sudo ./perf script -g python generated Python script: perf-script.pyQuoted 8 lines
Edit
perf-script.pyand then run it:$ perf script -s ./perf-script.pyThat also works for perl.
The timestamps will be the cpu time and not the walltime, but at least that seems to be partly what you seek?
The whole issue for him, AFAIK, is to correlate perf events with app events.
Think about tcpdump + networking tracepoints or 'perf probe' dynamic events in the network stack, he wants to merge those logs and correlate the tcpdump packet exchange with the tracepoints events in the network stack, etc.
I.e. it doesn't matter if it is ftrace or not, having a common clock shared between apps and kernel tracing/whatever infrastructure is what David is after, right?
Quoted 5 lines
He can change userspace to use the clock the kernel is using in the perf/ftrace/whatever infrastructure or make the kernel use the clock userspace uses.
The issue here is who will bend, u or k ;-)
Right. I don't disagree with the need of a walltime. That already in debate :)
I was rather arguing about the tracing part. Adding support in perf report in the wrong way to do this. If something must be extended, It should be done in perf script, where we do the tracing support.
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to Frederic WeisbeckerQuoted 13 lines · Frederic Weisbecker
Quoted 5 lines
We want not only context-switch events, but the stack trace at the switch. For example, with the stack trace you can see preemption -- when a process got booted by another and where the booted process is at the time. You can see not only which system call caused an ap to block (e.g., an ioctl) but the full code path leading to the block.
You can recognize preemption a the context switch tracepoint: if the state of the scheduled out task is R (
TASK_RUNNING), which means it doesn't go to sleep but gets preempted, with an explicit preemption point likecond_resched(), or a more implicit one:spin_unlock(),preempt_enable(), an interrupt, ... Or it has been woken up while it was about to sleep, but it doesn't make much difference.
Quoted 8 lines
If you want to know when a process is booted by another you can use the fork tracepoint, or sched:wake_up_new, etc...
And you can use syscall tracepoints to get the syscalls you want.
I don't see much the point for you to use stacktraces. But if you do, then rather add this support to perf script, in our scripting framework.
It's more the simplicity of what we are using today. 1 command, 1 event being monitored:
perf record -ag -e cs -c 1
A wealth of information. That command shows preemption, stack traces only for context-switches (not all of the syscalls which is overwhelming) and opens the door for other analysis. One data set. Simple. Focused.
Quoted 7 lines
Because what you've done is basically to add tracing support to perf report. But we have perf script for that already. It only focuses on tracepoint events but they are those people are interested in because they show logical events in the kernel. I guess people are not interested in cpu-cycles overflows events or so as they don't show a state change in the kernel.
I have always referred to this as pretty printing each sample recorded as opposed to summarizing into a histogram. With that approach you have dictated the analysis of the data - a histogram summary. By printing each sample with address-symbol conversions we can look at it in whatever angle we need to make sense of it.
David
Quoted 17 lines
Well, yeah I can understand if one considers the software events, that makes meaningful events from the kernel. But these software events support have been a mistake in perf. You should rather use the tracepoint events instead.
Quoted 4 lines
That data along with the gettimeofday timestamp has allowed us to resolve performance issues such as a system call taking longer than expected during a specific sequence of events or a process getting preempted and not scheduled for N seconds. etc., etc.
That's about the same here. If you really need this, you need to add the support in perf script to handle that on tracepoint events. --
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to Frederic WeisbeckerEm Fri, Feb 18, 2011 at 08:29:56PM +0100, Frederic Weisbecker escreveu:
Quoted 21 lines · Arnaldo Carvalho de Melo
Quoted 20 lines
Em Fri, Feb 18, 2011 at 06:59:30PM +0100, Frederic Weisbecker escreveu:
Quoted 2 lines
The timestamps will be the cpu time and not the walltime, but at least that seems to be partly what you seek?
The whole issue for him, AFAIK, is to correlate perf events with app events.
Think about tcpdump + networking tracepoints or 'perf probe' dynamic events in the network stack, he wants to merge those logs and correlate the tcpdump packet exchange with the tracepoints events in the network stack, etc.
I.e. it doesn't matter if it is ftrace or not, having a common clock shared between apps and kernel tracing/whatever infrastructure is what David is after, right?
He can change userspace to use the clock the kernel is using in the perf/ftrace/whatever infrastructure or make the kernel use the clock userspace uses.
Quoted 8 lines
Quoted 1 line
The issue here is who will bend, u or k ;-)
Right. I don't disagree with the need of a walltime. That already in debate :)
I was rather arguing about the tracing part. Adding support in perf report in the wrong way to do this. If something must be extended, It should be done in perf script, where we do the tracing support.
Squashing "profiling" and "tracing" differences is something I think worthy.
Its all about events, that should be treated as equal in all tools. So I don't think 'perf script' is about tracing, its about handling events found in the event stream, be it hw, sw, tracepoints, dynamic probes put in place by 'perf probe', or whatever event source we end up having.
A 'clock_gettime' like event, sampling whatever POSIX clock the kernel supports should be enough flexibility, leaving concerns about sanity of any particular use to the rope user.
Of course, extensibility via 'perf script' or 'use perf' in perf scripts should provide great avenues for experimentation, not requiring changes in the builtins :-)
- Arnaldo
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to David AhernQuoted 6 lines · David Ahern
On 01/23/11 at 03:45:67 a syslog event noted an application restart. Checking the applications logs it went silent. Why? What does perf say?
Oh, 2 days have gone by before said event is reported to engineering, and the server was been rebooted to 'clear' the problem - hence resetting monotonic clock.
I think that's a valid usecase and the feature you are suggestion is very useful.
Why not extend the regular trace output to also (optionally) output GTOD timestamps?
Thanks,
Ingo
Re: [PATCH 3/3] perf events: add timehist option to record and report
Em Sat, Feb 19, 2011 at 10:32:16AM +0100, Ingo Molnar escreveu:
Quoted 5 lines · David Ahern
Quoted 4 lines
On 01/23/11 at 03:45:67 a syslog event noted an application restart. Checking the applications logs it went silent. Why? What does perf say?
Quoted 7 lines
Quoted 3 lines
Oh, 2 days have gone by before said event is reported to engineering, and the server was been rebooted to 'clear' the problem - hence resetting monotonic clock.
I think that's a valid usecase and the feature you are suggestion is very useful.
Why not extend the regular trace output to also (optionally) output GTOD timestamps?
That is how this this feature request/submission originally started.
David tried with an extra header, then a synthesized event, then after some discussion with Peter I started working on a monotonic clock event, but got sidetracked with other stuff, he tried picking up from where I left and here we are.
I think the summary is: we need a clock_gettime like interface so that users can pick and choose what clock matches best whatever app they're trying to merge logs.
- Arnaldo
Re: [PATCH 2/3] perf events: Introduce realtime clock event
In reply to Peter ZijlstraQuoted 5 lines · Peter Zijlstra
Quoted 3 lines
Programs that generate time-of-day output are using gettimeofday which is tied to
CLOCK_REALTIME. We want to be able to correlate a perf sample to an entry in an applications log file.Well, you can argue those programs are broken :-), [...]
Then 99% of the world is broken as daylight saving time jumps are part of our lives.
Quoted 2 lines
[...] Imagine the joys of trying to figure out wth happens when DST jumps the clock back an hour and you have an hour of duplicate data.
DST means twice a year the clock jumps back and forth by exactly one hour, on a given Saturday night. People debugging logs on Saturday nights and not realizing that there's a (always highly publicized) DST switch going on *deserve* to be surprised twice a year! :-)
Really, i dont think it's a big issue - and timestamping in *real* time has very obvious advantages as its name already suggests.
Thanks,
Ingo
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to David AhernQuoted 28 lines · David Ahern
Quoted 13 lines · Frederic Weisbecker
Quoted 5 lines
We want not only context-switch events, but the stack trace at the switch. For example, with the stack trace you can see preemption -- when a process got booted by another and where the booted process is at the time. You can see not only which system call caused an ap to block (e.g., an ioctl) but the full code path leading to the block.
You can recognize preemption a the context switch tracepoint: if the state of the scheduled out task is R (
TASK_RUNNING), which means it doesn't go to sleep but gets preempted, with an explicit preemption point likecond_resched(), or a more implicit one:spin_unlock(),preempt_enable(), an interrupt, ... Or it has been woken up while it was about to sleep, but it doesn't make much difference.Quoted 8 lines
If you want to know when a process is booted by another you can use the fork tracepoint, or sched:wake_up_new, etc...
And you can use syscall tracepoints to get the syscalls you want.
I don't see much the point for you to use stacktraces. But if you do, then rather add this support to perf script, in our scripting framework.
It's more the simplicity of what we are using today. 1 command, 1 event being monitored:
Quoted 6 lines
perf record -ag -e cs -c 1
A wealth of information. That command shows preemption, stack traces only for context-switches (not all of the syscalls which is overwhelming) and opens the door for other analysis. One data set. Simple. Focused.
Right. Then why not adding support to stacktraces in perf script? Seems it's the only missing thing to achieve what you want.
Quoted 7 lines
Quoted 6 lines
Because what you've done is basically to add tracing support to perf report. But we have perf script for that already. It only focuses on tracepoint events but they are those people are interested in because they show logical events in the kernel. I guess people are not interested in cpu-cycles overflows events or so as they don't show a state change in the kernel.
Quoted 5 lines
I have always referred to this as pretty printing each sample recorded as opposed to summarizing into a histogram. With that approach you have dictated the analysis of the data - a histogram summary. By printing each sample with address-symbol conversions we can look at it in whatever angle we need to make sense of it.
I'm not dictating any analysis. You can can just launch perf script without script and it will display the events, like you want.
Just try:
perf record -a -e sched:sched_switch
perf script
You can extend it to print addresses or symbols or even stacktraces. It just seems to me the right place to do so. Not perf report that is about histograms.
Re: [PATCH 3/3] perf events: add timehist option to record and report
In reply to Arnaldo Carvalho de MeloQuoted 39 lines · Arnaldo Carvalho de Melo
Em Fri, Feb 18, 2011 at 08:29:56PM +0100, Frederic Weisbecker escreveu:
Quoted 21 lines · Arnaldo Carvalho de Melo
Quoted 20 lines
Em Fri, Feb 18, 2011 at 06:59:30PM +0100, Frederic Weisbecker escreveu:
Quoted 2 lines
The timestamps will be the cpu time and not the walltime, but at least that seems to be partly what you seek?
The whole issue for him, AFAIK, is to correlate perf events with app events.
Think about tcpdump + networking tracepoints or 'perf probe' dynamic events in the network stack, he wants to merge those logs and correlate the tcpdump packet exchange with the tracepoints events in the network stack, etc.
I.e. it doesn't matter if it is ftrace or not, having a common clock shared between apps and kernel tracing/whatever infrastructure is what David is after, right?
He can change userspace to use the clock the kernel is using in the perf/ftrace/whatever infrastructure or make the kernel use the clock userspace uses.
Quoted 8 lines
Quoted 1 line
The issue here is who will bend, u or k ;-)
Right. I don't disagree with the need of a walltime. That already in debate :)
I was rather arguing about the tracing part. Adding support in perf report in the wrong way to do this. If something must be extended, It should be done in perf script, where we do the tracing support.
Squashing "profiling" and "tracing" differences is something I think worthy.
Its all about events, that should be treated as equal in all tools. So I don't think 'perf script' is about tracing, its about handling events found in the event stream, be it hw, sw, tracepoints, dynamic probes put in place by 'perf probe', or whatever event source we end up having.
Quoted 7 lines
A '
clock_gettime' like event, sampling whatever POSIX clock the kernel supports should be enough flexibility, leaving concerns about sanity of any particular use to the rope user.Of course, extensibility via 'perf script' or 'use perf' in perf scripts should provide great avenues for experimentation, not requiring changes in the builtins :-)
Right.
So I agree perf script should be tracing/profiling/any semantic agnostic. But when it's about dumping, displaying events sequentially, it seems an extension to perf script is a better place for that rather than perf report. perf script default behaviour is already about displaying raw traces. If support is needed to print the ip of the event or the stacktraces, it's very welcome!