systemctl-show: always show memory peak if available
This commit is contained in:
@@ -703,17 +703,19 @@ static void print_status_info(
|
||||
if (i->n_fd_store > 0 || i->fd_store_max > 0)
|
||||
printf(" FD Store: %u%s (limit: %u)%s\n", i->n_fd_store, ansi_grey(), i->fd_store_max, ansi_normal());
|
||||
|
||||
bool show_memory_peak = i->memory_peak != CGROUP_LIMIT_MAX,
|
||||
show_memory_swap_peak = !IN_SET(i->memory_swap_peak, 0, CGROUP_LIMIT_MAX);
|
||||
|
||||
if (i->memory_current != UINT64_MAX) {
|
||||
printf(" Memory: %s", FORMAT_BYTES(i->memory_current));
|
||||
|
||||
/* Only show current swap if it ever was non-zero or is currently non-zero. In both cases
|
||||
memory_swap_peak will be non-zero (and not CGROUP_LIMIT_MAX).
|
||||
Only show the available memory if it was artificially limited. */
|
||||
bool show_memory_swap = !IN_SET(i->memory_swap_peak, 0, CGROUP_LIMIT_MAX),
|
||||
show_memory_zswap_current = !IN_SET(i->memory_zswap_current, 0, CGROUP_LIMIT_MAX),
|
||||
bool show_memory_zswap_current = !IN_SET(i->memory_zswap_current, 0, CGROUP_LIMIT_MAX),
|
||||
show_memory_available = i->memory_high != CGROUP_LIMIT_MAX || i->memory_max != CGROUP_LIMIT_MAX;
|
||||
if (i->memory_peak != CGROUP_LIMIT_MAX ||
|
||||
show_memory_swap ||
|
||||
if (show_memory_peak ||
|
||||
show_memory_swap_peak ||
|
||||
show_memory_zswap_current ||
|
||||
show_memory_available ||
|
||||
i->memory_min > 0 ||
|
||||
@@ -779,11 +781,11 @@ static void print_status_info(
|
||||
printf("%savailable: %s", prefix, FORMAT_BYTES(i->memory_available));
|
||||
prefix = " ";
|
||||
}
|
||||
if (i->memory_peak != CGROUP_LIMIT_MAX) {
|
||||
if (show_memory_peak) {
|
||||
printf("%speak: %s", prefix, FORMAT_BYTES(i->memory_peak));
|
||||
prefix = " ";
|
||||
}
|
||||
if (show_memory_swap) {
|
||||
if (show_memory_swap_peak) {
|
||||
printf("%sswap: %s swap peak: %s", prefix,
|
||||
FORMAT_BYTES(i->memory_swap_current), FORMAT_BYTES(i->memory_swap_peak));
|
||||
prefix = " ";
|
||||
@@ -795,6 +797,14 @@ static void print_status_info(
|
||||
printf(")");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
} else if (show_memory_peak) {
|
||||
printf(" Mem peak: %s", FORMAT_BYTES(i->memory_peak));
|
||||
|
||||
if (show_memory_swap_peak)
|
||||
printf(" (swap: %s)", FORMAT_BYTES(i->memory_swap_peak));
|
||||
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
if (i->cpu_usage_nsec != UINT64_MAX)
|
||||
|
||||
Reference in New Issue
Block a user