Use print function

This commit is contained in:
Brad Walker
2016-06-21 16:27:04 -07:00
committed by Bob Lantz
parent 57abd9baef
commit 70fcc45893
25 changed files with 189 additions and 141 deletions
+7 -5
View File
@@ -4,6 +4,8 @@
cpu.py: test iperf bandwidth for varying cpu limits
"""
from __future__ import print_function
from mininet.net import Mininet
from mininet.node import CPULimitedHost
from mininet.topolib import TreeTopo
@@ -20,7 +22,7 @@ def bwtest( cpuLimits, period_us=100000, seconds=5 ):
results = {}
for sched in 'rt', 'cfs':
print '*** Testing with', sched, 'bandwidth limiting'
print( '*** Testing with', sched, 'bandwidth limiting' )
for cpu in cpuLimits:
host = custom( CPULimitedHost, sched=sched,
period_us=period_us,
@@ -54,16 +56,16 @@ def dump( results ):
fmt = '%s\t%s\t%s'
print
print fmt % ( 'sched', 'cpu', 'client MB/s' )
print
print()
print( fmt % ( 'sched', 'cpu', 'client MB/s' ) )
print()
for sched in sorted( results.keys() ):
entries = results[ sched ]
for cpu, bps in entries:
pct = '%.2f%%' % ( cpu * 100 )
mbps = bps / 1e6
print fmt % ( sched, pct, mbps )
print( fmt % ( sched, pct, mbps ) )
if __name__ == '__main__':