This adds support for emitting heap census data to the eventlog, allowing heap behavior to be correlated with other tracing events. Currently we still emit hp records even when eventlog output is enabled, although we may wish to revisit this eventually with an eye towards deprecating the hp format.
This looks pretty sensible, modulo a few comments below.
I don't think we describe the binary format of events elsewhere in the User Guide, so this looks a bit strange. I'd think a comment in EventLogFormat.h would be better, no?
Reserve a tag range for profiling events, and I suggest documenting the format here.
We might as well roll eventlog into the prof way, to avoid way explosion. We already do this for debug.
Do you really want to dump the cost centres for each sample? It would be enough to dump them at the start of the program, and when dynamically loading code.
How about moving it to an appendix? IMHO this is part of the user-visible interface that the compiler provides and consequently should be documented in the user guide. Moreover, it's a bit more readable with proper mark-up.
Wait, isn't that what I do? Note how there is no longer a p way, only p_l.
I'm confused. dumpCostCentresToEventLog is only called from initHeapProfiling, which should be called precisely once, no?
Oh I see. But that's different from the way we handle debug, which is that debug is assumed to include l. So debug_p_l is weird, and so is thr_debug_p_l. Also, getting rid of "p" will be surprising, so I propose we just make "p_l" == "p".
Ah sorry, I misread the code.
The key here appears to be in includes/rts/Config.h,
/* DEBUG implies TRACING and TICKY_TICKY */ #if defined(DEBUG) #define TRACING #define TICKY_TICKY #endif
Now the question is why handle this here instead of simply passing the relevant arguments to ghc while building the RTS.
Looks like this is ready to go now.
You don't actually need this, right?
It's suboptimal that we now have a partial (but detailed) description of the format here and a separate partial description of the format in the header file. I think this is moving in the right direction, but in the meantime maybe a pointer from each to the other would be a good idea?