Skip to content

Commit

Permalink
TOOLS: smrunplan: support option to set number of runs for performanc…
Browse files Browse the repository at this point in the history
…e test

Signed-off-by: Stefan Westerfeld <[email protected]>
  • Loading branch information
swesterfeld committed Jun 19, 2024
1 parent 57e257e commit 36bc0d7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/smrunplan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct Options
bool quiet;
bool perf;
bool perf_note_on = false;
int perf_runs = -1;
bool normalize;
double gain;
int rate;
Expand Down Expand Up @@ -134,6 +135,10 @@ Options::parse (int *argc_p,
{
perf_note_on = true;
}
else if (check_arg (argc, argv, &i, "--perf-runs", &opt_arg))
{
perf_runs = atoi (opt_arg);
}
else if (check_arg (argc, argv, &i, "--gain", &opt_arg) || check_arg (argc, argv, &i, "-g", &opt_arg))
{
gain = sm_atof (opt_arg);
Expand Down Expand Up @@ -169,6 +174,7 @@ Options::print_usage ()
printf (" -n, --normalize normalize output samples\n");
printf (" -p, --perf run performance test\n");
printf (" --perf-note-on run note on performance test\n");
printf (" --perf-runs <runs> set number of runs for perf test\n");
printf (" -l, --len <len> set output sample len\n");
printf (" -m, --midi-note <note> set midi note to use\n");
printf (" -q, --quiet suppress audio output\n");
Expand Down Expand Up @@ -340,7 +346,7 @@ main (int argc, char **argv)
double start = get_time();

// at 100 bogo-voices, test should run 10 seconds
const size_t RUNS = max<int> (1, options.rate * 1000 / samples.size());
const size_t RUNS = options.perf_runs > 0 ? options.perf_runs : max<int> (1, options.rate * 1000 / samples.size());
for (size_t i = 0; i < RUNS; i++)
player.compute_samples (samples);

Expand Down

0 comments on commit 36bc0d7

Please sign in to comment.