Re: [PATCH 3/3] perf record/report: Process events in order
From: Thomas Gleixner
Date: Mon Dec 06 2010 - 04:20:46 EST
On Mon, 6 Dec 2010, Ian Munsie wrote:
> From: Ian Munsie <imunsie@xxxxxxxxxxx>
>
> This patch changes perf report to ask for the ID info on all events be
> default if recording from multiple CPUs.
>
> Perf report will now process the events in order if the kernel is able
> to provide timestamps on all events. This ensures that events such as
> COMM and MMAP which are necessary to correctly interpret samples are
> processed prior to those samples so that they are attributed correctly.
See https://lkml.org/lkml/2010/12/5/45
Slightly different, but the same idea :)
>
> +static int perf_session__dispatch_event(event_t *event,
> + struct sample_data *sample,
> + struct perf_session *s,
> + struct perf_event_ops *ops)
> +{
> + switch (event->header.type) {
> + case PERF_RECORD_SAMPLE:
> + return ops->sample(event, sample, s);
> + case PERF_RECORD_MMAP:
> + return ops->mmap(event, sample, s);
> + case PERF_RECORD_COMM:
> + return ops->comm(event, sample, s);
> + case PERF_RECORD_FORK:
> + return ops->fork(event, sample, s);
> + case PERF_RECORD_EXIT:
> + return ops->exit(event, sample, s);
> + case PERF_RECORD_LOST:
> + return ops->lost(event, sample, s);
> + case PERF_RECORD_READ:
> + return ops->read(event, sample, s);
> + case PERF_RECORD_THROTTLE:
> + return ops->throttle(event, sample, s);
> + case PERF_RECORD_UNTHROTTLE:
> + return ops->unthrottle(event, sample, s);
> + case PERF_RECORD_HEADER_ATTR:
> + return ops->attr(event, s);
> + case PERF_RECORD_HEADER_EVENT_TYPE:
> + return ops->event_type(event, s);
> + case PERF_RECORD_HEADER_TRACING_DATA:
> + return ops->tracing_data(event, s);
> + case PERF_RECORD_HEADER_BUILD_ID:
> + return ops->build_id(event, s);
These can be processed unordered.
> + case PERF_RECORD_FINISHED_ROUND:
> + return ops->finished_round(event, s, ops);
You don't want to delay this unless you have unlimited memory. See my
patch.
> {
> + if (ops->ordered_samples && sample->time == -1ULL) {
> + dump_printf("Event missing timestamp, switching to unordered processing\n");
> + flush_sample_queue(s, ops);
> + ops->ordered_samples = false;
Why ? The events injected by perf record itself have no timestamps and
do not need them. So why disabling ordered_samples ?
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/