MCPcopy Create free account
hub / github.com/mininet/mininet / setCPUs

Method setCPUs

mininet/node.py:850–865  ·  view source on GitHub ↗

Specify (real) cores that our cgroup can run on

( self, cores, mems=0 )

Source from the content-addressed store, hash-verified

848 info( '(%s %s/%dus) ' % ( sched, setQuota, int( setPeriod ) ) )
849
850 def setCPUs( self, cores, mems=0 ):
851 "Specify (real) cores that our cgroup can run on"
852 if not cores:
853 return
854 if isinstance( cores, list ):
855 cores = ','.join( [ str( c ) for c in cores ] )
856 self.cgroupSet( resource='cpuset', param='cpus',
857 value=cores )
858 # Memory placement is probably not relevant, but we
859 # must specify it anyway
860 self.cgroupSet( resource='cpuset', param='mems',
861 value=mems)
862 # We have to do this here after we've specified
863 # cpus and mems
864 errFail( 'cgclassify -g cpuset:/%s %s' % (
865 self.name, self.pid ) )
866
867 # pylint: disable=arguments-differ
868 def config( self, cpu=-1, cores=None, **params ):

Callers 1

buildNodesMethod · 0.80

Calls 2

cgroupSetMethod · 0.95
errFailFunction · 0.90

Tested by

no test coverage detected