MCPcopy Create free account
hub / github.com/F-Stack/f-stack / get_memsize

Function get_memsize

dpdk/usertools/dpdk-hugepages.py:28–38  ·  view source on GitHub ↗

Convert memory size with suffix to kB

(arg)

Source from the content-addressed store, hash-verified

26
27
28def get_memsize(arg):
29 '''Convert memory size with suffix to kB'''
30 match = re.match(r'(\d+)([' + BINARY_PREFIX + r']?)$', arg.upper())
31 if match is None:
32 sys.exit('{} is not a valid size'.format(arg))
33 num = float(match.group(1))
34 suffix = match.group(2)
35 if suffix == "":
36 return int(num / 1024)
37 idx = BINARY_PREFIX.find(suffix)
38 return int(num * (2**(idx * 10)))
39
40
41def is_numa():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected