MCPcopy Create free account
hub / github.com/geekcomputers/Python / mem

Function mem

simulate_memory_cpu.py:23–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21
22
23def mem():
24 pattern = re.compile(r"^(\d*)([MG]B)$")
25 size = sys.argv[2].upper()
26 match = pattern.match(size)
27 if match:
28 num = int(match.group(1))
29 unit = match.group(2)
30 if unit == "MB":
31 s = " " * (num * 1024 * 1024)
32 else:
33 s = " " * (num * 1024 * 1024 * 1024)
34 time.sleep(24 * 3600)
35 else:
36 print("bad args.....")
37 print_help()
38
39
40# cpu usage

Callers

nothing calls this directly

Calls 1

print_helpFunction · 0.85

Tested by

no test coverage detected