perf events finer grained context instrumentation / context exclusion
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest5 patches 4 repliesIn review
- v15 patches 20 repliesSuperseded
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | perf: Provide a proper stop action for software eventskernel/ | +17 | 2 replies | |
| 2/5 | perf: Support disable() after stop() on software eventskernel/ kernel/ | +2 | 0 replies | |
| 3/5 | perf: Ability to enable in a paused modearch/ include/ kernel/ +1 more | +37 | 2 replies | |
| 4/5 | perf: Introduce task, softirq and hardirq contexts exclusioninclude/ kernel/ kernel/ | +227 | 0 replies | |
| 5/5 | perf: Support for task/softirq/hardirq exclusion on toolstools/ | +26 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH 0/5 v3] perf events finer grained context instrumentation / context exclusion
Hi,
In this new version, the weird hangs have been fixed. They were due to some ACTIVE state checks that didn't handle the paused mode.
And also comes a new pmu->reserve callback to schedule an event on the cpu without actually starting it (as if ->stop() was just called in it).
In x86 it is the same than the enable() callback, the decision to activate the event beeing eventually handled by checking the PERF_EVENT_STATE_PAUSED. On software events it is a stub as they can be activated anytime in a lightweight fashion, without the need to fight against a finite resource.
BTW, there is a quite handy way to make a diff between task context and task + irq context profiling.
Just run:
sudo ./perf stat -r 10 -e task-clock -e task-clock:t -e cs -e cs:t \ -e migrations -e migrations:t -e faults -e faults:t -e cycles \ -e cycles:t -e instructions -e instructions:t -e branches \ -e branches:t -e branch-misses -e branch-misses:t taskset 1 hackbench 1
(Did I just say handy?)
Example of result:
Performance counter stats for 'taskset 1 hackbench 1' (10 runs):
604,727182 task-clock-msecs # 0,969 CPUs ( +- 6,176% )
604,727182 task-clock-msecs # 0,969 CPUs ( +- 6,176% )
11584 context-switches # 0,019 M/sec ( +- 26,945% )
11593 context-switches # 0,019 M/sec ( +- 26,909% )
1 CPU-migrations # 0,000 M/sec ( +- 61,464% )
0 CPU-migrations # 0,000 M/sec ( +- 100,000% )
1844 page-faults # 0,003 M/sec ( +- 1,425% )
1847 page-faults # 0,003 M/sec ( +- 1,423% )
917442262 cycles # 1517,118 M/sec ( +- 6,814% ) (scaled from 69,40%)
908980892 cycles # 1503,126 M/sec ( +- 5,807% ) (scaled from 68,51%)
335812687 instructions # 0,368 IPC ( +- 6,977% ) (scaled from 73,77%)
321284628 instructions # 0,352 IPC ( +- 6,377% ) (scaled from 20,59%)
48956776 branches # 80,957 M/sec ( +- 5,936% ) (scaled from 22,67%)
48144741 branches # 79,614 M/sec ( +- 6,480% ) (scaled from 21,68%)
2310259 branch-misses # 4,758 % ( +- 9,698% ) (scaled from 15,11%)
2200507 branch-misses # 4,532 % ( +- 9,294% ) (scaled from 15,35%)0,624082951 seconds time elapsed ( +- 5,939% )
Most of the time, the instruction counter diff shows that irqs take 0.01% of noise with hackbench. Something that does more IO would probably be a more interesting example.
The thing is pullable there:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
perf/exclusion-4
Thanks.
Frederic Weisbecker (5):
perf: Provide a proper stop action for software events
perf: Support disable() after stop() on software events
perf: Ability to enable in a paused mode
perf: Introduce task, softirq and hardirq contexts exclusion
perf: Support for task/softirq/hardirq exclusion on tools
arch/x86/kernel/cpu/perf_event.c | 7 +- include/linux/perf_event.h | 52 ++++++++- kernel/hw_breakpoint.c | 1 + kernel/perf_event.c | 257 +++++++++++++++++++++++++++++++------- kernel/softirq.c | 6 + kernel/trace/trace_event_perf.c | 2 +- tools/perf/util/parse-events.c | 37 ++++-- 7 files changed, 302 insertions(+), 60 deletions(-)