Revision 97381a53

View differences:

conf/peerstreamer.ini
97 97
[PSNetLoadNodes]
98 98
testModule = peerstreamer
99 99
testClass = PSXLOptimizationNTest
100
duration = 300
101
times = 30
102
graphDefinition = LeoNets/FFGraz0.edges
100
duration = 600
101
times = 10
102
graphDefinition = LeoNets/ninux0.edges
103 103
chunks_per_second = 38
104
neigh_size = 10
104
neigh_size = 5
105 105
chunks_per_offer = 1
106
log_chunks = 0
107
log_neighbourhood = 1
106
log_chunks = 1
107
log_neighbourhood = 0
108 108
log_signals = 0
109 109
source_chunk_multiplicity = 1
110 110
push_strategy = 0
111
aframe_per_chunk = 1
111
aframe_per_chunk = 5
112 112
min_nodes_num = 5
113 113
max_nodes_num = 30 
114 114
nodes_num_inc = 5 
115 115

  
116
[PSRAND]
116
[PSNRAND]
117 117
testModule = peerstreamer
118
testClass = PSRandomTest
119
graphDefinition = LeoNets/FFGraz0.edges
120
duration = 600
118
testClass = PSRandomNTest
119
graphDefinition = LeoNets/ninux0.edges
120
duration = 364
121 121
num_peers = 30
122 122
neigh_size = 10
123
times = 1
123
times = 10
124 124
distoptimization = 0
125
xloptimization = 1
126
chunks_per_second = 38
127
chunks_per_offer = 5
125
xloptimization = 0
126
chunks_per_second = 175
127
chunks_per_offer = 30
128 128
log_chunks = 1
129 129
log_signals = 0
130 130
log_neighbourhood = 0
131
source_chunk_multiplicity = 3
132
push_strategy = 1
131
source_chunk_multiplicity = 1
132
push_strategy = 0
133 133
aframe_per_chunk = 5
134
chunk_buffer_size = 50
134
chunk_buffer_size = 200
135 135
link_bw = 10
136
link_mean_delay = 0.515ms
137
link_delay_sd = 0.284ms
138
link_delay_distribution = wifi_m0.515_s0.284
136
link_mean_delay = 8.0658ms
137
link_delay_sd = 55.7166ms
138
link_delay_distribution = qmp_delay_m8.0658_s55.7166
139 139
link_loss = wifi_loss
140
min_nodes_num = 10
141
max_nodes_num = 30
142
nodes_num_inc = 5
140 143

  
141 144
[PSConf1]
142 145
testModule = peerstreamer
src/peerstreamer.py
37 37
        params = {}
38 38
        params['-i'] = source.defaultIntf().ip
39 39
        params['-I'] = host.defaultIntf().name
40
        params['-p'] = self.source_opt_params['-P'] 
40
        params['-p'] = self.source_opt_params['-P']
41 41
        params['-P'] = str(randint(4000,8000))
42 42
        return self.launchPS(host,params,'/dev/null',logfile)
43 43

  
......
67 67
            self.source_opt_params['-P'] = str(7000)
68 68
        if "push_strategy" in conf_args:
69 69
            if conf_args["push_strategy"] != "0":
70
                self.peer_opt_params['--push_strategy'] = "" 
70
                self.peer_opt_params['--push_strategy'] = ""
71 71

  
72 72

  
73 73
        if "chunks_per_second" in conf_args:
......
82 82
            self.peer_opt_params['-b'] = conf_args["chunk_buffer_size"]
83 83
        if "log_chunks" in conf_args:
84 84
            if conf_args["log_chunks"] != "0":
85
                self.peer_opt_params['--chunk_log'] = "" 
85
                self.peer_opt_params['--chunk_log'] = ""
86 86
        if "log_neighbourhood" in conf_args:
87 87
            if conf_args["log_neighbourhood"] != "0":
88
                self.peer_opt_params['--neighbourhood_log'] = "" 
88
                self.peer_opt_params['--neighbourhood_log'] = ""
89 89
        if "log_signals" in conf_args:
90 90
            if conf_args["log_signals"] != "0":
91
                self.peer_opt_params['--signal_log'] = "" 
91
                self.peer_opt_params['--signal_log'] = ""
92 92
        if "distoptimization" in conf_args:
93 93
            if conf_args["distoptimization"] != "0":
94
                self.peer_opt_params['--distoptimization'] = "" 
94
                self.peer_opt_params['--distoptimization'] = ""
95 95
        if "xloptimization" in conf_args:
96 96
            if conf_args["xloptimization"] != "0":
97
                self.peer_opt_params['--xloptimization'] =  conf_args["xloptimization"] 
97
                self.peer_opt_params['--xloptimization'] =  conf_args["xloptimization"]
98 98

  
99 99

  
100 100
    def runTest(self):
......
106 106
        for h in self.hosts:
107 107
            self.launchPeer(h,self.source)
108 108
        info("\nWaiting completion...\n")
109
        sleep(self.duration)
109
        self.wait(self.duration, log_resources={'cpu': 'cpu_usage',
110
                                                'mem': 'mem_usage',
111
                                                'net': 'net_usage'})
110 112

  
111 113
        self.killAll()
112 114

  
......
129 131
            self.source = self.hosts.pop()
130 132
        self.setPrefix(name)
131 133

  
134

  
135
class PSRandomNTest(PSRandomTest):
136
    def __init__(self, mininet, name, args):
137
        args["num_peers"] = "0"
138
        super(PSRandomNTest,self).__init__(mininet,name,args)
139
        self.min_nodes = int(args["min_nodes_num"])
140
        self.max_nodes = int(args["max_nodes_num"])
141
        self.nodes_inc = int(args["nodes_num_inc"])
142

  
143
    def setTestLabel(self,s):
144
        self.test_label = s + "-"+str(len(self.hosts)+1)+"peers"
145

  
146
    def runTest(self):
147
        for n in range(self.min_nodes,self.max_nodes + 1,self.nodes_inc):
148
            self.hosts = self.getHostSample(n)
149
            self.source = self.hosts.pop()
150
            self.setTestLabel("normal")
151
            super(PSRandomTest,self).runTest()
152

  
153

  
132 154
class PSXLOptimizationTest(PSRandomTest):
133 155
    def __init__(self, mininet, name, args):
134 156
        super(PSXLOptimizationTest,self).__init__(mininet,name,args)
......
166 188
                    else:
167 189
                        sp.write("\n")
168 190
        sp.close()
169
        
191

  
170 192
    def resetNetStatistics(self):
171 193
        self.sent_packets, self.sent_bytes = self.net.sentPackets() # base value
172 194
        self.links = {}
......
180 202
            return (sum(values)**2)/den
181 203
        else:
182 204
            return 0
183
        
205

  
184 206
    def get_stats(self):
185 207
        links = self.bytes_per_link()
186 208

  
......
202 224
        return linkos
203 225

  
204 226
    def sentPackets(self):
205
        sp,sb = self.net.sentPackets() 
227
        sp,sb = self.net.sentPackets()
206 228
        return sp - self.sent_packets
207 229

  
208 230
    def runTest(self):
......
249 271
#        fp.write("SCALED," + str(self.scaled_res[0]) + "," + str(self.scaled_res[1]))
250 272
#        fp.write("\n")
251 273
        fp.close()
252
        
274

  
253 275

  
254 276
class PSXLOptimizationNTest(PSXLOptimizationTest):
255 277
    def __init__(self, mininet, name, args):

Also available in: Unified diff