summaryrefslogtreecommitdiff
path: root/rts/ProfHeap.c
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2019-07-02 10:38:13 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-09-17 19:21:10 -0400
commitae4415b9487d24942aa0e91052d4b897a3cf2f2e (patch)
tree7114c5e3418cf480339f69313f8960adeb12e05a /rts/ProfHeap.c
parent7915afc6bb9539a4534db99aeb6616a6d145918a (diff)
downloadhaskell-ae4415b9487d24942aa0e91052d4b897a3cf2f2e.tar.gz
eventlog: Add biographical and retainer profiling traces
This patch adds a new eventlog event which indicates the start of a biographical profiler sample. These are different to normal events as they also include the timestamp of when the census took place. This is because the LDV profiler only emits samples at the end of the run. Now all the different profiling modes emit consumable events to the eventlog.
Diffstat (limited to 'rts/ProfHeap.c')
-rw-r--r--rts/ProfHeap.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index cc99e37fdc..55541f70cc 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -81,6 +81,10 @@ initLDVCtr( counter *ctr )
typedef struct {
double time; // the time in MUT time when the census is made
+ StgWord64 rtime; // The eventlog time the census was made. This is used
+ // for the LDV profiling events because they are all
+ // emitted at the end of compilation so we need to know
+ // when the sample actually took place.
HashTable * hash;
counter * ctrs;
Arena * arena;
@@ -769,9 +773,18 @@ dumpCensus( Census *census )
ssize_t count;
printSample(true, census->time);
- traceHeapProfSampleBegin(era);
+
+
+ if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
+ traceHeapBioProfSampleBegin(era, census->rtime);
+ } else {
+ traceHeapProfSampleBegin(era);
+ }
+
+
#if defined(PROFILING)
+
/* change typecast to uint64_t to remove
* print formatting warning. See #12636 */
if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
@@ -788,6 +801,23 @@ dumpCensus( Census *census )
(uint64_t)(census->prim * sizeof(W_)));
fprintf(hp_file, "DRAG\t%" FMT_Word64 "\n",
(uint64_t)(census->drag_total * sizeof(W_)));
+
+
+ // Eventlog
+ traceHeapProfSampleString(0, "VOID",
+ (census->void_total * sizeof(W_)));
+ traceHeapProfSampleString(0, "LAG",
+ ((census->not_used - census->void_total) *
+ sizeof(W_)));
+ traceHeapProfSampleString(0, "USE",
+ ((census->used - census->drag_total) *
+ sizeof(W_)));
+ traceHeapProfSampleString(0, "INHERENT_USE",
+ (census->prim * sizeof(W_)));
+ traceHeapProfSampleString(0, "DRAG",
+ (census->drag_total * sizeof(W_)));
+
+ traceHeapProfSampleEnd(era);
printSample(false, census->time);
return;
}
@@ -856,7 +886,8 @@ dumpCensus( Census *census )
rs->id = -(rs->id);
// report in the unit of bytes: * sizeof(StgWord)
- printRetainerSetShort(hp_file, rs, RtsFlags.ProfFlags.ccsLength);
+ printRetainerSetShort(hp_file, rs, (W_)count * sizeof(W_)
+ , RtsFlags.ProfFlags.ccsLength);
break;
}
#endif
@@ -1156,6 +1187,8 @@ void heapCensus (Time t)
census = &censuses[era];
census->time = mut_user_time_until(t);
+ census->rtime = TimeToNS(stat_getElapsedTime());
+
// calculate retainer sets if necessary
#if defined(PROFILING)