这篇文章在 2018 年 10 月 23 日 15:03:47 更新了哦~
刚刚发现树莓派上的 Ubuntu Mate 用 systemctl status 查看服务状态的时候不显示 CPU 和内存信息,而其他系统下都是显示的。
再来一个不显示的 CentOS
后来通过systemctl show
发现好像有个参数能设置,通过手册man systemd-system.conf
查看到配置文件中写了这么一段话:
DefaultCPUAccounting=, DefaultBlockIOAccounting=, DefaultMemoryAccounting=, DefaultTasksAccounting=
Configure the default resource accounting settings, as configured per-unit by CPUAccounting=, BlockIOAccounting=, MemoryAccounting=
and TasksAccounting=. See systemd.resource-control(5) for details on the per-unit settings.
啊那咱去改配置文件呗?
- sudo vim /etc/systemd/system.conf
找到这么几行,取消注释改成 yes,然后重启下或者systemctl daemon-reload
就好了啦。
- DefaultCPUAccounting=yes
- DefaultMemoryAccounting=yes
- DefaultTasksAccounting=yes
你看都出来了吧(不过为啥TasksAccounting=yes
都是 yes 了还不显示 tasks 数目呢?
但这都不是重点!重点是,
谁来拯救我这个 Python 程序?占用这么多内存,看样子应该是死锁了……
-- 本评论由 Telegram Bot 回复~❤️