|
From: Viallard A. <via...@sy...> - 2013-03-06 09:28:28
|
Hi there,
I see a weird thing with gnuplot.
I make plot of datas given by a velocity sensor. For each sample, there
are 3 values of 8 Bytes.
Earlier, the plot was made using a homemade utility to convert binary
values to ascii. These ascii datas were put into a file which was used
by gnuplot. It was the easier solution for me.
As this process take some time, I've try to do the same plot directly
with the binary file. I guessed it will be faster to make plot. And one
day (actually, it's today), after a lot of manual reading and some weird
troubles, I've successfuly done this.
After a party for celebrate my little victory, I do a time performance
check and I'm disapointed about the results. Here the output
(plot-txt.sh do the first solution, plot.sh do the binary solution) :
--------------------------------------------------
# time /usr/bin/plot-txt.sh /tmp/event-dclPWz
Generating plot '/tmp/test-txt.png' done !
real 0m 36.99s
user 0m 13.15s
sys 0m 2.95s
# time /usr/bin/plot.sh /tmp/event-dclPWz
Generating plot '/tmp/test.png' done
real 0m 44.37s
user 0m 12.19s
sys 0m 11.09s
--------------------------------------------------
Binary solution is slower than ascii ! It's sad.
How this can be possible ?
Here my "binary plot" script :
--------------------------------------------------
set terminal png linewidth 1 interlace size 800,600
set output "/tmp/test.png"
set title ' signals / time'
set xlabel ' Time (s) '
set ylabel ' Signals (mm/s) '
set xdata time
#set timefmt "%S"
set label "Peak : X=14.6 Y=10.4 Z=0.248" at graph 0.05,0.05
set grid
set style data lines
inscale(r)=(r*100)
genx(i)=(i*(1.0/1000))
set xrange [0:(2620*1.0/1000)]
plot \
"/tmp/event-dclPWz" binary skip=512 format="%lf%*lf%*lf" using
(genx($0)):(inscale($1)) title "X" with lines,\
"" binary skip=512 format="%*lf%lf%*lf" using
(genx($0)):(inscale($1)) title "Y" with lines,\
"" binary skip=512 format="%*lf%*lf%lf" using
(genx($0)):(inscale($1)) title "Z" with lines
--------------------------------------------------
There a way to improve efficiency of this script ? Why does binary plot
take more time ?
Anthony V.
--
.-------------------.-----------------------.-------------------.
| Viallard Anthony | Syscom Instruments SA | Embedded System |
| +41 024 455 24 82 | Rue de l'industrie 21 | Software Designer |
| ~~~~~~~~~~~~~~~~~ | 1450 Sainte-Croix | ~~~~~~~~~~~~~~~~~ |
'-------------------^-----------------------^-------------------^
|