};
static struct top_context *sort_ctx = NULL;
+static const char *disk_input_field = "disk_input";
+static const char *disk_output_field = "disk_output";
static char **
p_read_next_line(pool_t pool, struct istream *input)
return;
}
if (strcmp(ctx->sort_type, "disk") == 0) {
- if (!stats_header_find(ctx, "disk_input", &ctx->sort_idx1) ||
- !stats_header_find(ctx, "disk_output", &ctx->sort_idx2))
+ if (!stats_header_find(ctx, disk_input_field, &ctx->sort_idx1) ||
+ !stats_header_find(ctx, disk_output_field, &ctx->sort_idx2))
i_fatal("disk sort type is missing fields");
return;
}
{
static const char *names[] = {
"user", "service", "user_cpu", "sys_cpu",
- "disk_input", "disk_output"
+ "", ""
};
struct winsize ws;
struct top_line *const *lines;
unsigned int i, j, row, maxrow, count, indexes[N_ELEMENTS(names)];
+ names[4] = disk_input_field;
+ names[5] = disk_output_field;
+
/* ANSI clear screen and move cursor to top of screen */
printf("\x1b[2J\x1b[1;1H"); fflush(stdout);
doveadm_print_deinit();
path = t_strconcat(doveadm_settings->base_dir, "/stats", NULL);
- while ((c = getopt(argc, argv, "s:")) > 0) {
+ while ((c = getopt(argc, argv, "bs:")) > 0) {
switch (c) {
+ case 'b':
+ disk_input_field = "read_bytes";
+ disk_output_field = "write_bytes";
+ break;
case 's':
path = optarg;
break;
};
struct doveadm_cmd doveadm_cmd_stats_top = {
- cmd_stats_top, "stats top", "[-s <stats socket path>] [<sort field>]"
+ cmd_stats_top, "stats top", "[-s <stats socket path>] [-b] [<sort field>]"
};