Exemple #1
0
# for sleep
import time

# needed for cpu, disk, and memory handling
import nonportable

# needed for locking
import threading

# needed for handling internal errors
import tracebackrepy

# common functionality needed between nanny and nonportable
import nanny_resource_limits

nanny_resource_limits.init(nonportable.getruntime)

# These are resources that drain / replenish over time
renewable_resources = nanny_resource_limits.renewable_resources

# These are resources where the quantity of use may vary by use
quantity_resources = nanny_resource_limits.quantity_resources

# These are resources where the number of items is the quantity (events because
# each event is "equal", insockets because a listening socket is a listening
# socket)
fungible_item_resources = nanny_resource_limits.fungible_item_resources

# resources where there is no quantity.   There is only one messport 12345 and
# a vessel either has it or the vessel doesn't.   The resource messport 12345
# isn't fungible because it's not equal to having port 54321.   A vessel may
Exemple #2
0
elif osrealtype == "FreeBSD":
  import freebsd_api as os_api
elif ostype == "Windows" or ostype == "WindowsCE":
  # There is no real reason to do this, since windows is imported separately
  import windows_api as os_api
else:
  # This is a non-supported OS
  raise UnsupportedSystemException, "The current Operating System is not supported! Fatal Error."
  
# Set granularity
calculate_granularity()  

# For Windows, we need to initialize time.clock()
if ostype in ["Windows", "WindowsCE"]:
  time.clock()

# Initialize getruntime for other platforms 
else:
  # Set the starttime to the initial uptime
  starttime = getruntime()
  last_uptime = starttime

  # Reset elapsed time 
  elapsedtime = 0


# Conrad: initialize nanny (Prevents circular imports)
# Note: nanny_resource_limits can be initialized at any time after getruntime()
# is defined, this just seems the most appropriate place to put the call.
nanny_resource_limits.init(getruntime)
Exemple #3
0
# for sleep
import time

# needed for cpu, disk, and memory handling
import nonportable

# needed for locking
import threading

# needed for handling internal errors
import tracebackrepy

# common functionality needed between nanny and nonportable
import nanny_resource_limits
nanny_resource_limits.init(nonportable.getruntime)

# These are resources that drain / replenish over time
renewable_resources = nanny_resource_limits.renewable_resources

# These are resources where the quantity of use may vary by use 
quantity_resources = nanny_resource_limits.quantity_resources

# These are resources where the number of items is the quantity (events because
# each event is "equal", insockets because a listening socket is a listening 
# socket)
fungible_item_resources = nanny_resource_limits.fungible_item_resources

# resources where there is no quantity.   There is only one messport 12345 and
# a vessel either has it or the vessel doesn't.   The resource messport 12345
# isn't fungible because it's not equal to having port 54321.   A vessel may