1
# Copyright (C) 2009 Sun Microsystems, Inc. All rights reserved. Use
2
# is subject to license terms.
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; version 2 of the License.
8
# This program is distributed in the hope that it will be useful, but
9
# WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
# General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21
use GenTest::Executor;
22
use GenTest::App::Gendata;
24
use GenTest::Generator::FromGrammar;
29
if ($arg eq 'grammar') {
30
########################################
31
say("Benchmark $arg: FromGrammar->next()");
33
my $grammar = GenTest::Grammar->new(grammar_file => 'bench/WL5004_sql.yy');
35
my $generator = GenTest::Generator::FromGrammar->new(grammar => $grammar,
38
my $executor = GenTest::Executor->newFromDSN("dummy");
40
$executor->cacheMetaData();
42
my $start = Time::HiRes::time();
43
foreach $i (0..50000) {
44
$generator->next([$executor,undef]);
46
my $stop = Time::HiRes::time();
47
open TM,">bench/grammar.dat";
48
print TM "YVALUE = ".($stop - $start)."\n";
51
} elsif ($arg eq 'gendata') {
52
########################################
53
say("benchmark $arg: Gendata->run()");
55
my $gen = GenTest::App::Gendata->new(dsn => "dummy",
56
spec_file => "bench/falcon_data_types.zz",
61
my $start = Time::HiRes::time();
62
my $status = $gen->run();
63
my $stop = Time::HiRes::time();
65
open TM,">bench/gendata.dat";
66
print TM "YVALUE = ".($stop - $start)."\n";
69
foreach my $b ('gendata','grammar') {
70
say("----------------------------------------------");
71
system("perl -d:DProf bench/benchmark.pl $b");
72
say("Collecting profiling information");