Revision 58324bdc

View differences:

examples/limit.py
8 8
from mininet.link import TCIntf
9 9
from mininet.node import CPULimitedHost
10 10
from mininet.topolib import TreeTopo
11
from mininet.util import custom
12
from mininet.log import setLogLevel
11
from mininet.util import custom, quietRun
12
from mininet.log import setLogLevel, info
13 13

  
14 14

  
15 15
def testLinkLimit( net, bw ):
16 16
    "Run bandwidth limit test"
17
    print '*** Testing network %.2f Mbps bandwidth limit' % bw
18
    net.iperf( )
19

  
17
    info( '*** Testing network %.2f Mbps bandwidth limit\n' % bw )
18
    net.iperf()
20 19

  
21 20
def limit( bw=10, cpu=.1 ):
22 21
    """Example/test of link and CPU bandwidth limits
......
25 24
    intf = custom( TCIntf, bw=bw )
26 25
    myTopo = TreeTopo( depth=1, fanout=2 )
27 26
    for sched in 'rt', 'cfs':
28
        print '*** Testing with', sched, 'bandwidth limiting'
27
        info( '*** Testing with', sched, 'bandwidth limiting\n' )
28
        if sched == 'rt':
29
            release = quietRun( 'uname -r' ).strip('\r\n')
30
            output = quietRun( 'grep CONFIG_RT_GROUP_SCHED /boot/config-%s' % release )
31
            if output == '# CONFIG_RT_GROUP_SCHED is not set\n':
32
                info( '*** RT Scheduler is not enabled in your kernel. Skipping this test\n' )
33
                continue
29 34
        host = custom( CPULimitedHost, sched=sched, cpu=cpu )
30 35
        net = Mininet( topo=myTopo, intf=intf, host=host )
31 36
        net.start()
mininet/node.py
606 606
        # still does better with larger period values.
607 607
        self.period_us = kwargs.get( 'period_us', 100000 )
608 608
        self.sched = sched
609
        if self.sched == 'rt':
610
            release = quietRun( 'uname -r' ).strip('\r\n')
611
            output = quietRun( 'grep CONFIG_RT_GROUP_SCHED /boot/config-%s' % release )
612
            if output == '# CONFIG_RT_GROUP_SCHED is not set\n':
613
                error( '\n*** error: please enable RT_GROUP_SCHED in your kernel\n' )
614
                exit( 1 )
609 615
        self.rtprio = 20
610 616

  
611 617
    def cgroupSet( self, param, value, resource='cpu' ):

Also available in: Unified diff