summaryrefslogtreecommitdiffstats
path: root/vlib
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-11-18 16:59:24 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2016-11-19 11:30:36 +0000
commiteccf509a31519747c2f4653a5ec2a94cc299860c (patch)
tree4933ae0a366542a1b5b78d8af7f5ba57930dc1fc /vlib
parentc21d59fa3354c2a1f7f4510793605104c9348e1c (diff)
vlib: Add 'show cpu' command
Change-Id: I0d9af8e022cc25b8b4503f808f79028190475f8f Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vlib')
-rw-r--r--vlib/vlib/cli.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/vlib/vlib/cli.c b/vlib/vlib/cli.c
index a54298505ab..2d141115857 100644
--- a/vlib/vlib/cli.c
+++ b/vlib/vlib/cli.c
@@ -38,6 +38,7 @@
*/
#include <vlib/vlib.h>
+#include <vppinfra/cpu.h>
/* Root of all show commands. */
/* *INDENT-OFF* */
@@ -634,6 +635,39 @@ VLIB_CLI_COMMAND (show_memory_usage_command, static) = {
/* *INDENT-ON* */
static clib_error_t *
+show_cpu (vlib_main_t * vm, unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+#define _(a,b,c) vlib_cli_output (vm, "%-25s " b, a ":", c);
+ _("Model name", "%U", format_cpu_model_name);
+ _("Microarchitecture", "%U", format_cpu_uarch);
+ _("Flags", "%U", format_cpu_flags);
+ _("Base frequency", "%.2f GHz",
+ ((f64) vm->clib_time.clocks_per_second) * 1e-9);
+#undef _
+ return 0;
+}
+
+/*?
+ * Displays various information about the CPU.
+ *
+ * @cliexpar
+ * @cliexstart{show cpu}
+ * Model name: Intel(R) Xeon(R) CPU E5-2667 v4 @ 3.20GHz
+ * Microarchitecture: Broadwell (Broadwell-EP/EX)
+ * Flags: sse3 ssse3 sse41 sse42 avx avx2 aes
+ * Base Frequency: 3.20 GHz
+ * @cliexend
+?*/
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (show_cpu_command, static) = {
+ .path = "show cpu",
+ .short_help = "Show cpu information",
+ .function = show_cpu,
+};
+
+/* *INDENT-ON* */
+static clib_error_t *
enable_disable_memory_trace (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)