Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1085 from rainers/gc_summary
Browse files Browse the repository at this point in the history
add some useful metrics to GC summary
  • Loading branch information
MartinNowak committed Jan 6, 2015
2 parents e011440 + 086f838 commit f1758f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 3 additions & 3 deletions benchmark/runbench.d
Expand Up @@ -85,13 +85,13 @@ void runTests(Config cfg)
rename("gcx.log", tgt);
auto lines = File(tgt, "r").byLine()
.find!(ln => ln.canFind("maxPoolMemory"));
if (!lines.empty) gcprof = lines.front.find("maxPoolMemory").idup;
if (!lines.empty) gcprof = lines.front.find("GC summary:")[11..$].idup;
}
else
{
auto lines = output.splitter(ctRegex!`\r\n|\r|\n`)
.find!(ln => ln.startsWith("maxPoolMemory"));
if (!lines.empty) gcprof = lines.front;
.find!(ln => ln.startsWith("GC summary:"));
if (!lines.empty) gcprof = lines.front[11..$];
}
}
auto res = minDur.split!("seconds", "msecs");
Expand Down
15 changes: 11 additions & 4 deletions src/gc/gc.d
Expand Up @@ -107,6 +107,7 @@ __gshared Duration prepTime;
__gshared Duration markTime;
__gshared Duration sweepTime;
__gshared Duration recoverTime;
__gshared Duration maxPauseTime;
__gshared size_t numCollections;
__gshared size_t maxPoolMemory;

Expand Down Expand Up @@ -1464,11 +1465,14 @@ struct Gcx
sweepTime.total!("msecs"));
printf("\tTotal page recovery time: %lld milliseconds\n",
recoverTime.total!("msecs"));
long maxPause = maxPauseTime.total!("msecs");
printf("\tMax Pause Time: %lld milliseconds\n", maxPause);
long gcTime = (recoverTime + sweepTime + markTime + prepTime).total!("msecs");
printf("\tGrand total GC time: %lld milliseconds\n", gcTime);
long pauseTime = (markTime + prepTime).total!("msecs");
printf("maxPoolMemory = %lld MB, pause time = %lld ms\n",
cast(long) maxPoolMemory >> 20, pauseTime);
printf("GC summary:%5lld MB,%5lld GC%5lld ms, Pauses%5lld ms <%5lld ms\n",
cast(long) maxPoolMemory >> 20, cast(ulong)numCollections, gcTime,
pauseTime, maxPause);
}

debug(CACHE_HITRATE)
Expand Down Expand Up @@ -2477,11 +2481,11 @@ struct Gcx
{
size_t n;
Pool* pool;
MonoTime start, stop;
MonoTime start, stop, begin;

if (GC.config.profile)
{
start = currTime;
begin = start = currTime;
}

debug(COLLECT_PRINTF) printf("Gcx.fullcollect()\n");
Expand Down Expand Up @@ -2626,6 +2630,9 @@ struct Gcx
{
stop = currTime;
markTime += (stop - start);
Duration pause = stop - begin;
if (pause > maxPauseTime)
maxPauseTime = pause;
start = stop;
}

Expand Down

0 comments on commit f1758f4

Please sign in to comment.