Open
Bug 990790
Opened 11 years ago
Updated 2 months ago
Allow using Linux perf_event counters with the Gecko profiler
Categories
(Core :: Gecko Profiler, enhancement, P3)
Tracking
()
NEW
People
(Reporter: jld, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
5.54 KB,
patch
|
Details | Diff | Splinter Review | |
15.78 KB,
patch
|
Details | Diff | Splinter Review | |
2.29 KB,
patch
|
Details | Diff | Splinter Review |
Something I realized last week — and which it turns out the rr project has apparently been using for quite some time — is that a perf_event fd can be set O_ASYNC and configured to deliver a signal to a given task or process group, in addition to its usual sampling; with F_SETSIG, this can be any signal. So it's possible to create a perf_event fd to sample a given task (== thread), then set the signal target to that task with F_SETOWN, and now the thread has an interval timer for anything from CPU cycles to page faults to context switches.
The key point is that this stops the thread when a sample occurs and lets us run code that we control on it in userspace, so we can do all the pseudostack processing (and integration with markers) that we normally do, without needing kernel changes. And if we can patch the kernel, then we can add arbitrary probe points; see also bug 948648.
As an added bonus, this lets us avoid the build issues that existed with the perf tool on B2G.
Comment 2•11 years ago
|
||
(In reply to Jed Davis [:jld] from comment #0)
> As an added bonus, this lets us avoid the build issues that existed with the
> perf tool on B2G.
Just curious. What were these?
Comment 3•11 years ago
|
||
Reporter | ||
Comment 4•11 years ago
|
||
This patch changes the profiler from counting milliseconds to counting page faults. It doesn't work yet with non-main threads in child processes (or any processes on non-b2g), because a non-superuser task can apparently only attach perf to itself, not another task with the same uid. Also, it's substantially hacky at present; more of of a proof of concept than anything.
Reporter | ||
Comment 5•11 years ago
|
||
Also, it helps to be able to unwind out of memset and memcpy when profiling page faults (and this may also apply to the planned work on COW events). There are several variants of those routines in hand-written assembly, and some of them didn't have unwind info; this fixes that. (I haven't looked at x86 Android or glibc yet.)
Reporter | ||
Comment 6•9 years ago
|
||
This is an interesting thing for the profiler to be able to do, so it would be nice if someone tried to pick it up, but I haven't been working on profiling for quite some time.
Assignee: jld → nobody
Severity: normal → N/A
Type: defect → enhancement
Priority: -- → P3
Blocks: 1329137
You need to log in
before you can comment on or make changes to this bug.
Description
•