MINOR: mworker/cli: show programs in 'show proc'

Show the programs in 'show proc'

Example:

	# programs
	2285            dataplane-api   -               0               0d 00h00m12s
	# old programs
	2261            dataplane-api   -               1               0d 00h00m53s
This commit is contained in:
William Lallemand 2019-04-01 11:30:03 +02:00 committed by Willy Tarreau
parent 9a1ee7ac31
commit ad53d6dd75

View File

@ -442,6 +442,38 @@ static int cli_io_handler_show_proc(struct appctx *appctx)
free(msg);
}
/* displays external process */
chunk_appendf(&trash, "# programs\n");
old = 0;
list_for_each_entry(child, &proc_list, list) {
up = now.tv_sec - child->timestamp;
if (child->type != 'e')
continue;
if (child->reloads > 0) {
old++;
continue;
}
chunk_appendf(&trash, "%-15u %-15s %-15s %-15d %dd %02dh%02dm%02ds\n", child->pid, child->id, "-", child->reloads, up / 86400, (up % 86400) / 3600, (up % 3600) / 60, (up % 60));
}
if (old) {
chunk_appendf(&trash, "# old programs\n");
list_for_each_entry(child, &proc_list, list) {
up = now.tv_sec - child->timestamp;
if (child->type != 'e')
continue;
if (child->reloads > 0) {
chunk_appendf(&trash, "%-15u %-15s %-15s %-15d %dd %02dh%02dm%02ds\n", child->pid, child->id, "-", child->reloads, up / 86400, (up % 86400) / 3600, (up % 3600) / 60, (up % 60));
}
}
}
if (ci_putchk(si_ic(si), &trash) == -1) {
si_rx_room_blk(si);
return 0;