print -> info; end the horror of print vs. print()
Although we could use print() from __future__, this messes up scripts which use examples as modules. The simple, if not nicest for 2.7, solution is to use info(), output() and other mininet.log functions. The disadvantage is that we may have to adjust things if we change info() to add automatic newlines, but we can burn that bridge in Mininet 3.x.
This commit is contained in:
1 parent
1eb6f65e40
commit
ee15ce2243
18 files changed
+128
-132
No files matched your search
+4
-6
@@ -21,7 +21,7 @@ def bwtest( cpuLimits, period_us=100000, seconds=5 ):
|
||||
results = {}
|
||||
|
||||
for sched in 'rt', 'cfs':
|
||||
print( '*** Testing with', sched, 'bandwidth limiting' )
|
||||
info( '*** Testing with', sched, 'bandwidth limiting\n' )
|
||||
for cpu in cpuLimits:
|
||||
host = custom( CPULimitedHost, sched=sched,
|
||||
period_us=period_us,
|
||||
@@ -53,18 +53,16 @@ def bwtest( cpuLimits, period_us=100000, seconds=5 ):
|
||||
def dump( results ):
|
||||
"Dump results"
|
||||
|
||||
fmt = '%s\t%s\t%s'
|
||||
fmt = '%s\t%s\t%s\n'
|
||||
|
||||
print()
|
||||
print( fmt % ( 'sched', 'cpu', 'client MB/s' ) )
|
||||
print()
|
||||
info( '\n', fmt % ( 'sched', 'cpu', 'client MB/s' ) )
|
||||
|
||||
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 ) )
|
||||
info( fmt % ( sched, pct, mbps ) )
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in new issue
Block a user