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

Commit

Permalink
support gcx.log output
Browse files Browse the repository at this point in the history
- save gcx.log of best run
- parse gcx.log for GC profile data
  • Loading branch information
MartinNowak committed Dec 29, 2014
1 parent b8f17d9 commit f6b7348
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions benchmark/runbench.d
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ void runTests(Config cfg)
{
import std.algorithm, std.file, std.path, std.regex, std.string;

if (exists("gcx.log")) remove("gcx.log");

string[] sources;
auto re = regex(cfg.pattern, "g");
auto self = buildPath(".", "runbench.d");
Expand Down Expand Up @@ -75,9 +77,19 @@ void runTests(Config cfg)
if (dur >= minDur) continue;
minDur = dur;

auto lines = output.splitter(ctRegex!`\r\n|\r|\n`)
.find!(ln => ln.startsWith("maxPoolMemory"));
if (!lines.empty) gcprof = lines.front;
if (exists("gcx.log"))
{
auto lines = File("gcx.log", "r").byLine()
.find!(ln => ln.canFind("maxPoolMemory"));
if (!lines.empty) gcprof = lines.front.find("maxPoolMemory").idup;
rename("gcx.log", bin.setExtension("gcx.log"));
}
else
{
auto lines = output.splitter(ctRegex!`\r\n|\r|\n`)
.find!(ln => ln.startsWith("maxPoolMemory"));
if (!lines.empty) gcprof = lines.front;
}
}
auto res = minDur.split!("seconds", "msecs");
if (gcprof.length)
Expand Down

0 comments on commit f6b7348

Please sign in to comment.