diff options
author | Dave Barach <dave@barachs.net> | 2018-09-10 12:31:15 -0400 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-10-22 12:02:04 +0000 |
commit | 4d1a866aff6ceb03025990b6e60b42faf09ef486 (patch) | |
tree | bec495932876d9649f26179b4c24b6938be43f38 /src/vlib/node_cli.c | |
parent | 115a3ac59a16f9dcfee92eaecc79cd1fa3320e29 (diff) |
X86_64 perf counter plugin
Change-Id: Ie5a00c15ee9536cc61afab57f6cadc1aa1972f3c
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlib/node_cli.c')
-rw-r--r-- | src/vlib/node_cli.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/vlib/node_cli.c b/src/vlib/node_cli.c index 2523b41c404..062854af5bc 100644 --- a/src/vlib/node_cli.c +++ b/src/vlib/node_cli.c @@ -148,19 +148,25 @@ format_vlib_node_stats (u8 * s, va_list * va) f64 maxc, maxcn; u32 maxn; u32 indent; + u64 pmc_ticks; + f64 pmc_ticks_per_packet; if (!n) { if (max) - return format (s, - "%=30s%=17s%=16s%=16s%=16s%=16s", - "Name", "Max Node Clocks", "Vectors at Max", - "Max Clocks", "Avg Clocks", "Avg Vectors/Call"); + s = format (s, + "%=30s%=17s%=16s%=16s%=16s%=16s", + "Name", "Max Node Clocks", "Vectors at Max", + "Max Clocks", "Avg Clocks", "Avg Vectors/Call"); else - return format (s, - "%=30s%=12s%=16s%=16s%=16s%=16s%=16s", - "Name", "State", "Calls", "Vectors", "Suspends", - "Clocks", "Vectors/Call"); + s = format (s, + "%=30s%=12s%=16s%=16s%=16s%=16s%=16s", + "Name", "State", "Calls", "Vectors", "Suspends", + "Clocks", "Vectors/Call"); + if (vm->perf_counter_id) + s = format (s, "%=16s", "Perf Ticks"); + + return s; } indent = format_get_indent (s); @@ -176,6 +182,13 @@ format_vlib_node_stats (u8 * s, va_list * va) else maxcn = 0.0; + pmc_ticks = n->stats_total.perf_counter_ticks - + n->stats_last_clear.perf_counter_ticks; + if (p > 0) + pmc_ticks_per_packet = (f64) pmc_ticks / (f64) p; + else + pmc_ticks_per_packet = 0.0; + /* Clocks per packet, per call or per suspend. */ x = 0; if (p > 0) @@ -208,6 +221,9 @@ format_vlib_node_stats (u8 * s, va_list * va) s = format (s, "%-30v%=12U%16Ld%16Ld%16Ld%16.2e%16.2f", ns, format_vlib_node_state, vm, n, c, p, d, x, v); + if (pmc_ticks_per_packet > 0.0) + s = format (s, "%16.2e", pmc_ticks_per_packet); + if (ns != n->name) vec_free (ns); |