#!/usr/bin/env gnuplot # script works on gnuplot 4.6 patchlevel 1 # if this script is called with a filename argument: # $ gnuplot -e "filename='somefile.csv'" traceLogGraph.gp # then it will automatically plot a .png file # if it called inside gnuplot interpreter, via # gnuplot> load 'traceLogGraph.gp' # it will load whatever filename (below) is uncommented; # and show it in wxt terminal # other options # gnuplot -e "filename='somefile.csv';fnnum='02';exr='[2:3]';eyr='[2:3]';" traceLogGraph.gp if (! exists("fnnum")) \ fnnum='' ; # do not call reset/clear if filename (for batch .png) is passed! if (! exists("filename")) \ reset ; \ clear ; \ rep="no filename argument - using wxt terminal and hardcoded input: " ; \ set terminal wxt font 'Arial,10' ; \ else \ rep="got filename argument - using png terminal: " ; \ set terminal pngcairo font 'Arial,10' size 1000,500 ; \ set output filename . "_" . fnnum . ".png" ; \ #~ show output # new style "if" here; which supports multiline if{} - gnuplot > 4.4 # so the hardcoded values can be easily (un)commented if browsing in wxt # you should first run `run-alsa-pa-tests.sh`; to obtain .csv captures; # then paste them below, (un)comment accordingly; # and edit below in the conditional plots, so captures with drops are plotted correctly if (! exists("filename")) { #~ filename = "captures/trace_patest__01_xA_pr_0.csv" ; #~ filename = "captures/trace_patest__02_xA_pr_512.csv" ; #~ filename = "captures/trace_patest__03_xA_w_0_drop.csv" ; #~ filename = "captures/trace_patest__04_xA_w_512.csv" ; #~ filename = "captures/trace_patest__05_DA_pr_0.csv" ; #~ filename = "captures/trace_patest__06_DA_pr_512.csv" ; #~ filename = "captures/trace_patest__07_DA_w_0_drop.csv" ; filename = "captures/trace_patest__08_DA_w_512.csv" ; #~ filename = "captures/trace_patest__09_xF_pr_0.csv" ; #~ filename = "captures/trace_patest__10_xF_pr_512.csv" ; #~ filename = "captures/trace_patest__11_xF_w_0_drop.csv" ; #~ filename = "captures/trace_patest__12_xF_w_512.csv" ; #~ filename = "captures/trace_patest__13_DF_pr_0.csv" ; #~ filename = "captures/trace_patest__14_DF_pr_512.csv" ; #~ filename = "captures/trace_patest__15_DF_w_0_drop.csv" ; #~ filename = "captures/trace_patest__16_DF_w_512_drop.csv" ; } rep = rep . filename . " (_" . fnnum . ")" print rep # CSV data; must set: set datafile separator "," # colors - see: # http://www.uni-hamburg.de/Wiss/FB/15/Sustainability/schneider/gnuplot/colors.htm # blueish hues for playback driver (driver - timer/tasklet) set style line 1 linetype 1 linewidth 1 pointtype 3 linecolor rgb "aquamarine" set style line 2 linetype 1 linewidth 1 pointtype 3 linecolor rgb "blue" set style line 3 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#8A2BE2" #"blueviolet" set style line 4 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#5F9EA0" #"cadetblue" set style line 5 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#6495ED" #"cornflowerblue" # reddish hues for capture (driver - timer/tasklet) set style line 11 linetype 1 linewidth 1 pointtype 3 linecolor rgb "coral" set style line 12 linetype 1 linewidth 1 pointtype 3 linecolor rgb "red" set style line 13 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#DC143C" #"crimson" set style line 14 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#8B0000" #"darkred" set style line 15 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#FF8C00" #"darkorange" # greenish hues for CallbackThreadFunc (frgbtc, frgbtp, frabCC, frabPC) set style line 21 linetype 1 linewidth 1 pointtype 3 linecolor rgb "green" set style line 22 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#006400" #"darkgreen" set style line 23 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#8FBC8F" #"darkseagreen" set style line 24 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#556B2F" #"darkolivegreen" # yellowish hues for PaAlsaStream_WaitForFrames (frabCW, frabPW) set style line 31 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#AAAA00" # darkish yellow set style line 32 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#FFD700" #"gold" # black/gray for PaAlsaStream_WaitForFrames drop-inputs (pawDropIn) set style line 41 linetype 1 linewidth 1 pointtype 3 linecolor rgb "black" set style line 42 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#AAAAAA" # gray # magentaish for PACallbacks: set style line 51 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#FF00FF" # magenta set style line 52 linetype 1 linewidth 1 pointtype 3 linecolor rgb "#BA55D3" # mediumorchid # must call extern script (awk) to split data at runtime, # so the lines are fully rendered between respective points! # awk -F, '{if($3 == 1){print $0}}' file.csv filename1 = "