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

Function fmt_memsize

dpdk/usertools/dpdk-hugepages.py:20–25  ·  view source on GitHub ↗

Format memory size in kB into conventional format

(kb)

Source from the content-addressed store, hash-verified

18
19
20def fmt_memsize(kb):
21 '''Format memory size in kB into conventional format'''
22 logk = int(log2(kb) / 10)
23 suffix = BINARY_PREFIX[logk]
24 unit = 2**(logk * 10)
25 return '{}{}b'.format(int(kb / unit), suffix)
26
27
28def get_memsize(arg):

Callers 2

show_numa_pagesFunction · 0.85
show_non_numa_pagesFunction · 0.85

Calls 1

log2Function · 0.85

Tested by

no test coverage detected