summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorZachary Leaf <zachary.leaf@arm.com>2021-08-17 04:12:01 -0500
committerDamjan Marion <dmarion@me.com>2021-09-08 14:34:44 +0000
commit0c373fc928316ef9928f4171b7c602c259c60d77 (patch)
tree05f5b366b6b3c290dad596c7598dd9c24cfc6754 /src/plugins
parent2f8174ff5101409d2335069330a4d674ec01afb9 (diff)
perfmon: sort 'show perfmon bundle' output
This patch sorts 'show perfmon bundle' output in alphabetical order. Type: improvement Signed-off-by: Zachary Leaf <zachary.leaf@arm.com> Change-Id: I26b379b5d6766b9f87f9a3a5013ea92b207fb5d4
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/perfmon/cli.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/perfmon/cli.c b/src/plugins/perfmon/cli.c
index 1535570de7e..ce191eac35b 100644
--- a/src/plugins/perfmon/cli.c
+++ b/src/plugins/perfmon/cli.c
@@ -91,6 +91,15 @@ format_perfmon_bundle (u8 *s, va_list *args)
return s;
}
+static int
+bundle_name_sort_cmp (void *a1, void *a2)
+{
+ perfmon_bundle_t **n1 = a1;
+ perfmon_bundle_t **n2 = a2;
+
+ return clib_strcmp ((char *) (*n1)->name, (char *) (*n2)->name);
+}
+
static clib_error_t *
show_perfmon_bundle_command_fn (vlib_main_t *vm, unformat_input_t *input,
vlib_cli_command_t *cmd)
@@ -127,6 +136,8 @@ show_perfmon_bundle_command_fn (vlib_main_t *vm, unformat_input_t *input,
if (verbose == 0)
vlib_cli_output (vm, "%U\n", format_perfmon_bundle, 0, 0);
+ vec_sort_with_function (vb, bundle_name_sort_cmp);
+
for (int i = 0; i < vec_len (vb); i++)
/* bundle type will be unknown if no cpu_supports matched */
if (vb[i]->type != PERFMON_BUNDLE_TYPE_UNKNOWN)