Ignore:
Timestamp:
11/21/18 09:57:30 (2 years ago)
Author:
Jacob Van Walraven <jcv9@…>
Branches:
develop
Children:
158519c
Parents:
5c46b9c
Message:

Remove unneeded code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/stats/ipdist-genplot.py

    ra7132cf r5dba5e7  
    4747                total_skew_dst[x] += float(lines[(4*x)+2].split()[6])
    4848
     49
    4950        # Create/append to timeseries stats file
    5051        # the file needs to be created on the first pass
     
    6162
    6263
    63 
    6464        # open data file to read from and count all occurances
    6565        with open(dir + "/" + dataFile, "r") as tmp:
    6666                lines = tmp.readlines()
    6767        tmp.close()
    68         # Count up all octet count in current data file
     68        # create arrays to hold counts
    6969        count_src = [0] * 4
    7070        count_dst = [0] * 4
    71         # initialize the array
     71        # count all octet counts in the current data file
    7272        for x in range(4):
    7373                count_src[x] = [0] * 256
     
    7878                        count_src[k][int(lines[x+2].split()[(k*4)+2])] = int(lines[x+2].split()[(k*4)+3])
    7979                        count_dst[k][int(lines[x+2].split()[(k*4)+4])] = int(lines[x+2].split()[(k*4)+5])
    80         # output the results to the timeseries files
    81         tmp_src = []
    82         tmp_dst = []
    83         if i == 0:
    84                 for x in range(4):
    85                         tmp_src.append(open(dir + "/ipdist-src-octet" + str(x+1) + ".timeseries", "w"))
    86                         tmp_dst.append(open(dir + "/ipdist-dst-octet" + str(x+1) + ".timeseries", "w"))
    87                         tmp_src[x].write("timestamp")
    88                         tmp_dst[x].write("timestamp")
    89                         for k in range(256):
    90                                 tmp_src[x].write("\t" + str(k))
    91                                 tmp_dst[x].write("\t" + str(k))
    92         else:
    93                 for x in range(4):
    94                         tmp_src.append(open(dir + "/ipdist-src-octet" + str(x+1) + ".timeseries", "a"))
    95                         tmp_dst.append(open(dir + "/ipdist-dst-octet" + str(x+1) + ".timeseries", "a"))
    96         # print data into file
    97         for x in range(4):
    98                 tmp_src[x].write("\n" + tick)
    99                 tmp_dst[x].write("\n" + tick)
    100                 for k in range(256):
    101                         tmp_src[x].write("\t" + str(count_src[x][k]))
    102                         tmp_dst[x].write("\t" + str(count_dst[x][k]))
    103         # close all files
    104         for x in range(4):
    105                 tmp_src[x].close()
    106                 tmp_dst[x].close()
     80
    10781
    10882        # create tmp file for cdf plots
     
    133107                                tmp.write(str(normalise(min_src, max_src, total_src)) + "\t" + str(i) + "\t" + str(normalise(min_dst, max_dst, total_dst)) + "\t" + str(i) + "\n")
    134108                        tmp.write("\n\n")
     109
    135110
    136111        # create interval plots
     
    187162                plot.communicate()
    188163
     164
    189165# Generate plots for the timeseries data captured over the entire trace
    190166for i in range(4):
     
    257233# skew file
    258234os.remove(dir + "/ipdist-timeseries-skewness.stats")
    259 # timeseries files
    260 for x in range(4):
    261         os.remove(dir + "/ipdist-dst-octet" + str(x+1) + ".timeseries")
    262         os.remove(dir + "/ipdist-src-octet" + str(x+1) + ".timeseries")
Note: See TracChangeset for help on using the changeset viewer.