Modify benchmark scenario to make it simpler to validate.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Fri May 22 13:30:16 2009 +0100 (8 months ago)
changeset 39964954fa717332
parent 3995 b6a5161b3149
child 3997 9d659361d1e1
Modify benchmark scenario to make it simpler to validate.
utils/flowmon/flowmon-bench.py
utils/flowmon/plot.py
     1.1 --- a/utils/flowmon/flowmon-bench.py	Thu May 21 17:22:41 2009 +0100
     1.2 +++ b/utils/flowmon/flowmon-bench.py	Fri May 22 13:30:16 2009 +0100
     1.3 @@ -59,7 +59,6 @@
     1.4      # -- create the topology --
     1.5  
     1.6      p2p = ns3.PointToPointHelper()
     1.7 -    p2p.SetDeviceAttribute("DataRate", ns3.StringValue("100kbps"))
     1.8      p2p.SetChannelAttribute("Delay", ns3.StringValue("0ms"))
     1.9  
    1.10      internet = ns3.InternetStackHelper()
    1.11 @@ -92,13 +91,17 @@
    1.12  
    1.13              if xi > 0:
    1.14                  node_left = nodes[yi][xi-1]
    1.15 +                if xi&1: # odd xi => 100 kbps
    1.16 +                    p2p.SetDeviceAttribute("DataRate", ns3.StringValue("100kbps"))
    1.17 +                else: # even xi => 50 kbps
    1.18 +                    p2p.SetDeviceAttribute("DataRate", ns3.StringValue("50kbps"))
    1.19                  devices = p2p.Install(ns3.NodeContainer(ns3.NodeContainer(node), ns3.NodeContainer(node_left)))
    1.20                  ipv4Addresses.Assign(devices)
    1.21  
    1.22 -            if yi > 0:
    1.23 -                node_above = nodes[yi-1][xi]
    1.24 -                devices = p2p.Install(ns3.NodeContainer(ns3.NodeContainer(node), ns3.NodeContainer(node_above)))
    1.25 -                ipv4Addresses.Assign(devices)
    1.26 +            #if yi > 0:
    1.27 +            #    node_above = nodes[yi-1][xi]
    1.28 +            #    devices = p2p.Install(ns3.NodeContainer(ns3.NodeContainer(node), ns3.NodeContainer(node_above)))
    1.29 +            #    ipv4Addresses.Assign(devices)
    1.30              
    1.31      def get_node_address(node):
    1.32          return node.GetObject(ns3.Ipv4.GetTypeId()).GetAddress(1)
    1.33 @@ -114,6 +117,10 @@
    1.34          for xi in xrange(num_nodes_side-flow_hops):
    1.35              #olsrHelper.Install(ns3.NodeContainer(node))
    1.36  
    1.37 +            # only select nodes multiples of flow_hops
    1.38 +            if xi % flow_hops != 0:
    1.39 +                continue
    1.40 +
    1.41              # flow from node (yi, xi) to (yi, xi+flow_hops)
    1.42              destaddr = get_node_address(nodes[yi][xi+flow_hops])
    1.43              onOffHelper.SetAttribute("Remote", ns3.AddressValue(ns3.InetSocketAddress(destaddr, port)))
     2.1 --- a/utils/flowmon/plot.py	Thu May 21 17:22:41 2009 +0100
     2.2 +++ b/utils/flowmon/plot.py	Fri May 22 13:30:16 2009 +0100
     2.3 @@ -108,11 +108,15 @@
     2.4          results.read_results_file(fname)
     2.5      print "Read %i simulations." % (len(results.simulations),)
     2.6  
     2.7 -    #performance_results(results)
     2.8 -    histograms(results, num_nodes_side=8)
     2.9 +    performance_results(results)
    2.10 +    histograms(results)
    2.11  
    2.12  
    2.13 -def histograms(results, num_nodes_side):
    2.14 +def histograms(results):
    2.15 +    num_nodes_side_set = list(set(sim.num_nodes_side for sim in results.simulations))
    2.16 +    num_nodes_side_set.sort()
    2.17 +    num_nodes_side = num_nodes_side_set[-1]
    2.18 +
    2.19      delays = array('d')
    2.20      losses = array('d')
    2.21      rx_bitrates = array('d')
    2.22 @@ -130,30 +134,32 @@
    2.23                  rx_bitrates.append(flow.rxBitrate)
    2.24              tx_bitrates.append(flow.txBitrate)
    2.25  
    2.26 +    print "Mean Tx bitrate: ", repr(sum(tx_bitrates) / len(tx_bitrates))
    2.27 +    print "Mean Rx bitrate: ", repr(sum(rx_bitrates) / len(rx_bitrates))
    2.28 +
    2.29      pylab.subplot(221)
    2.30      pylab.xlabel("Delay (s)")
    2.31      pylab.ylabel("Number of Flows")
    2.32 -    pylab.hist(delays, 20)
    2.33 +    pylab.hist(delays, 100)
    2.34  
    2.35      pylab.subplot(222)
    2.36      pylab.xlabel("Packet Loss Ratio")
    2.37      pylab.ylabel("Number of Flows")
    2.38 -    pylab.hist(losses, 20)
    2.39 +    pylab.hist(losses, 100)
    2.40  
    2.41      pylab.subplot(223)
    2.42      pylab.xlabel("Transmitted Bitrate (bit/s)")
    2.43      pylab.ylabel("Number of Flows")
    2.44 -    pylab.hist(tx_bitrates, 20)
    2.45 +    pylab.hist(tx_bitrates, 100)
    2.46  
    2.47      pylab.subplot(224)
    2.48      pylab.xlabel("Received Bitrate (bit/s)")
    2.49      pylab.ylabel("Number of Flows")
    2.50 -    pylab.hist(rx_bitrates, 20)
    2.51 +    pylab.hist(rx_bitrates, 100)
    2.52  
    2.53  
    2.54      pylab.show()
    2.55  
    2.56 -                              
    2.57  
    2.58  def performance_results(results):
    2.59      cpu_time_no_monitor = []