diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-06 09:14:01 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-09 11:11:21 +0200 |
commit | 2b59bf51a0fcd98f4bd56b8c47ce50357cf65c9a (patch) | |
tree | a3734788e349fa3032290c6a850b3eecd44fb4c1 /src/oom | |
parent | Inline some iterator variables (diff) | |
download | systemd-2b59bf51a0fcd98f4bd56b8c47ce50357cf65c9a.tar.xz systemd-2b59bf51a0fcd98f4bd56b8c47ce50357cf65c9a.zip |
tree-wide: add FORMAT_BYTES()
Diffstat (limited to 'src/oom')
-rw-r--r-- | src/oom/oomd-util.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/oom/oomd-util.c b/src/oom/oomd-util.c index ddcceae697..4bf7db8c3e 100644 --- a/src/oom/oomd-util.c +++ b/src/oom/oomd-util.c @@ -503,8 +503,6 @@ void oomd_update_cgroup_contexts_between_hashmaps(Hashmap *old_h, Hashmap *curr_ } void oomd_dump_swap_cgroup_context(const OomdCGroupContext *ctx, FILE *f, const char *prefix) { - char swap[FORMAT_BYTES_MAX]; - assert(ctx); assert(f); @@ -513,7 +511,7 @@ void oomd_dump_swap_cgroup_context(const OomdCGroupContext *ctx, FILE *f, const "%sPath: %s\n" "%s\tSwap Usage: %s\n", strempty(prefix), ctx->path, - strempty(prefix), format_bytes(swap, sizeof(swap), ctx->swap_usage)); + strempty(prefix), FORMAT_BYTES(ctx->swap_usage)); else fprintf(f, "%sPath: %s\n" @@ -523,7 +521,7 @@ void oomd_dump_swap_cgroup_context(const OomdCGroupContext *ctx, FILE *f, const } void oomd_dump_memory_pressure_cgroup_context(const OomdCGroupContext *ctx, FILE *f, const char *prefix) { - char mem_use[FORMAT_BYTES_MAX], mem_min[FORMAT_BYTES_MAX], mem_low[FORMAT_BYTES_MAX]; + char mem_min[FORMAT_BYTES_MAX], mem_low[FORMAT_BYTES_MAX]; assert(ctx); assert(f); @@ -540,7 +538,7 @@ void oomd_dump_memory_pressure_cgroup_context(const OomdCGroupContext *ctx, FILE LOAD_INT(ctx->memory_pressure.avg60), LOAD_FRAC(ctx->memory_pressure.avg60), LOAD_INT(ctx->memory_pressure.avg300), LOAD_FRAC(ctx->memory_pressure.avg300), FORMAT_TIMESPAN(ctx->memory_pressure.total, USEC_PER_SEC), - strempty(prefix), format_bytes(mem_use, sizeof(mem_use), ctx->current_memory_usage)); + strempty(prefix), FORMAT_BYTES(ctx->current_memory_usage)); if (!empty_or_root(ctx->path)) fprintf(f, @@ -555,9 +553,6 @@ void oomd_dump_memory_pressure_cgroup_context(const OomdCGroupContext *ctx, FILE } void oomd_dump_system_context(const OomdSystemContext *ctx, FILE *f, const char *prefix) { - char mem_used[FORMAT_BYTES_MAX], mem_total[FORMAT_BYTES_MAX]; - char swap_used[FORMAT_BYTES_MAX], swap_total[FORMAT_BYTES_MAX]; - assert(ctx); assert(f); @@ -565,9 +560,9 @@ void oomd_dump_system_context(const OomdSystemContext *ctx, FILE *f, const char "%sMemory: Used: %s Total: %s\n" "%sSwap: Used: %s Total: %s\n", strempty(prefix), - format_bytes(mem_used, sizeof(mem_used), ctx->mem_used), - format_bytes(mem_total, sizeof(mem_total), ctx->mem_total), + FORMAT_BYTES(ctx->mem_used), + FORMAT_BYTES(ctx->mem_total), strempty(prefix), - format_bytes(swap_used, sizeof(swap_used), ctx->swap_used), - format_bytes(swap_total, sizeof(swap_total), ctx->swap_total)); + FORMAT_BYTES(ctx->swap_used), + FORMAT_BYTES(ctx->swap_total)); } |