Change in libosmocore[master]: Add a 'show rate-counters' VTY command.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri May 25 08:36:43 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9278 )

Change subject: Add a 'show rate-counters' VTY command.
......................................................................

Add a 'show rate-counters' VTY command.

Add a new VTY command which shows all rate counters registered
with libosmocore.

Change-Id: Id60a5aa2d961ae99cddf1e776358a5517dbc573d
Depends: Idb3ec12494ff6a3a05efcc8818e78d1baa6546bd
Related: OS#3245
---
M src/vty/stats_vty.c
1 file changed, 17 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/vty/stats_vty.c b/src/vty/stats_vty.c
index faa136d..8d90945 100644
--- a/src/vty/stats_vty.c
+++ b/src/vty/stats_vty.c
@@ -527,6 +527,22 @@
 	return CMD_SUCCESS;
 }
 
+static int rate_ctr_group_handler(struct rate_ctr_group *ctrg, void *sctx_)
+{
+	struct vty *vty = sctx_;
+	vty_out_rate_ctr_group_fmt(vty, "%25n: %10c (%S/s %M/m %H/h %D/d) %d", ctrg);
+	return 0;
+}
+
+DEFUN(show_rate_counters,
+      show_rate_counters_cmd,
+      "show rate-counters",
+      SHOW_STR "Show all rate counters\n")
+{
+	rate_ctr_for_each_group(rate_ctr_group_handler, vty);
+	return CMD_SUCCESS;
+}
+
 static int config_write_stats_reporter(struct vty *vty, struct osmo_stats_reporter *srep)
 {
 	if (srep == NULL)
@@ -620,4 +636,5 @@
 	install_element(CFG_STATS_NODE, &cfg_stats_reporter_disable_cmd);
 
 	install_element_ve(&show_stats_asciidoc_table_cmd);
+	install_element_ve(&show_rate_counters_cmd);
 }

-- 
To view, visit https://gerrit.osmocom.org/9278
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id60a5aa2d961ae99cddf1e776358a5517dbc573d
Gerrit-Change-Number: 9278
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180525/ee67564c/attachment.htm>


More information about the gerrit-log mailing list