tools: parsememdump.py support show total pid memory
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
eca4951021
commit
984208f6a2
17
tools/parsememdump.py
Executable file → Normal file
17
tools/parsememdump.py
Executable file → Normal file
@ -115,10 +115,27 @@ if __name__ == "__main__":
|
||||
list.sort(key=lambda x: x.cnt, reverse=True)
|
||||
|
||||
log = log_output(args)
|
||||
total_dir = {}
|
||||
for t in list:
|
||||
if t.pid in total_dir:
|
||||
total_dir[t.pid] += t.size
|
||||
else:
|
||||
total_dir.setdefault(t.pid, t.size)
|
||||
|
||||
log.output("total memory used for ervey pid\n")
|
||||
log.output("pid total size\n")
|
||||
total_size = 0
|
||||
for pid, size in sorted(total_dir.items(), key=lambda x: x[1]):
|
||||
log.output("%-3d %-6d\n" % (pid, size))
|
||||
total_size += size
|
||||
log.output("all used memory %-6d\n" % (total_size))
|
||||
|
||||
log.output("cnt size pid addr mem\n")
|
||||
for t in list:
|
||||
memstr = ""
|
||||
log.output("%-4d %-6d %-3d %s " % (t.cnt, t.size, t.pid, t.addr))
|
||||
if t.mem == []:
|
||||
continue
|
||||
for mem in t.mem:
|
||||
log.output("%s " % mem)
|
||||
memstr += mem + " "
|
||||
|
Loading…
Reference in New Issue
Block a user