mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-22 11:20:59 +01:00
MINOR: cli: format show proc to be more readable
Add more space on the output to be more readable and separate old processes from current ones.
This commit is contained in:
parent
1611965e7d
commit
e09cdc6d48
24
src/cli.c
24
src/cli.c
@ -1398,18 +1398,36 @@ static int cli_io_handler_show_proc(struct appctx *appctx)
|
|||||||
{
|
{
|
||||||
struct stream_interface *si = appctx->owner;
|
struct stream_interface *si = appctx->owner;
|
||||||
struct mworker_proc *child;
|
struct mworker_proc *child;
|
||||||
|
int old = 0;
|
||||||
|
|
||||||
if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
|
if (unlikely(si_ic(si)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
chunk_reset(&trash);
|
chunk_reset(&trash);
|
||||||
|
|
||||||
chunk_printf(&trash, "# <PID> <type> <relative PID> <reloads>\n");
|
chunk_printf(&trash, "#%-14s %-15s %-15s %-15s\n", "<PID>", "<type>", "<relative PID>", "<reloads>");
|
||||||
chunk_appendf(&trash, "%u %s %u %d\n", getpid(), "master", 0, -1);
|
chunk_appendf(&trash, "%-15u %-15s %-15u %-15s\n", getpid(), "master", 0, "-");
|
||||||
|
|
||||||
|
/* displays current processes */
|
||||||
|
|
||||||
|
chunk_appendf(&trash, "# workers\n");
|
||||||
list_for_each_entry(child, &proc_list, list) {
|
list_for_each_entry(child, &proc_list, list) {
|
||||||
chunk_appendf(&trash, "%u %s %u %d\n", child->pid, "worker", child->relative_pid, child->reloads);
|
|
||||||
|
if (child->reloads > 0) {
|
||||||
|
old++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
chunk_appendf(&trash, "%-15u %-15s %-15u %-15d\n", child->pid, "worker", child->relative_pid, child->reloads);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* displays old processes */
|
||||||
|
|
||||||
|
if (old) {
|
||||||
|
chunk_appendf(&trash, "# old workers\n");
|
||||||
|
list_for_each_entry(child, &proc_list, list) {
|
||||||
|
if (child->reloads > 0)
|
||||||
|
chunk_appendf(&trash, "%-15u %-15s %-15u %-15d\n", child->pid, "worker", child->relative_pid, child->reloads);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ci_putchk(si_ic(si), &trash) == -1) {
|
if (ci_putchk(si_ic(si), &trash) == -1) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user