aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/perfmon/cli.c21
-rw-r--r--src/plugins/perfmon/perfmon.c2
-rw-r--r--src/plugins/perfmon/perfmon.h2
3 files changed, 24 insertions, 1 deletions
diff --git a/src/plugins/perfmon/cli.c b/src/plugins/perfmon/cli.c
index cb7debe1615..7ffa6e89c0a 100644
--- a/src/plugins/perfmon/cli.c
+++ b/src/plugins/perfmon/cli.c
@@ -275,10 +275,19 @@ show_perfmon_stats_command_fn (vlib_main_t *vm, unformat_input_t *input,
perfmon_instance_t *in;
u8 *s = 0;
int n_row = 0;
+ u8 raw = 0;
if (b == 0)
return clib_error_return (0, "no budle selected");
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "raw"))
+ raw = 1;
+ else
+ break;
+ }
+
n_instances = vec_len (it->instances);
vec_validate (readings, n_instances - 1);
@@ -304,6 +313,13 @@ show_perfmon_stats_command_fn (vlib_main_t *vm, unformat_input_t *input,
char **hdr = b->column_headers;
while (hdr[0])
table_format_cell (t, -1, n_row++, "%s", hdr++[0]);
+
+ if (b->raw_column_headers && raw)
+ {
+ hdr = b->raw_column_headers;
+ while (hdr[0])
+ table_format_cell (t, -1, n_row++, "%s", hdr++[0]);
+ }
}
int col = 0;
@@ -340,6 +356,9 @@ show_perfmon_stats_command_fn (vlib_main_t *vm, unformat_input_t *input,
vlib_cli_output (vm, "%U\n", format_table, t);
table_free (t);
+ if (raw)
+ vlib_cli_output (vm, "Sample time is %.4f seconds \n", pm->sample_time);
+
if (b->footer)
vlib_cli_output (vm, "\n%s\n", b->footer);
@@ -351,7 +370,7 @@ done:
VLIB_CLI_COMMAND (show_perfmon_stats_command, static) = {
.path = "show perfmon statistics",
- .short_help = "show perfmon statistics",
+ .short_help = "show perfmon statistics [raw]",
.function = show_perfmon_stats_command_fn,
.is_mp_safe = 1,
};
diff --git a/src/plugins/perfmon/perfmon.c b/src/plugins/perfmon/perfmon.c
index 07a4ae61859..7a69d454fd0 100644
--- a/src/plugins/perfmon/perfmon.c
+++ b/src/plugins/perfmon/perfmon.c
@@ -238,6 +238,7 @@ perfmon_start (vlib_main_t *vm)
vlib_node_set_dispatch_wrapper (vlib_mains[i],
perfmon_dispatch_wrapper);
}
+ pm->sample_time = vlib_time_now (vm);
pm->is_running = 1;
return 0;
}
@@ -268,6 +269,7 @@ perfmon_stop (vlib_main_t *vm)
}
pm->is_running = 0;
+ pm->sample_time = vlib_time_now (vm) - pm->sample_time;
return 0;
}
diff --git a/src/plugins/perfmon/perfmon.h b/src/plugins/perfmon/perfmon.h
index 61e44ea43d3..c8b8cc47716 100644
--- a/src/plugins/perfmon/perfmon.h
+++ b/src/plugins/perfmon/perfmon.h
@@ -93,6 +93,7 @@ typedef struct perfmon_bundle
perfmon_bundle_init_fn_t *init_fn;
char **column_headers;
+ char **raw_column_headers;
format_function_t *format_fn;
/* do not set manually */
@@ -133,6 +134,7 @@ typedef struct
uword *source_by_name;
perfmon_bundle_t *active_bundle;
int is_running;
+ f64 sample_time;
int *group_fds;
int *fds_to_close;
perfmon_instance_type_t *default_instance_type;