From 89deee9b99800435da31ba3719a9a603c07448b4 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 13 May 2010 11:53:52 +0200 Subject: Add missing file vty/utils.c --- openbsc/src/vty/utils.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 openbsc/src/vty/utils.c (limited to 'openbsc/src/vty') diff --git a/openbsc/src/vty/utils.c b/openbsc/src/vty/utils.c new file mode 100644 index 000000000..d8dfb8ef9 --- /dev/null +++ b/openbsc/src/vty/utils.c @@ -0,0 +1,50 @@ +/* utility routines for printing common objects in the Osmocom world */ + +/* (C) 2009-2010 by Harald Welte + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include +#include + +#include +#include +#include +#include + +#include + +void vty_out_rate_ctr_group(struct vty *vty, const char *prefix, + struct rate_ctr_group *ctrg) +{ + unsigned int i; + + vty_out(vty, "%s%s:%s", prefix, ctrg->desc->group_description, VTY_NEWLINE); + for (i = 0; i < ctrg->desc->num_ctr; i++) { + struct rate_ctr *ctr = &ctrg->ctr[i]; + vty_out(vty, " %s%s: %8" PRIu64 " " + "(%" PRIu64 "/s %" PRIu64 "/m %" PRIu64 "/h %" PRIu64 "/d)%s", + prefix, ctrg->desc->ctr_desc[i].description, ctr->current, + ctr->intv[RATE_CTR_INTV_SEC].rate, + ctr->intv[RATE_CTR_INTV_MIN].rate, + ctr->intv[RATE_CTR_INTV_HOUR].rate, + ctr->intv[RATE_CTR_INTV_DAY].rate, + VTY_NEWLINE); + }; +} -- cgit v1.2.3