Python解释器的内存使用情况:psutil与/ proc / self / status

时间:2019-01-31 09:36:39

标签: python django linux memory

我正在这样做

import django
django.setup()
import os
import psutil
process = psutil.Process(os.getpid())
print(process.memory_info_ex().vms/1024**2)
print(open("/proc/self/status").read())'

一行上

python -c 'import django; django.setup(); import os; import psutil; process = psutil.Process(os.getpid()); print(process.memory_info_ex().vms/1024**2); print(open("/proc/self/status").read())'

查看django.setup()使用了多少内存。

输出:

来自psutil:

575

来自/ proc / self / status:

Name:   python -c impor
State:  R (running)
Pid:    5045
PPid:   2970
VmPeak:   589104 kB
VmSize:   589104 kB
VmLck:         0 kB
VmPin:         0 kB
VmHWM:    142764 kB
VmRSS:    142764 kB
RssAnon:      113524 kB
RssFile:       29240 kB
RssShmem:          0 kB
VmData:   238676 kB
VmStk:       132 kB
VmExe:      3104 kB
VmLib:     78912 kB
VmPTE:       876 kB
VmSwap:        0 kB
HugetlbPages:          0 kB
Threads:    4
voluntary_ctxt_switches:    2855
nonvoluntary_ctxt_switches: 1622

来自psutil的/proc/self/status来自575的值是什么?

0 个答案:

没有答案