mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 09:58:09 +00:00
crit: RSS explorer
When running 'cirt x dir rss' one will see the way pagemap chunks are scatered across the VMs of processes. Sample output from the env00 zdtm test is 22 400000 / 1 00400000 / 5 /root/criu/test/zdtm/static/env00 604000 / 2 00604000 / 1 /root/criu/test/zdtm/static/env00 00605000 / 1 /root/criu/test/zdtm/static/env00 853000 / 1 00853000 / 33 7faba2d4b000 / 6 7faba2d4b000 / 4 /usr/lib64/libc-2.22.so 7faba2d4f000 / 2 /usr/lib64/libc-2.22.so 7faba2d51000 / 2 7faba2d51000 / 4 7faba2d54000 / 1 ~ 7faba2f64000 / 3 7faba2f64000 / 3 7faba2f74000 / 1 7faba2f74000 / 1 7faba2f75000 / 2 7faba2f75000 / 1 /usr/lib64/ld-2.22.so 7faba2f76000 / 1 /usr/lib64/ld-2.22.so 7faba2f77000 / 1 7faba2f77000 / 1 7fffb4de3000 / 3 7fffb4de2000 / 70 7fffb4e24000 / 2 ~ 7fffb4e27000 / 1 ~ 7fffb4f6a000 / 2 7fffb4f6a000 / 2 Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
9e3e46565d
commit
af6e70b2b9
39
crit/crit
39
crit/crit
@ -212,7 +212,42 @@ def explore_mems(opts):
|
||||
print "\t%-36s%s%s" % (astr, prot, fn)
|
||||
|
||||
|
||||
explorers = { 'ps': explore_ps, 'fds': explore_fds, 'mems': explore_mems }
|
||||
def explore_rss(opts):
|
||||
ps_img = pycriu.images.load(dinf(opts, 'pstree.img'))
|
||||
for p in ps_img['entries']:
|
||||
pid = p['pid']
|
||||
vmas = pycriu.images.load(dinf(opts, 'mm-%d.img' % pid))['entries'][0]['vmas']
|
||||
pms = pycriu.images.load(dinf(opts, 'pagemap-%d.img' % pid))['entries']
|
||||
|
||||
print "%d" % pid
|
||||
vmi = 0
|
||||
pvmi = -1
|
||||
for pm in pms[1:]:
|
||||
pstr = '\t%lx / %-8d' % (pm['vaddr'], pm['nr_pages'])
|
||||
while vmas[vmi]['end'] <= pm['vaddr']:
|
||||
vmi += 1
|
||||
|
||||
pme = pm['vaddr'] + (pm['nr_pages'] << 12)
|
||||
vstr = ''
|
||||
while vmas[vmi]['start'] < pme:
|
||||
vma = vmas[vmi]
|
||||
if vmi == pvmi:
|
||||
vstr += ' ~'
|
||||
else:
|
||||
vstr += ' %08lx / %-8d' % (vma['start'], (vma['end'] - vma['start'])>>12)
|
||||
if vma['status'] & ((1 << 6) | (1 << 7)):
|
||||
vstr += ' ' + get_file_str(opts, {'type': 'REG', 'id': vma['shmid']})
|
||||
pvmi = vmi
|
||||
vstr += '\n\t%23s' % ''
|
||||
vmi += 1
|
||||
|
||||
vmi -= 1
|
||||
|
||||
print '%-24s%s' % (pstr, vstr)
|
||||
|
||||
|
||||
|
||||
explorers = { 'ps': explore_ps, 'fds': explore_fds, 'mems': explore_mems, 'rss': explore_rss }
|
||||
|
||||
def explore(opts):
|
||||
explorers[opts['what']](opts)
|
||||
@ -258,7 +293,7 @@ def main():
|
||||
# Explore
|
||||
x_parser = subparsers.add_parser('x', help = 'explore image dir')
|
||||
x_parser.add_argument('dir')
|
||||
x_parser.add_argument('what', choices = [ 'ps', 'fds', 'mems' ])
|
||||
x_parser.add_argument('what', choices = [ 'ps', 'fds', 'mems', 'rss'])
|
||||
x_parser.set_defaults(func=explore)
|
||||
|
||||
# Show
|
||||
|
Loading…
x
Reference in New Issue
Block a user