我正在这样做
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
的值是什么?