MCPcopy Create free account
hub / github.com/PyTables/PyTables / show_stats

Function show_stats

tables/utils.py:265–286  ·  view source on GitHub ↗

Show the used memory (only works for Linux 2.6.x).

(explain: str, tref: float, encoding=None)

Source from the content-addressed store, hash-verified

263
264
265def show_stats(explain: str, tref: float, encoding=None) -> float:
266 """Show the used memory (only works for Linux 2.6.x)."""
267 for line in Path("/proc/self/status").read_text().splitlines():
268 if line.startswith("VmSize:"):
269 vmsize = int(line.split()[1])
270 elif line.startswith("VmRSS:"):
271 vmrss = int(line.split()[1])
272 elif line.startswith("VmData:"):
273 vmdata = int(line.split()[1])
274 elif line.startswith("VmStk:"):
275 vmstk = int(line.split()[1])
276 elif line.startswith("VmExe:"):
277 vmexe = int(line.split()[1])
278 elif line.startswith("VmLib:"):
279 vmlib = int(line.split()[1])
280 print("Memory usage: ******* %s *******" % explain)
281 print(f"VmSize: {vmsize:>7} kB\tVmRSS: {vmrss:>7} kB")
282 print(f"VmData: {vmdata:>7} kB\tVmStk: {vmstk:>7} kB")
283 print(f"VmExe: {vmexe:>7} kB\tVmLib: {vmlib:>7} kB")
284 tnow = clock()
285 print(f"WallClock time: {tnow - tref:.3f}")
286 return tnow
287
288
289# truncate data before calling __setitem__, to improve compression ratio

Callers 8

_table__where_indexedFunction · 0.70
_whereMethod · 0.70
initial_appendMethod · 0.70
final_idx32Method · 0.70
appendMethod · 0.70
append_last_rowMethod · 0.70
searchMethod · 0.70
get_chunkmapMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected