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

Commit

Permalink
make repeat count configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNowak committed Dec 28, 2014
1 parent b856e49 commit c4490ba
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions benchmark/runbench.d
Expand Up @@ -21,7 +21,7 @@ string runCmd(string cmd)
return res.output;
}

void runTest(string pattern, string dmd, string dflags, string runArgs)
void runTest(string pattern, string dmd, string dflags, string runArgs, uint repeat)
{
import std.algorithm, std.file, std.path, std.regex, std.string;

Expand Down Expand Up @@ -59,7 +59,7 @@ void runTest(string pattern, string dmd, string dflags, string runArgs)

auto cmd = bin ~ " " ~ runArgs;
string gcprof;
foreach (_; 0 .. 10)
foreach (_; 0 .. repeat)
{
sw.reset;
auto output = runCmd(cmd);
Expand All @@ -84,7 +84,7 @@ void printHelp()
{
import std.ascii : nl=newline;
auto helpString =
"usage: runbench [<test_regex>] [<dflags>] [-h|--help] [-v|--verbose] [-- <runargs>]"~nl~nl~
"usage: runbench [<test_regex>] [<dflags>] [-h|--help] [-v|--verbose] [-r n|--repeat=n] [-- <runargs>]"~nl~nl~

" tests - Regular expressions to select tests. Default: '.*\\.d'"~nl~
" dflags - Flags passed to compiler. Default: '-O -release -inline'"~nl~
Expand All @@ -110,10 +110,11 @@ void main(string[] args)
}

import std.getopt;
bool help;
bool help; uint repeat = 10;
getopt(args, config.passThrough,
"h|help", &help,
"v|verbose", &verbose);
"v|verbose", &verbose,
"r|repeat", &repeat);

string pattern = r".*\.d";
if (args.length >= 2)
Expand All @@ -132,5 +133,5 @@ void main(string[] args)
auto dmd = env.get("DMD", "dmd");
writeln("compiler: "~dmd~' '~dflags);

runTest(pattern, dmd, dflags, runArgs);
runTest(pattern, dmd, dflags, runArgs, repeat);
}

0 comments on commit c4490ba

Please sign in to comment.