Re: [RFC PATCH 0/4] perf: Custom contexts

From: Arnaldo Carvalho de Melo
Date: Mon Mar 14 2011 - 16:44:09 EST


Em Mon, Mar 14, 2011 at 08:17:59PM +0100, Frederic Weisbecker escreveu:
> Some examples:
>
> - Trace lock events inside irqs
>
> $ perf record -e irq:irq_handler_entry -e irq:irq_handler_exit \
> -e lock:lock_acquire --starter 0 --stopper 1 --enable-on-starter \
> perf bench sched messaging

A more compact alternative that uses .. to delimit ranges (start and/or
stop), like git does for changeset ranges and @ to determine where to
enable the event:

perf record -e instructions@irq:irq_handler_entry..irq:irq_handler_exit \
perf bench sched messaging

event-A at-range event-B to event-C

open ended ranges being possible as well, i.e. start counting when
event-B triggers and stop only when the workload finishes, or count from
workload start till event-C triggers.

> $ perf script
>
> perf-4300 [000] 2000.209721: irq_handler_entry: irq=40 name=ahci
> perf-4300 [000] 2000.209725: lock_acquire: 0xffff880037851c40 &(&host->lock)->rlock
> perf-4300 [000] 2000.209731: irq_handler_exit: irq=40 ret=handled
> perf-4300 [000] 2000.209821: irq_handler_entry: irq=40 name=ahci
> perf-4300 [000] 2000.209823: lock_acquire: 0xffff880037851c40 &(&host->lock)->rlock
> perf-4300 [000] 2000.209828: irq_handler_exit: irq=40 ret=handled
> - Count instructions inside softirqs, outside softirqs and everywhere:
>
> $ perf stat -e irq:softirq_entry -e irq:softirq_exit \
> -e instructions --starter 0 --stopper 1 --enable-on-starter \
> -e instructions --starter 1 --stopper 0 \
> -e instructions ./perf bench sched messaging

$ perf record -e instructions@irq:softirq_entry..irq:softirq_exit \
-e instructions@irq:softirq_exit..irq:softirq_entry \
-e instructions \
perf bench sched messaging

- Arnaldo
--
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/