Revision 32de4c9e

View differences:

examples/consoles.py
315 315

  
316 316
    def updateGraph( self, _console, output ):
317 317
        "Update our graph."
318
        output = output.split('\n')[ 0 ]
319
        vals = output.split(',')
320
        if not len(vals) == 9:
318
        m = re.search( r'(\d+.?\d*) ([KMG]?bits)/sec', output )
319
        if not m:
321 320
            return
322
        self.updates += 1
321
        val, units = float( m.group( 1 ) ), m.group( 2 )
323 322
        #convert to Gbps
324
        self.bw +=  int( vals[-1] ) * ( 10 ** -9 )
323
        if units[0] == 'M':
324
            val *= 10 ** -3
325
        elif units[0] == 'K':
326
            val *= 10 ** -6
327
        elif units[0] == 'b':
328
            val *= 10 ** -9
329
        self.updates += 1
330
        self.bw +=  val
325 331
        if self.updates >= self.hostCount:
326 332
            self.graph.addBar( self.bw )
327 333
            self.bw = 0
......
418 424
        for console in consoles:
419 425
            i = ( i + 1 ) % count
420 426
            ip = consoles[ i ].node.IP()
421
            console.sendCmd( 'iperf -t 99999 -i 1 -y c -c ' + ip )
427
            console.sendCmd( 'iperf -t 99999 -i 1 -c ' + ip )
422 428

  
423 429
    def stop( self, wait=True ):
424 430
        "Interrupt all hosts."

Also available in: Unified diff