plot new data default tip
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Fri Jul 17 14:47:46 2009 +0100 (2009-07-17)
changeset 40147baa9b2a8b5b
parent 4013 44be7a0fe970
plot new data
utils/flowmon/plot.py
     1.1 --- a/utils/flowmon/plot.py	Fri Jul 17 10:28:57 2009 +0100
     1.2 +++ b/utils/flowmon/plot.py	Fri Jul 17 14:47:46 2009 +0100
     1.3 @@ -30,7 +30,7 @@
     1.4          n = len(a)
     1.5          m, se = mean(a), scipy.stats.stderr(a)
     1.6          # calls the inverse CDF of the Student's t distribution
     1.7 -        h = se * scipy.stats.t._ppf((1 + confidence)/2.0, n-1)
     1.8 +        h = se * scipy.stats.t._ppf((1 - confidence)/2.0, n-1)
     1.9          self._mean = m
    1.10          self._error = h
    1.11  
    1.12 @@ -78,6 +78,10 @@
    1.13                                 "True": True,
    1.14                                 "0": False,
    1.15                                 "False": False} [results_el.attrib['enable-monitor']]
    1.16 +        self.enable_tracing = {"1": True,
    1.17 +                               "True": True,
    1.18 +                               "0": False,
    1.19 +                               "False": False} [results_el.attrib['enable-tracing']]
    1.20          self.max_memory = long(results_el.attrib['max-memory'])
    1.21          self.num_nodes_side = int(results_el.attrib['num-nodes-side'])
    1.22          self.flows = [Flow(el) for el in results_el.findall('FlowMonitor/FlowStats/Flow')]
    1.23 @@ -225,6 +229,8 @@
    1.24      cpu_time_monitor = []
    1.25      memory_no_monitor = []
    1.26      memory_monitor = []
    1.27 +    memory_tracing = []
    1.28 +    cpu_time_tracing = []
    1.29  
    1.30      num_nodes_list = []
    1.31  
    1.32 @@ -247,14 +253,24 @@
    1.33          cpu_cv_monitor = ConfidenceValue()
    1.34          cpu_time_monitor.append(cpu_cv_monitor)
    1.35  
    1.36 +        memory_cv_tracing = ConfidenceValue()
    1.37 +        memory_tracing.append(memory_cv_tracing)
    1.38 +
    1.39 +        cpu_cv_tracing = ConfidenceValue()
    1.40 +        cpu_time_tracing.append(cpu_cv_tracing)
    1.41 +
    1.42          for sim in results.simulations:
    1.43              if sim.num_nodes_side == num_nodes_side:
    1.44                  if sim.enable_monitor:
    1.45                      memory_cv_monitor.add_sample(sim.max_memory)
    1.46                      cpu_cv_monitor.add_sample(sim.cpu_time)
    1.47                  else:
    1.48 -                    memory_cv_no_monitor.add_sample(sim.max_memory)
    1.49 -                    cpu_cv_no_monitor.add_sample(sim.cpu_time)
    1.50 +                    if sim.enable_tracing:
    1.51 +                        memory_cv_tracing.add_sample(sim.max_memory)
    1.52 +                        cpu_cv_tracing.add_sample(sim.cpu_time)
    1.53 +                    else:
    1.54 +                        memory_cv_no_monitor.add_sample(sim.max_memory)
    1.55 +                        cpu_cv_no_monitor.add_sample(sim.cpu_time)
    1.56  
    1.57      pylab.subplot(221)
    1.58      pylab.grid(False)
    1.59 @@ -266,13 +282,20 @@
    1.60          num_nodes_list,
    1.61          [val.mean for val in memory_no_monitor],
    1.62          #[val.error for val in memory_no_monitor],
    1.63 -        label="No Monitor", hold=True, linestyle='--')
    1.64 +        label="Base", hold=True, linestyle='--')
    1.65  
    1.66      pylab.plot(
    1.67          num_nodes_list,
    1.68          [val.mean for val in memory_monitor],
    1.69          #[val.error for val in memory_monitor],
    1.70 -        label="With Monitor", hold=True)
    1.71 +        label="Flow Monitor", hold=True)
    1.72 +
    1.73 +    pylab.plot(
    1.74 +        num_nodes_list,
    1.75 +        [val.mean for val in memory_tracing],
    1.76 +        #[val.error for val in memory_monitor],
    1.77 +        label="Trace File",  linestyle=':', hold=True)
    1.78 +
    1.79      pylab.legend(loc='best')
    1.80  
    1.81  
    1.82 @@ -286,13 +309,20 @@
    1.83          num_nodes_list,
    1.84          [val.mean for val in cpu_time_no_monitor],
    1.85          #[val.error for val in cpu_time_no_monitor],
    1.86 -        label="No Monitor", hold=True, linestyle='--')
    1.87 +        label="Base", hold=True, linestyle='--')
    1.88  
    1.89      pylab.plot(
    1.90          num_nodes_list,
    1.91          [val.mean for val in cpu_time_monitor],
    1.92          #[val.error for val in cpu_time_monitor],
    1.93 -        label="With Monitor", hold=True)
    1.94 +        label="Flow Monitor", hold=True)
    1.95 +
    1.96 +    pylab.plot(
    1.97 +        num_nodes_list,
    1.98 +        [val.mean for val in cpu_time_tracing],
    1.99 +        #[val.error for val in cpu_time_monitor],
   1.100 +        label="Trace File", linestyle=':', hold=True)
   1.101 +
   1.102      pylab.legend(loc='best')
   1.103  
   1.104      #pylab.show()
   1.105 @@ -303,21 +333,39 @@
   1.106      pylab.subplot(222)
   1.107      pylab.grid(False)
   1.108      pylab.xlabel("Number of Nodes")
   1.109 -    pylab.ylabel("Memory (monitoring overhead %)")
   1.110 +    pylab.ylabel("Memory Overhead (%)")
   1.111  
   1.112      pylab.plot(
   1.113          num_nodes_list,
   1.114 -        [100*(mon.mean / nomon.mean - 1) for nomon, mon in zip(memory_no_monitor, memory_monitor)])
   1.115 +        [100*(mon.mean / nomon.mean - 1) for nomon, mon in zip(memory_no_monitor, memory_monitor)],
   1.116 +        label="Flow Monitor",
   1.117 +        hold=True)
   1.118 +    pylab.plot(
   1.119 +        num_nodes_list,
   1.120 +        [100*(mon.mean / nomon.mean - 1) for nomon, mon in zip(memory_no_monitor, memory_tracing)],
   1.121 +        linestyle='--',
   1.122 +        label="Trace File",
   1.123 +        hold=True)
   1.124 +    pylab.legend(loc='best')
   1.125  
   1.126      pylab.subplot(224)
   1.127      pylab.grid(False)
   1.128      pylab.xlabel("Number of Nodes")
   1.129 -    pylab.ylabel("Time (monitoring overhead %)")
   1.130 +    pylab.ylabel("Time Overhead (%)")
   1.131  
   1.132      pylab.plot(
   1.133          num_nodes_list,
   1.134 -        [100*(mon.mean / nomon.mean - 1) for nomon, mon in zip(cpu_time_no_monitor, cpu_time_monitor)])
   1.135 +        [100*(mon.mean / nomon.mean - 1) for nomon, mon in zip(cpu_time_no_monitor, cpu_time_monitor)],
   1.136 +        label="Monitor",
   1.137 +        hold=True)
   1.138 +    pylab.plot(
   1.139 +        num_nodes_list,
   1.140 +        [100*(mon.mean / nomon.mean - 1) for nomon, mon in zip(cpu_time_no_monitor, cpu_time_tracing)],
   1.141 +        linestyle='--',
   1.142 +        label="Trace file",
   1.143 +        hold=True)
   1.144  
   1.145 +    pylab.legend(loc='best')
   1.146  
   1.147  
   1.148      print "Memory overhead: %.2f%% for %i nodes" % ([100*(mon.mean / nomon.mean - 1) for nomon, mon in zip(memory_no_monitor, memory_monitor)][-1], num_nodes_list[-1])