diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-04-25 11:59:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-25 11:59:37 +0200 |
commit | c5b7ae0edb4e32463b5326c973443a9bc6ae10e3 (patch) | |
tree | 6def44557f6affbc9bbe7ffe1116448dc5336810 /src/run | |
parent | 10434dbdfd4e71ccef8b62309a4545c3b88aee29 (diff) | |
parent | 7a5de3f9518859aaeb8bcf9fdcea488a04cc57ed (diff) | |
download | systemd-c5b7ae0edb4e32463b5326c973443a9bc6ae10e3.tar.gz |
Merge pull request #12074 from poettering/io-acct
expose IO stats on the bus and in "systemctl status" and "systemd-run --wait"
Diffstat (limited to 'src/run')
-rw-r--r-- | src/run/run.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/run/run.c b/src/run/run.c index 8a98177575..6a0b0d78b9 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -948,6 +948,8 @@ typedef struct RunContext { uint64_t cpu_usage_nsec; uint64_t ip_ingress_bytes; uint64_t ip_egress_bytes; + uint64_t io_read_bytes; + uint64_t io_write_bytes; uint32_t exit_code; uint32_t exit_status; } RunContext; @@ -993,6 +995,8 @@ static int run_context_update(RunContext *c, const char *path) { { "CPUUsageNSec", "t", NULL, offsetof(RunContext, cpu_usage_nsec) }, { "IPIngressBytes", "t", NULL, offsetof(RunContext, ip_ingress_bytes) }, { "IPEgressBytes", "t", NULL, offsetof(RunContext, ip_egress_bytes) }, + { "IOReadBytes", "t", NULL, offsetof(RunContext, io_read_bytes) }, + { "IOWriteBytes", "t", NULL, offsetof(RunContext, io_write_bytes) }, {} }; @@ -1181,6 +1185,8 @@ static int start_transient_service( .cpu_usage_nsec = NSEC_INFINITY, .ip_ingress_bytes = UINT64_MAX, .ip_egress_bytes = UINT64_MAX, + .io_read_bytes = UINT64_MAX, + .io_write_bytes = UINT64_MAX, .inactive_exit_usec = USEC_INFINITY, .inactive_enter_usec = USEC_INFINITY, }; @@ -1280,6 +1286,14 @@ static int start_transient_service( char bytes[FORMAT_BYTES_MAX]; log_info("IP traffic sent: %s", format_bytes(bytes, sizeof(bytes), c.ip_egress_bytes)); } + if (c.io_read_bytes != UINT64_MAX) { + char bytes[FORMAT_BYTES_MAX]; + log_info("IO bytes read: %s", format_bytes(bytes, sizeof(bytes), c.io_read_bytes)); + } + if (c.io_write_bytes != UINT64_MAX) { + char bytes[FORMAT_BYTES_MAX]; + log_info("IO bytes written: %s", format_bytes(bytes, sizeof(bytes), c.io_write_bytes)); + } } /* Try to propagate the service's return value */ |