simdjson/scripts/plotparse.sh

79 lines
2.7 KiB
Bash
Raw Normal View History

2018-12-19 11:18:23 +08:00
#!/bin/bash
2018-12-19 11:21:19 +08:00
[[ "$(command -v gnuplot)" ]] || { echo "gnuplot is not installed" 1>&2 ; exit 1; }
2018-12-19 11:18:23 +08:00
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
cd $SCRIPTPATH/..
plotdirectory=$SCRIPTPATH/plots/$(uname -n)
mkdir -p $plotdirectory
os=$(uname)
2018-12-19 11:21:19 +08:00
2018-12-19 11:18:23 +08:00
if [ "$os" = "Linux" ]; then
echo "You are using linux."
echo "We are going to just parse using simdjson, and collect perf stats."
make parse
2018-12-19 11:48:24 +08:00
myfile=$plotdirectory"/parselinuxtable.txt"
echo $myfile
echo "" > $myfile
2018-12-19 11:18:23 +08:00
for i in $SCRIPTPATH/../jsonexamples/*.json; do
[ -f "$i" ] || break
echo $i
2018-12-19 11:48:24 +08:00
$SCRIPTPATH/../parse -t "$i" >> "$myfile"
2018-12-19 11:18:23 +08:00
done
2018-12-19 11:58:26 +08:00
gnuplot -e "filename='$myfile';name='$plotdirectory/stackedperf.pdf'" $SCRIPTPATH/stackbar.gnuplot
2018-12-19 11:18:23 +08:00
fi
make parsingcompetition
echo "parsing (with competition)"
echo
for i in $SCRIPTPATH/../jsonexamples/*.json; do
[ -f "$i" ] || break
echo $i
shortname=$(basename $SCRIPTPATH/$i.table)
corename=$(basename ${shortname%.*})".pdf"
$SCRIPTPATH/../parsingcompetition -t $i > $plotdirectory/$shortname
sort $plotdirectory/$shortname > $plotdirectory/$shortname.table.sorted
gnuplot -e "filename='$plotdirectory/$shortname.table.sorted';name='$plotdirectory/$corename'" $SCRIPTPATH/bar.gnuplot
rm $plotdirectory/$shortname
rm $plotdirectory/$shortname.table.sorted
echo
done
make parseandstatcompetition
echo "parsing and collecting basic stats on json documents as quickly as possible"
echo
for i in $SCRIPTPATH/../jsonexamples/*.json; do
[ -f "$i" ] || break
echo $i
shortname=$(basename $SCRIPTPATH/$i"parseandstat.table")
corename=$(basename ${shortname%.*})".pdf"
$SCRIPTPATH/../parseandstatcompetition -t $i> $plotdirectory/$shortname
sort $plotdirectory/$shortname > $plotdirectory/$shortname.table.sorted
gnuplot -e "filename='$plotdirectory/$shortname.table.sorted';name='$plotdirectory/$corename'" $SCRIPTPATH/bar.gnuplot
rm $plotdirectory/$shortname
rm $plotdirectory/$shortname.table.sorted
echo
done
make distinctuseridcompetition
echo "parsing and finding all user.id"
echo
for i in $SCRIPTPATH/../jsonexamples/twitter.json; do
[ -f "$i" ] || break
echo $i
shortname=$(basename $SCRIPTPATH/$i"distinctuserid.table")
corename=$(basename ${shortname%.*})".pdf"
$SCRIPTPATH/../distinctuseridcompetition -t jsonexamples/twitter.json> $plotdirectory/$shortname
sort $plotdirectory/$shortname > $plotdirectory/$shortname.table.sorted
gnuplot -e "filename='$plotdirectory/$shortname.table.sorted';name='$plotdirectory/$corename'" $SCRIPTPATH/bar.gnuplot
rm $plotdirectory/$shortname
rm $plotdirectory/$shortname.table.sorted
echo
done
2018-12-19 11:48:24 +08:00
echo "see results in "$plotdirectory