土豆不好吃

systemd – systemctl不显示内存CPU信息

这篇文章在 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程序?占用这么多内存,看样子应该是死锁了……


文章版权归原作者所有丨本站默认采用CC-BY-NC-SA 4.0协议进行授权|
转载必须包含本声明,并以超链接形式注明原作者和本文原始地址:
https://dmesg.app/systemd-accounting.html
退出移动版