summaryrefslogtreecommitdiffstats
path: root/src/run
diff options
context:
space:
mode:
authorFlorian Schmaus <flo@geekplace.eu>2023-11-08 19:22:06 +0100
committerFlorian Schmaus <flo@geekplace.eu>2023-11-11 12:14:07 +0100
commitaac3384e56fc863c1de0edf40ce793c1fb2eed90 (patch)
treef84b324235591a9da4de08b640df889c778705d2 /src/run
parentcore: fix array size in unit_log_resources() (diff)
downloadsystemd-aac3384e56fc863c1de0edf40ce793c1fb2eed90.tar.xz
systemd-aac3384e56fc863c1de0edf40ce793c1fb2eed90.zip
cgroup: add support for memory.swap.peak
Diffstat (limited to 'src/run')
-rw-r--r--src/run/run.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/run/run.c b/src/run/run.c
index 1b20a8f459..fdca8fa981 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -1050,6 +1050,7 @@ typedef struct RunContext {
char *result;
uint64_t cpu_usage_nsec;
uint64_t memory_peak;
+ uint64_t memory_swap_peak;
uint64_t ip_ingress_bytes;
uint64_t ip_egress_bytes;
uint64_t io_read_bytes;
@@ -1112,6 +1113,7 @@ static int run_context_update(RunContext *c, const char *path) {
{ "ExecMainStatus", "i", NULL, offsetof(RunContext, exit_status) },
{ "CPUUsageNSec", "t", NULL, offsetof(RunContext, cpu_usage_nsec) },
{ "MemoryPeak", "t", NULL, offsetof(RunContext, memory_peak) },
+ { "MemorySwapPeak", "t", NULL, offsetof(RunContext, memory_swap_peak) },
{ "IPIngressBytes", "t", NULL, offsetof(RunContext, ip_ingress_bytes) },
{ "IPEgressBytes", "t", NULL, offsetof(RunContext, ip_egress_bytes) },
{ "IOReadBytes", "t", NULL, offsetof(RunContext, io_read_bytes) },
@@ -1394,6 +1396,7 @@ static int start_transient_service(sd_bus *bus) {
_cleanup_(run_context_free) RunContext c = {
.cpu_usage_nsec = NSEC_INFINITY,
.memory_peak = UINT64_MAX,
+ .memory_swap_peak = UINT64_MAX,
.ip_ingress_bytes = UINT64_MAX,
.ip_egress_bytes = UINT64_MAX,
.io_read_bytes = UINT64_MAX,
@@ -1492,6 +1495,9 @@ static int start_transient_service(sd_bus *bus) {
if (c.memory_peak != UINT64_MAX)
log_info("Memory peak: %s", FORMAT_BYTES(c.memory_peak));
+ if (c.memory_swap_peak != UINT64_MAX)
+ log_info("Memory swap peak: %s", FORMAT_BYTES(c.memory_swap_peak));
+
if (c.ip_ingress_bytes != UINT64_MAX)
log_info("IP traffic received: %s", FORMAT_BYTES(c.ip_ingress_bytes));