%description: Test scavetool's export command's options. This test des not cover the exporters themselves! %file: test.ned simple Node extends testlib.StatNode { @statistic[foo](source=foo; record=mean,last,stats,histogram,vector); } network Test { submodules: node: Node; } %inifile: omnetpp.ini [General] network = Test repeat = 2 %prerun-command: rm -f results/* %postrun-command: bash ./testscript.sh %file: testscript.sh # # Replace datetime and processId with "xxxx" in the result files, as they are different all the time # for f in results/*; do perl -i -pe 's/(run General-.)-.*/\1-xxxx/' $f perl -i -pe 's/(attr datetime ).*/\1 xxxx/' $f perl -i -pe 's/(attr processid ).*/\1 xxxx/' $f done # # scavetool wrapper, for output, error handling and shorter command lines # run() { echo "---------------------------------------------------------------" echo "$ scavetool $* " scavetool "$@" ../results/General-*.sca ../results/General-*.vec 2>&1 || echo ERROR } rm -rf export mkdir export cd export # # List brief content of files, just for reference # run q run q -l # # Plain invocations (format is deduced from file name) # run export # -> error, -o is mandatory run x # -> error, -o is mandatory # # -o Output file name, or '-' for the standard output. This option is mandatory. # run x -o out.csv run x -o out.json run x -o out.vec -Tv #ERROR: multiple runs per vector file not supported run x -o out.vec -Tv -f 'attr:repetition(0)' #OK run x -o out.sca -Tsth # # -F Selects the exporter. # # Smoke-test the known export formats run x -o out-Fcsv-r.csv -F CSV-R run x -o out-Fcsv-s.csv -F CSV-S -x allowMixed=true run x -o out-Fjson.json -F JSON run x -o out-Fjson-py.py -F JSON -x pythonFlavoured=true run x -o out-Foppvec.vec -F OmnetppVectorFile -Tv #ERROR: multiple runs per vector file not supported run x -o out-Foppvec.vec -F OmnetppVectorFile -Tv -f 'attr:repetition(0)' #OK run x -o out-Foppsca.sca -F OmnetppScalarFile -Tsth run x -o out-Fsqlvec.vec -F SqliteVectorFile -Tv run x -o out-Fsqlsca.sca -F SqliteScalarFile -Tsth # # -T, --type Limit item types; is concatenation of type characters (v=vector, s=scalar, t=statistic, h=histogram). # run x -o out-Ts.csv -Ts run x -o out-Tt.csv -Tt run x -o out-Th.csv -Th run x -o out-Tv.csv -Tv run x -o out-Tsh1.csv -Tsh run x -o out-Tsv2.csv -T scalars,vectors run x -o out-Tsh3.csv --type sh run x -o out-Tsv4.csv --type scalars,vectors # # -f, --filter Filter for result items (vectors, scalars, statistics, histograms) matched by filter expression # run x -o out-f1.csv --filter '*:vector' run x -o out-f2.csv -f '*:vector' # # -w, --add-fields-as-scalars Add statistics fields (count, sum, mean, stddev, min, max, etc) as scalars # run x -o out-w1.csv -Tsth --add-fields-as-scalars run x -o out-w2.csv -Tsth -w # # -x = Option for the exporter. This option may occur multiple times. # run x -o out-x.csv -x separator=tab -x quoteEscaping=backslash # # -k, --no-indexing Disallow automatic indexing of vector files # run x -o out-k1.vec -Tv -k #ERROR: multiple runs per vector file not supported run x -o out-k2.vec -Tv --no-indexing #ERROR: multiple runs per vector file not supported run x -o out-k1.vec -Tv -k -f 'attr:repetition(0)' #OK run x -o out-k2.vec -Tv --no-indexing -f 'attr:repetition(0)' #OK # # -v, --verbose Print info about progress (verbose) # run x -o out-v1.csv -v run x -o out-v2.csv --verbose # # Crude check: verify that the exported files are well-formed # echo =============================================================== files=$(ls *.sca *.vec -1 | sort -d) for f in $files; do echo '$ scavetool' $f scavetool $f 2>&1 || echo ERROR done #for f in *.py; do # echo '$ python' $f # python $f 2>&1 || echo ERROR #done echo . %contains: postrun-command(1).out --------------------------------------------------------------- $ scavetool q runs: 2 scalars: 4 vectors: 2 statistics: 2 histograms: 2 --------------------------------------------------------------- $ scavetool q -l General-0-xxxx: scalar Test.node foo:mean 19.84 scalar Test.node foo:last 17 vector Test.node foo:vector vectorId=0 count=100 mean=19.84 min=12 max=28 statistics Test.node foo:stats count=100 mean=19.84 min=12 max=28 histogram Test.node foo:histogram count=100 mean=19.84 min=12 max=28 #bins=26 General-1-xxxx: scalar Test.node foo:mean 19.65 scalar Test.node foo:last 19 vector Test.node foo:vector vectorId=0 count=100 mean=19.65 min=13 max=27 statistics Test.node foo:stats count=100 mean=19.65 min=13 max=27 histogram Test.node foo:histogram count=100 mean=19.65 min=13 max=27 #bins=24 --------------------------------------------------------------- $ scavetool export scavetool: Output file name must be specified (-o option) ERROR --------------------------------------------------------------- $ scavetool x scavetool: Output file name must be specified (-o option) ERROR --------------------------------------------------------------- $ scavetool x -o out.csv Exported 4 scalars, 2 vectors, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out.json Exported 4 scalars, 2 vectors, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out.vec -Tv scavetool: Exporter: OMNeT++ vec files currently do not support multiple runs per file ERROR --------------------------------------------------------------- $ scavetool x -o out.vec -Tv -f attr:repetition(0) Exported 1 vector --------------------------------------------------------------- $ scavetool x -o out.sca -Tsth Exported 4 scalars, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-Fcsv-r.csv -F CSV-R Exported 4 scalars, 2 vectors, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-Fcsv-s.csv -F CSV-S -x allowMixed=true Exported 4 scalars, 2 vectors, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-Fjson.json -F JSON Exported 4 scalars, 2 vectors, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-Fjson-py.py -F JSON -x pythonFlavoured=true Exported 4 scalars, 2 vectors, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-Foppvec.vec -F OmnetppVectorFile -Tv scavetool: Exporter: OMNeT++ vec files currently do not support multiple runs per file ERROR --------------------------------------------------------------- $ scavetool x -o out-Foppvec.vec -F OmnetppVectorFile -Tv -f attr:repetition(0) Exported 1 vector --------------------------------------------------------------- $ scavetool x -o out-Foppsca.sca -F OmnetppScalarFile -Tsth Exported 4 scalars, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-Fsqlvec.vec -F SqliteVectorFile -Tv Exported 2 vectors --------------------------------------------------------------- $ scavetool x -o out-Fsqlsca.sca -F SqliteScalarFile -Tsth Exported 4 scalars, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-Ts.csv -Ts Exported 4 scalars --------------------------------------------------------------- $ scavetool x -o out-Tt.csv -Tt Exported 2 statistics --------------------------------------------------------------- $ scavetool x -o out-Th.csv -Th Exported 2 histograms --------------------------------------------------------------- $ scavetool x -o out-Tv.csv -Tv Exported 2 vectors --------------------------------------------------------------- $ scavetool x -o out-Tsh1.csv -Tsh Exported 4 scalars, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-Tsv2.csv -T scalars,vectors Exported 4 scalars, 2 vectors --------------------------------------------------------------- $ scavetool x -o out-Tsh3.csv --type sh Exported 4 scalars, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-Tsv4.csv --type scalars,vectors Exported 4 scalars, 2 vectors --------------------------------------------------------------- $ scavetool x -o out-f1.csv --filter *:vector Exported 2 vectors --------------------------------------------------------------- $ scavetool x -o out-f2.csv -f *:vector Exported 2 vectors --------------------------------------------------------------- $ scavetool x -o out-w1.csv -Tsth --add-fields-as-scalars Exported 28 scalars, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-w2.csv -Tsth -w Exported 28 scalars, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-x.csv -x separator=tab -x quoteEscaping=backslash Exported 4 scalars, 2 vectors, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-k1.vec -Tv -k scavetool: Exporter: OMNeT++ vec files currently do not support multiple runs per file ERROR --------------------------------------------------------------- $ scavetool x -o out-k2.vec -Tv --no-indexing scavetool: Exporter: OMNeT++ vec files currently do not support multiple runs per file ERROR --------------------------------------------------------------- $ scavetool x -o out-k1.vec -Tv -k -f attr:repetition(0) Exported 1 vector --------------------------------------------------------------- $ scavetool x -o out-k2.vec -Tv --no-indexing -f attr:repetition(0) Exported 1 vector --------------------------------------------------------------- $ scavetool x -o out-v1.csv -v inferred export format from file name: CSV-R reading ../results/General-#0.sca... done reading ../results/General-#1.sca... done reading ../results/General-#0.vec... done reading ../results/General-#1.vec... done 4 file(s) loaded exporting to out-v1.csv... done Exported 4 scalars, 2 vectors, 2 statistics, 2 histograms --------------------------------------------------------------- $ scavetool x -o out-v2.csv --verbose inferred export format from file name: CSV-R reading ../results/General-#0.sca... done reading ../results/General-#1.sca... done reading ../results/General-#0.vec... done reading ../results/General-#1.vec... done 4 file(s) loaded exporting to out-v2.csv... done Exported 4 scalars, 2 vectors, 2 statistics, 2 histograms =============================================================== $ scavetool out-Foppsca.sca runs: 2 scalars: 4 vectors: 0 statistics: 2 histograms: 2 $ scavetool out-Foppvec.vec runs: 1 scalars: 0 vectors: 1 statistics: 0 histograms: 0 $ scavetool out-Fsqlsca.sca runs: 2 scalars: 4 vectors: 0 statistics: 2 histograms: 2 $ scavetool out-Fsqlvec.vec runs: 2 scalars: 0 vectors: 2 statistics: 0 histograms: 0 $ scavetool out-k1.vec runs: 1 scalars: 0 vectors: 1 statistics: 0 histograms: 0 $ scavetool out-k2.vec runs: 1 scalars: 0 vectors: 1 statistics: 0 histograms: 0 $ scavetool out.sca runs: 2 scalars: 4 vectors: 0 statistics: 2 histograms: 2 $ scavetool out.vec runs: 1 scalars: 0 vectors: 1 statistics: 0 histograms: 0 .