Skip to content

Commit

Permalink
new modes --benchmarkanything[-report]
Browse files Browse the repository at this point in the history
 --benchmarkanything enables other options
   to do The Right Thing for storing results
   in a BenchmarkAnything store (but does not
   send).
 --benchmarkanything-report additionally sends
   the results by using
   BenchmarkAnything::Storage::Frontend::Lib
   which in turn follows its configuration.
  • Loading branch information
renormalist committed Sep 5, 2015
1 parent ae18ada commit 0582715
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
19 changes: 19 additions & 0 deletions bin/benchmark-perlformance
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@ Similar to C<--outstyle=yaml>, except the produced YAML is actually
the lightweight variant YAMLish produced by L<Data::YAML::Writer|Data::YAML::Writer>,
which can easily be embedded into TAP.

=item --benchmarkanything

This option produces benchmarks result entries following the
L<BenchmarkAnything::Schema|BenchmarkAnything schema>.

Implicitely enables C<--outstyle=json> (unless you specify
--outstyle=yaml/yamlish), C<-cccc> (extensive config info), C<-p>
(platform info).

=item --benchmarkanything-report

This reports the results to a L<BenchmarkAnything
store|BenchmarkAnything::Storage::Frontend::Lib>, as configured in
your BenchmarkAnything config ($BENCHMARKANYTHING_CONFIGFILE or
C<~/.benchmarkanything.cfg>).

Implicitely enables C<--benchmarkanything>, C<--outstyle=json>,
C<-cccc> (extensive config info), C<-p> (platform info).

=item --outfile=FILE

Write results into FILE. If FILE can not be opened then it prints to STDOUT.
Expand Down
22 changes: 21 additions & 1 deletion lib/Benchmark/Perl/Formance.pm
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,8 @@ sub run {
my $platforminfo = 0;
my $codespeed = 0;
my $tapper = 0;
my $benchmarkanything = 0;
my $benchmarkanything_report = 0;
my $cs_executable_suffix = "";
my $cs_executable = "";
my $cs_project = "";
Expand Down Expand Up @@ -568,6 +570,8 @@ sub run {
"platforminfo|p" => \$platforminfo,
"codespeed" => \$codespeed,
"tapper" => \$tapper,
"benchmarkanything" => \$benchmarkanything,
"benchmarkanything-report" => \$benchmarkanything_report,
"cs-executable-suffix=s" => \$cs_executable_suffix,
"cs-executable=s" => \$cs_executable,
"cs-project=s" => \$cs_project,
Expand All @@ -577,6 +581,15 @@ sub run {
"tapdescription=s" => \$tapdescription,
"D=s%" => \$D,
);

# special meta options - order matters!
$benchmarkanything = 1 if $tapper; # legacy option
$benchmarkanything = 1 if $benchmarkanything_report;
$platforminfo = 1 if $benchmarkanything; # -p
$showconfig = 4 if $benchmarkanything; # -cccc
$outstyle = 'json' if $benchmarkanything and $outstyle !~ /^(json|yaml|yamlish)$/;
$outstyle = 'json' if $benchmarkanything_report;

# fill options
$self->{options} = {
help => $help,
Expand All @@ -591,6 +604,8 @@ sub run {
platforminfo => $platforminfo,
codespeed => $codespeed,
tapper => $tapper,
benchmarkanything => $benchmarkanything,
benchmarkanything_report => $benchmarkanything_report,
cs_executable_suffix => $cs_executable_suffix,
cs_executable => $cs_executable,
cs_project => $cs_project,
Expand Down Expand Up @@ -664,7 +679,7 @@ sub run {
}

# Tapper BenchmarkAnythingData blocks
if ($tapper)
if ($tapper or $benchmarkanything)
{
$RESULTS{BenchmarkAnythingData} = $self->generate_BenchmarkAnythingData_data(\%RESULTS);
}
Expand Down Expand Up @@ -768,6 +783,11 @@ sub print_results
print $OUTFILE $output;
close $OUTFILE;
}
elsif ($self->{options}{benchmarkanything_report}) {
require BenchmarkAnything::Storage::Frontend::Lib;
my $balib = BenchmarkAnything::Storage::Frontend::Lib->new(verbose => 1);
$balib->add({BenchmarkAnythingData => $RESULTS->{BenchmarkAnythingData}});
}
else
{
print $output;
Expand Down

0 comments on commit 0582715

Please sign in to comment.