

You can also differentiate between system and user (my current graphical session on my laptop, where I write this, would be in user) by using /sys/fs/cgroup/system.slice/memory.stat/. sys/fs/cgroup/system.slice/rvice/memory.stat, giving you the memory for everything in rvice (the process for this service and everything started by that). If you want that per systemd service, you can use e.g.

The most interesting one for you is memory.stat, from which the first line anon $someNumber is probably the most interesting value (giving you bytes of memory in use that are not backed by files and thus cannot be removed from memory anywhere else than swap). In this setup, the metrics systemd_process_resident_memory_bytes, systemd_process_virtual_memory_bytes and systemd_process_virtual_memory_max_bytes would probably be the interesting ones.Ĭgroups (all of this depending on v2) have a file system under /sys/fs/cgroup in which you can query a lot of information.

Just check the CPU column to see how much processing power is used by each app. Based on the answer by Halfgaar, doing the simple hacky way but without systemd status | grep somethingįirst I would strongly advise using a monitoring solution of some kind - installing Prometheus systemd-exporter should be quite easy and running Prometheus on any other machine to retrieve the stats should be to - could even be on a device at home/corp for just as long as you debug this issue. Also, you can use the top command-line tool to check the CPU usage.
