summaryrefslogtreecommitdiffstats
path: root/src/oom/oomd-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/oom/oomd-util.c')
-rw-r--r--src/oom/oomd-util.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/oom/oomd-util.c b/src/oom/oomd-util.c
index b2a48acb1f..ff0fc13c6f 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,9 +521,6 @@ 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 tbuf[FORMAT_TIMESPAN_MAX], mem_use[FORMAT_BYTES_MAX];
- char mem_min[FORMAT_BYTES_MAX], mem_low[FORMAT_BYTES_MAX];
-
assert(ctx);
assert(f);
@@ -540,8 +535,8 @@ void oomd_dump_memory_pressure_cgroup_context(const OomdCGroupContext *ctx, FILE
LOAD_INT(ctx->memory_pressure.avg10), LOAD_FRAC(ctx->memory_pressure.avg10),
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(tbuf, sizeof(tbuf), ctx->memory_pressure.total, USEC_PER_SEC),
- strempty(prefix), format_bytes(mem_use, sizeof(mem_use), ctx->current_memory_usage));
+ FORMAT_TIMESPAN(ctx->memory_pressure.total, USEC_PER_SEC),
+ strempty(prefix), FORMAT_BYTES(ctx->current_memory_usage));
if (!empty_or_root(ctx->path))
fprintf(f,
@@ -549,16 +544,13 @@ void oomd_dump_memory_pressure_cgroup_context(const OomdCGroupContext *ctx, FILE
"%s\tMemory Low: %s\n"
"%s\tPgscan: %" PRIu64 "\n"
"%s\tLast Pgscan: %" PRIu64 "\n",
- strempty(prefix), format_bytes_cgroup_protection(mem_min, sizeof(mem_min), ctx->memory_min),
- strempty(prefix), format_bytes_cgroup_protection(mem_low, sizeof(mem_low), ctx->memory_low),
+ strempty(prefix), FORMAT_BYTES_CGROUP_PROTECTION(ctx->memory_min),
+ strempty(prefix), FORMAT_BYTES_CGROUP_PROTECTION(ctx->memory_low),
strempty(prefix), ctx->pgscan,
strempty(prefix), ctx->last_pgscan);
}
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);
@@ -566,9 +558,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));
}