
###############################################


analyzeData - a set of solutions to a prior homework. The


analyzeData1.sh
analyzeData2.sh
getPingStatsStart.awk
getPingStatsWithAwk.sh
ping1.out
ping.rawdata


The following were from a different homework assignment.  The  runHW1.sh ran multiple 
runs of a program whose purpose was to measure the variation of delays in the system
as observed by a program trying to carry out precise timings.   
The runHW1.sh also runs octave using the plotDataPDF.m script.  This implementation
chose to run octave to compute the summary statistics that were required.
The program (referred to as 'unixTimingExamples) executable is hw1 - it had three parameters:
iterations blocksize linuxClockType .  The program accesses a block of data (defined by blocksize)- 
simply by  reading/writing the buffer. The time to read or write the block should increase linearly 
as the block size grows. The experiments were designed to detect non-linear jumps in the 
delay. The conjecture is that there are as the block size exceeds the various memory cache 
primarily at the hardware level.  

analyzeHW1.sh
plotDataPDF.m
runHW1.sh

      /usr/bin/octave --eval plotDataPDF.m |grep samples | \
        awk -v OFS='\t' '{print $1, $2, $3, $4, $5, $6, $7, $8}' \
              >> $results_file


this is an example data analysis script. It is intended to read a data file
that contains multiple results (one per line) with each result 
consisting of a number of fields.  The script parameters are:
analyzeData?.sh :
arguement 1:    input data file name
arguement 2:    field start delimiter
arguement 3:    field stop delimiter
arguement 4:    output (results) data file name

The specific example we use is produced by ping:
  'ping -c 1000 www.ces.clemson.edu > ping.rawdata' 

The rawdata format is the typical ping output ....
----begin example (limiting to -c 2)..
ping -c 2 www.ces.clemson.edu
PING pan.ces.clemson.edu (130.127.200.19) 56(84) bytes of data.
64 bytes from pan.ces.clemson.edu (130.127.200.19): icmp_seq=1 ttl=61 time=11.7 ms
64 bytes from pan.ces.clemson.edu (130.127.200.19): icmp_seq=2 ttl=61 time=15.0 ms

--- pan.ces.clemson.edu ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 11.757/13.379/15.001/1.622 ms
---- end example..

The specific problem was to get the RTT samples in a separate file (ping.dat) 
and then to compute a set of statistics.  

We want the analysis script to analyze a data file such as ping.rawdata allowing
use to specify which field we are interested in.

Example using the ping (2 RTT samples) shown above (input in ping.rawdata) - 
to pull out just the rtt sample, the begin delimiter is 'time=' and the end delim is a space.
./analyzeData.sh ping.rawdata time= ' ms' ping.dat

The first several lines of ping.rawdata are:
PING www.google.com (74.125.30.103) 56(84) bytes of data.
64 bytes from of-in-f103.1e100.net (74.125.30.103): icmp_req=8 ttl=38 time=122 ms
64 bytes from of-in-f103.1e100.net (74.125.30.103): icmp_req=10 ttl=38 time=81.8 ms


The first several lines of ping.dat are:
122
81.8


To plot the PDF of the ping time series data:

-run plotPDF.m in matlab. It is set to load the data file ping.dat.
-If you want to run on octave:
  1. sudo apt-get install octave
  2. to start octave in gui mode,  octave --force-gui   
  3  the go to the directory with plotPDF and run         

      /usr/bin/octave --eval plotDataPDF.m |grep samples | \
        awk -v OFS='\t' '{print $1, $2, $3, $4, $5, $6, $7, $8}' \
              >> $results_file
###############################################

findMean.script  :  a script that takes a single parameter specifying an input file.
                   The script calls findMean.awk which computes the mean of field 1
                   of the data file.

###############################################



