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:
Bob Lantz
2016-08-23 01:54:54 -07:00
parent 1eb6f65e40
commit ee15ce2243
18 changed files with 128 additions and 132 deletions
+4 -6
View File
@@ -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__':