Commit fb898438 authored by David BAELDE's avatar David BAELDE

countfuns separately for xquery/xslt/all

parent 19cfbe04
all: extensions.xml gains-ext.tex countfuns_dist.dat
all: extensions.xml gains-ext.tex countfuns_all.dat countfuns_xslt.dat countfuns_xquery.dat
countfuns_dist.dat: countfuns.pl $(wildcard ../../benchmark/*-full.xml)
./countfuns.pl ../../benchmark/*-full.xml > /dev/null
countfuns_all.dat: countfuns.pl $(wildcard ../../benchmark/*-full.xml)
XPPSUF="all" ./countfuns.pl ../../benchmark/*-full.xml
countfuns_xslt.dat: countfuns.pl $(wildcard ../../benchmark/*-full.xml)
grep 'type="xslt"' ../tex/benchmarks-all-full.xml | \
sed -e 's/.*href="\(.*\.xml\)".*/\1/' | \
XPPSUF="xslt" xargs ./countfuns.pl
countfuns_xquery.dat: countfuns.pl $(wildcard ../../benchmark/*-full.xml)
grep 'type="xquery"' ../tex/benchmarks-all-full.xml | \
sed -e 's/.*href="\(.*\.xml\)".*/\1/' | \
XPPSUF="xquery" xargs ./countfuns.pl
extensions.xml: extensions.sh $(wildcard ../../benchmark/*-full.xml)
@bash extensions.sh > extensions.xml
......
......@@ -228,11 +228,24 @@
"zero-or-one"
);
die "Usage: $0 <XML files>\n" unless @ARGV;
unless (@ARGV) {
print <<HELP;
Usage: $0 <XML files>
%table=();
$total=0;
$nbfuns=0;
Produces gnuplot data files countfuns_<XPPSUF>{,_std,_nonstd}.dat,
where XPPSUF is set as an env variable.
Issues a detailed output with function names if env variable VERBOSE is set.
HELP
exit 1;
}
$suffix = $ENV{'XPPSUF'};
$verbose = $ENV{'VERBOSE'};
%table=(); # maps function names to occurrence count
$total=0; # total nb of occurrences of functions
$nbfuns=0; # nb of functions i.e. size of %table
for (@ARGV) {
open(STARLET,"xmlstarlet sel -t -n -v \"//*[local-name()='functionName']\" $_ |");
while(<STARLET>) {
......@@ -248,18 +261,20 @@ for (@ARGV) {
}
}
print "Results in ascending number of occurrences:\n";
for (sort { $table{$a} <=> $table{$b} } keys %table) {
print "$_: $table{$_}\n";
if ($verbose ne "") {
print "Results in ascending number of occurrences:\n";
for (sort { $table{$a} <=> $table{$b} } keys %table) {
print "$_: $table{$_}\n";
}
}
print "Generating countfuns_dist{,std,nonstd}.dat...\n";
open DAT,">","countfuns_dist.dat"
or die "Cannot open countfuns_dist.dat!\n";
open STD,">","countfuns_dist_std.dat"
or die "Cannot open countfuns_dist_std.dat!\n";
open NONSTD,">","countfuns_dist_nonstd.dat"
or die "Cannot open countfuns_dist_nonstd.dat!\n";
print "Generating countfuns_${suffix}{,_std,_nonstd}.dat...\n";
open DAT,">","countfuns_${suffix}.dat"
or die "Cannot open countfuns_${suffix}.dat!\n";
open STD,">","countfuns_${suffix}_std.dat"
or die "Cannot open countfuns_${suffix}_std.dat!\n";
open NONSTD,">","countfuns_${suffix}_nonstd.dat"
or die "Cannot open countfuns_${suffix}_nonstd.dat!\n";
$n=0; # rank of current function (decr. order)
$sofar=0; # total nb of occ. so far
$sofar_std=0; # total nb of occ. of std funs so far
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment