[Compbench-devel] CompBenchmarks++/SupportedBenchmarks benchmarks-genlibwrapper.pl, 1.4, 1.5
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-02-15 18:54:14
|
Update of /cvsroot/compbench/CompBenchmarks++/SupportedBenchmarks In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19317 Modified Files: benchmarks-genlibwrapper.pl Log Message: Unique instance for each benchmark. Index: benchmarks-genlibwrapper.pl =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/SupportedBenchmarks/benchmarks-genlibwrapper.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** benchmarks-genlibwrapper.pl 26 Jan 2007 01:41:57 -0000 1.4 --- benchmarks-genlibwrapper.pl 15 Feb 2007 18:54:10 -0000 1.5 *************** *** 30,55 **** sub generate { print "#include <Benchmark/Benchmark-DLLoader.h>\n"; ! print "#include <UI/UI.h>\n\n"; print "using namespace CBM;\n\n"; my $n = (keys %{$DATA{$PACKAGE}})+0; - print "int Package$PACKAGE\::benchmarkNumber(void) {\n"; print " return($n);\n}\n\n"; print "CBM::BenchmarkVector& Package$PACKAGE\::Benchmarks(void) {\n"; print " if (benchmarks.size()) return(benchmarks);\n"; ! foreach(keys %{$DATA{$PACKAGE}}) { ! print " benchmarks.push_back(\"$_\");\n"; } print " return(benchmarks);\n"; print "}\n\n"; print "CBM::Benchmark *Package$PACKAGE\::Benchmark(std::string bid) {\n"; ! foreach(keys %{$DATA{$PACKAGE}}) { print " if (bid == \"$_\") {\n"; ! print " return(new CBM::Benchmark$DATA{$PACKAGE}->{$_}(this));\n"; print " }\n"; } print " return(0);\n"; --- 30,63 ---- sub generate { print "#include <Benchmark/Benchmark-DLLoader.h>\n"; ! # print "#include <UI/UI.h>\n\n"; print "using namespace CBM;\n\n"; my $n = (keys %{$DATA{$PACKAGE}})+0; print "int Package$PACKAGE\::benchmarkNumber(void) {\n"; print " return($n);\n}\n\n"; print "CBM::BenchmarkVector& Package$PACKAGE\::Benchmarks(void) {\n"; + print " CBM::BenchmarkCached *ptr;\n"; print " if (benchmarks.size()) return(benchmarks);\n"; ! foreach(sort keys %{$DATA{$PACKAGE}}) { ! print " ptr=new BenchmarkCached;\n"; ! print " ptr->id=\"$_\";\n"; ! print " ptr->instance=0;\n"; ! print " benchmarks.push_back(ptr);\n"; } print " return(benchmarks);\n"; print "}\n\n"; + my $idx = 0; print "CBM::Benchmark *Package$PACKAGE\::Benchmark(std::string bid) {\n"; ! print " Benchmarks();\n"; ! foreach(sort keys %{$DATA{$PACKAGE}}) { print " if (bid == \"$_\") {\n"; ! print " if (!benchmarks[$idx]->instance)\n"; ! print " benchmarks[$idx]->instance=new CBM::Benchmark$DATA{$PACKAGE}->{$_}(this);\n"; ! print " return(benchmarks[$idx]->instance);\n"; print " }\n"; + $idx++; } print " return(0);\n"; |