The plot script now cleans up properly after a control-C.
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
log_file=data
gather_delay=1
log_file=data
gather_delay=1
# Plot settings
trunc_file=trunc_data
plot_samples=1000
# Plot settings
trunc_file=trunc_data
plot_samples=1000
# Gathering task
gather_data() {
i=0;
rm -f $log_file
# Gathering task
gather_data() {
i=0;
rm -f $log_file
+while [ ! -e $done_file ] ; do
str=$(cat /proc/yaffs_stats)
echo "$i, $str"
echo "$i, $str" >> $log_file
str=$(cat /proc/yaffs_stats)
echo "$i, $str"
echo "$i, $str" >> $log_file
+while [ ! -e $done_file ]; do
sleep $plot_delay
tail -$plot_samples $log_file > $trunc_file
echo replot
sleep $plot_delay
tail -$plot_samples $log_file > $trunc_file
echo replot
+rm -f $done_file
+trap "touch $done_file" INT
echo "Start gathering task in background"
gather_data &
echo "Run plotting task"
drive_gnuplot | gnuplot
echo "Start gathering task in background"
gather_data &
echo "Run plotting task"
drive_gnuplot | gnuplot
+wait
+
+echo "All done"
+