[RFC] StatProfile: Heap and black-hole sampling
Needs RevisionPublic

Authored by bgamari on Sep 4 2015, 7:31 AM.

Details

Summary

This provides samples to the statistical profiler introduced in D1214 based on heap allocation and blackhole-blocking events.

Additional sampling strategies (e.g. based on time, CPU performance counters,
etc.) are left for future work.

The implementation of heap sampling is admittedly a bit hacky.
Based on Peter Wortmann's c01384a26d7c9d22d26a760470bdb6379a2913ee.
Lacking a better idea, I follow Peter's lead and lay claim to R9
to get the attribution address to stg_gc_noregs.

Depends on D1214

bgamari updated this revision to Diff 4066.Sep 4 2015, 7:31 AM
bgamari retitled this revision from to [RFC] StatProfile: Heap and black-hole sampling.
bgamari updated this object.
bgamari edited the test plan for this revision. (Show Details)
bgamari added reviewers: scpmw, simonmar.
bgamari updated this object.Sep 4 2015, 7:33 AM
bgamari edited edge metadata.
scpmw edited edge metadata.EditedSep 4 2015, 9:58 AM

Yeah, the R9 hack is certainly bad. When I originally wrote the code, stg_no_regs was a preprocessor macro, which made it easier in a number of ways.

Most critically, I just remembered that there's now a significant hole here - the code generator directly calls stg_no_regs (see compiler/codeGen/StgCmmHeap.hs), which obviously wouldn't have the R9 set. I think I had a patch to fix that, but I might not have comitted it publically as I was hoping I would find a better solution.

(sorry for the duplicated in-line comment, wanted to move it but didn't realise the "X" had only hidden it)

rts/HeapStackCheck.cmm
91

Always meant to check whether there was a better solution than this. When I originally wrote the code stg_gc_noregs was a preprocessor macro, which made it easier.

bgamari updated this revision to Diff 4328.Sep 26 2015, 1:52 PM
bgamari edited edge metadata.
  • Rebase and various fixes
bgamari updated this revision to Diff 4401.Oct 2 2015, 5:07 PM

Rework sampling

austin requested changes to this revision.Mar 14 2016, 9:39 AM
austin edited edge metadata.

Note: Punting off the review queue until we want to revive this and look at it more closely.

This revision now requires changes to proceed.Mar 14 2016, 9:39 AM
austin resigned from this revision.Nov 6 2017, 10:10 PM