Better defaults for bench.pl.

* etc/bench.pl.in ($verbose, $cflags, $iterations): Change the
	default values.
	Adjust &verbose uses.
	(-q, --quiet): New.
This commit is contained in:
Akim Demaille
2008-07-21 22:00:35 +02:00
parent 9718cfa902
commit ef05c4d6f9
2 changed files with 26 additions and 8 deletions

View File

@@ -1,3 +1,11 @@
2008-11-04 Akim Demaille <demaille@gostai.com>
Better defaults for bench.pl.
* etc/bench.pl.in ($verbose, $cflags, $iterations): Change the
default values.
Adjust &verbose uses.
(-q, --quiet): New.
2008-11-04 Akim Demaille <demaille@gostai.com> 2008-11-04 Akim Demaille <demaille@gostai.com>
Make variant.yy more complex. Make variant.yy more complex.

View File

@@ -52,17 +52,26 @@ Test the use of variants instead of union in the C++ parser.
=item B<-c>, B<--cflags>=I<flags> =item B<-c>, B<--cflags>=I<flags>
Flags to pass to the C or C++ compiler. Flags to pass to the C or C++ compiler. Defaults to -O2.
=item B<-h>, B<--help>
Display this message and exit succesfully. The more verbose, the more
details.
=item B<-i>, B<--iterations>=I<integer> =item B<-i>, B<--iterations>=I<integer>
Say how many times a single test of the bench must be run. If Say how many times a single test of the bench must be run. If
negative, specify the minimum number of CPU seconds to run. Defaults negative, specify the minimum number of CPU seconds to run. Defaults
to -3. to -1.
=item B<-q>, B<--quiet>
Decrease the verbosity level (defaults to 1).
=item B<-v>, B<--verbose> =item B<-v>, B<--verbose>
Raise the verbosity level. Currently only affects B<--help>. Raise the verbosity level (defaults to 1).
=back =back
@@ -107,9 +116,9 @@ Verbosity level.
my $bison = $ENV{'BISON'} || '@abs_top_builddir@/tests/bison'; my $bison = $ENV{'BISON'} || '@abs_top_builddir@/tests/bison';
my $cc = $ENV{'CC'} || 'gcc'; my $cc = $ENV{'CC'} || 'gcc';
my $cxx = $ENV{'CXX'} || 'g++'; my $cxx = $ENV{'CXX'} || 'g++';
my $cflags = ''; my $cflags = '-O2';
my $iterations = -3; my $iterations = -1;
my $verbose = 0; my $verbose = 1;
=head1 FUNCTIONS =head1 FUNCTIONS
@@ -690,7 +699,7 @@ sub bench_grammar ($%)
my %size; my %size;
while (my ($name, $directives) = each %test) while (my ($name, $directives) = each %test)
{ {
verbose 1, "Generating $name\n"; verbose 2, "Generating $name\n";
# Call the Bison input file generator. # Call the Bison input file generator.
my $generator = "$gram" . "_grammar"; my $generator = "$gram" . "_grammar";
&$generator ($name, 200, @$directives); &$generator ($name, 200, @$directives);
@@ -709,7 +718,7 @@ sub bench_grammar ($%)
# shows only wallclock and the two children times. 'auto' (the # shows only wallclock and the two children times. 'auto' (the
# default) will act as 'all' unless the children times are both # default) will act as 'all' unless the children times are both
# zero, in which case it acts as 'noc'. 'none' prevents output. # zero, in which case it acts as 'noc'. 'none' prevents output.
verbose 1, "Running the benches for $gram\n"; verbose 2, "Running the benches for $gram\n";
my $res = timethese ($iterations, \%bench, 'nop'); my $res = timethese ($iterations, \%bench, 'nop');
# Output the speed result. # Output the speed result.
@@ -810,6 +819,7 @@ sub getopt ()
"c|cflags=s" => \$cflags, "c|cflags=s" => \$cflags,
"h|help" => sub { help ($verbose) }, "h|help" => sub { help ($verbose) },
"i|iterations=i" => \$iterations, "i|iterations=i" => \$iterations,
"q|quiet" => sub { --$verbose },
"v|verbose" => sub { ++$verbose }, "v|verbose" => sub { ++$verbose },
); );
Getopt::Long::Configure ("bundling", "pass_through"); Getopt::Long::Configure ("bundling", "pass_through");