Projects
osmocom:master
libosmocore
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 37
View file
libosmocore.spec
Changed
@@ -14,13 +14,13 @@ Name: libosmocore Requires: osmocom-master -Version: 1.7.0.86.23a7 +Version: 1.7.0.87.7a79 Release: 0 Summary: The Open Source Mobile Communications Core Library License: GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later AND AGPL-3.0-or-later Group: Productivity/Telephony/Utilities Url: https://osmocom.org/projects/libosmocore/wiki/Libosmocore -Source: libosmocore_1.7.0.86.23a7.tar.xz +Source: libosmocore_1.7.0.87.7a79.tar.xz Source1: rpmlintrc BuildRequires: automake >= 1.6 BuildRequires: libtool >= 2
View file
commit_23a7d0740c7879b5c6d1f883b6a999359932547b.txt
Deleted
View file
commit_7a79dd3dab4986ce159a42907cb074c6d25b856b.txt
Added
View file
libosmocore_1.7.0.86.23a7.dsc -> libosmocore_1.7.0.87.7a79.dsc
Changed
@@ -2,7 +2,7 @@ Source: libosmocore Binary: libosmocore, libosmocodec0, libosmocodec-doc, libosmocoding0, libosmocoding-doc, libosmocore19, libosmocore-doc, libosmogb14, libosmogb-doc, libosmogsm18, libosmogsm-doc, libosmovty9, libosmovty-doc, libosmoctrl0, libosmoctrl-doc, libosmosim2, libosmousb0, libosmocore-dev, libosmocore-utils, libosmocore-dbg Architecture: any all -Version: 1.7.0.86.23a7 +Version: 1.7.0.87.7a79 Maintainer: Osmocom team <openbsc@lists.osmocom.org> Homepage: https://projects.osmocom.org/projects/libosmocore Standards-Version: 3.9.8 @@ -31,8 +31,8 @@ libosmovty-doc deb doc optional arch=all libosmovty9 deb libs optional arch=any Checksums-Sha1: - a294756db8836d168e15e6e39b215307802cc282 1002800 libosmocore_1.7.0.86.23a7.tar.xz + 22168c3abadbf3d5dd17e3bcb7c98abb754b1df9 1004348 libosmocore_1.7.0.87.7a79.tar.xz Checksums-Sha256: - 86f10b05fdcaf9b5288736064f77a89397ef94c83fe796bd608ea626f8392b6f 1002800 libosmocore_1.7.0.86.23a7.tar.xz + 0780cf24c5c40cd063a2a28a8d1be7c2eb8fcc2dc26bd5cebc38321a5a084f03 1004348 libosmocore_1.7.0.87.7a79.tar.xz Files: - 128a570198b7040fa84ac778e4fde632 1002800 libosmocore_1.7.0.86.23a7.tar.xz + 519c08f1872847a54338c04150b1f39b 1004348 libosmocore_1.7.0.87.7a79.tar.xz
View file
libosmocore_1.7.0.86.23a7.tar.xz/.tarball-version -> libosmocore_1.7.0.87.7a79.tar.xz/.tarball-version
Changed
@@ -1 +1 @@ -1.7.0.86-23a7 +1.7.0.87-7a79
View file
libosmocore_1.7.0.86.23a7.tar.xz/configure.ac -> libosmocore_1.7.0.87.7a79.tar.xz/configure.ac
Changed
@@ -599,6 +599,7 @@ tests/Makefile tests/atlocal utils/Makefile + utils/osmo-stat-dummy/Makefile Doxyfile.core Doxyfile.gsm Doxyfile.vty
View file
libosmocore_1.7.0.86.23a7.tar.xz/debian/changelog -> libosmocore_1.7.0.87.7a79.tar.xz/debian/changelog
Changed
@@ -1,8 +1,8 @@ -libosmocore (1.7.0.86.23a7) unstable; urgency=medium +libosmocore (1.7.0.87.7a79) unstable; urgency=medium * Automatically generated changelog entry for building the Osmocom master feed - -- Osmocom OBS scripts <info@osmocom.org> Mon, 19 Dec 2022 15:57:37 +0000 + -- Osmocom OBS scripts <info@osmocom.org> Tue, 20 Dec 2022 11:32:37 +0000 libosmocore (1.7.0) unstable; urgency=medium
View file
libosmocore_1.7.0.86.23a7.tar.xz/utils/Makefile.am -> libosmocore_1.7.0.87.7a79.tar.xz/utils/Makefile.am
Changed
@@ -29,6 +29,10 @@ endif if ENABLE_EXT_TESTS +SUBDIRS = \ + osmo-stat-dummy \ + $(NULL) + if ENABLE_GB noinst_PROGRAMS += osmo-ns-dummy osmo_ns_dummy_SOURCES = osmo-ns-dummy.c osmo-ns-dummy-vty.c
View file
libosmocore_1.7.0.87.7a79.tar.xz/utils/osmo-stat-dummy
Added
+(directory)
View file
libosmocore_1.7.0.87.7a79.tar.xz/utils/osmo-stat-dummy/Makefile.am
Added
@@ -0,0 +1,8 @@ +noinst_PROGRAMS = osmo-stat-dummy +osmo_stat_dummy_SOURCES = osmo-stat-dummy.c +osmo_stat_dummy_LDADD = $(LDADD) $(TALLOC_LIBS) \ + $(top_builddir)/src/vty/libosmovty.la \ + $(top_builddir)/src/ctrl/libosmoctrl.la \ + $(top_builddir)/src/libosmocore.la +osmo_stat_dummy_CFLAGS = -Wall $(TALLOC_CFLAGS) $(LIBOSMOCORE_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(LIBOSMOCTRL_CFLAGS) +osmo_stat_dummy_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
View file
libosmocore_1.7.0.87.7a79.tar.xz/utils/osmo-stat-dummy/README.md
Added
@@ -0,0 +1,12 @@ +# Osmocom utilities + +* osmo-stat-dummy: utility for rate counter and statsd testing + +It has 2 rate counters: one ticks twice a seconds, another one can be manually updated with 'update-rate-ctr' command via vty. + +The raw value is sent via statsd protocol. If you install "netdata" monitoring tool than you can open http://localhost:19999 in browser +and observe live counters monitoring under "StatsD dummy" without any additional setup. + +Opening osmo-stat-dummy.html in browser while both netdata and osmo-stat-dummy are running will show dimensioned (per min/hour/day) rate counters as well as raw data. + +The latter is handy for troubleshooting and comparing libosmocore's internal rate counter computation.
View file
libosmocore_1.7.0.87.7a79.tar.xz/utils/osmo-stat-dummy/osmo-stat-dummy.c
Added
@@ -0,0 +1,335 @@ +/* Rate counter and statsd test application */ +/* (C) 2022 by by sysmocom - s.f.m.c. GmbH + * 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 3 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. + * + */ + +#include <errno.h> +#include <stdlib.h> +#include <stdio.h> +#include <getopt.h> +#include <signal.h> +#include <unistd.h> +#include <inttypes.h> + +#include <osmocom/core/select.h> +#include <osmocom/core/application.h> +#include <osmocom/core/stats.h> +#include <osmocom/ctrl/control_if.h> +#include <osmocom/ctrl/control_vty.h> +#include <osmocom/vty/vty.h> +#include <osmocom/vty/telnet_interface.h> +#include <osmocom/vty/command.h> +#include <osmocom/vty/ports.h> +#include <osmocom/vty/tdef_vty.h> +#include <osmocom/vty/logging.h> +#include <osmocom/vty/stats.h> +#include <osmocom/vty/misc.h> + +#include "../../config.h" + +void *tall_statdummy_ctx = NULL; +static bool quit = false; +static bool config_given = false; +struct rate_ctr_group *g_ctrg; + +enum dummy_rate_ctr_idx { + DUMMY_VTY = 0, + DUMMY_AUTO, +}; + +static void print_help(void) +{ + printf("Some useful options:\n" + " -h --help This text\n" + " -c --config-file Specify the filename of the config file\n" + " -V --version Print version\n" + "\nVTY reference generation:\n" + " --vty-ref-mode MODE VTY reference generation mode (e.g. 'expert').\n" + " --vty-ref-xml Generate the VTY reference XML output and exit.\n" + ); +} + +static void handle_long_options(const char *prog_name, const int long_option) +{ + static int vty_ref_mode = VTY_REF_GEN_MODE_DEFAULT; + + switch (long_option) { + case 1: + vty_ref_mode = get_string_value(vty_ref_gen_mode_names, optarg); + if (vty_ref_mode < 0) { + fprintf(stderr, "%s: Unknown VTY reference generation mode '%s'\n", prog_name, optarg); + exit(2); + } + break; + case 2: + fprintf(stderr, "Generating the VTY reference in mode '%s' (%s)\n", + get_value_string(vty_ref_gen_mode_names, vty_ref_mode), + get_value_string(vty_ref_gen_mode_desc, vty_ref_mode)); + vty_dump_xml_ref_mode(stdout, (enum vty_ref_gen_mode) vty_ref_mode); + exit(0); + default: + fprintf(stderr, "%s: error parsing cmdline options\n", prog_name); + exit(2); + } +} + +static char *handle_options(int argc, char **argv) +{ + char *config_file = NULL; + + while (1) { + int option_idx = 0, c; + static int long_option = 0; + static const struct option long_options = { + { "help", 0, 0, 'h' }, + { "config-file", 1, 0, 'c' }, + { "version", 0, 0, 'V' }, + { "vty-ref-mode", 1, &long_option, 1 }, + { "vty-ref-xml", 0, &long_option, 2 }, + { 0, 0, 0, 0 } + }; + + c = getopt_long(argc, argv, "hc:V", long_options, &option_idx); + if (c == -1) + break; + + switch (c) { + case 'h': + print_help(); + exit(0); + break; + case 0: + handle_long_options(argv0, long_option); + break; + case 'c': + if (config_file) + free(config_file); + config_file = optarg; + config_given = true; + break; + case 'V': + print_version(1); + exit(0); + break; + default: + fprintf(stderr, "Unknown option '%c'\n", c); + exit(0); + break; + } + } + + if (!config_file) + return "osmo-stat-dummy.cfg"; + + return config_file; +} + +void sighandler(int sigset) +{ + if (sigset == SIGPIPE) + return; + + fprintf(stderr, "Signal %d received.\n", sigset); + + switch (sigset) { + case SIGINT: + case SIGTERM: + /* If another signal is received afterwards, the program + * is terminated without finishing shutdown process. + */ + signal(SIGINT, SIG_DFL); + signal(SIGTERM, SIG_DFL); + signal(SIGPIPE, SIG_DFL); + signal(SIGABRT, SIG_DFL); + signal(SIGUSR1, SIG_DFL); + signal(SIGUSR2, SIG_DFL); + + quit = 1; + break; + case SIGABRT: + /* in case of abort, we want to obtain a talloc report and + * then run default SIGABRT handler, who will generate coredump + * and abort the process. abort() should do this for us after we + * return, but program wouldn't exit if an external SIGABRT is + * received. + */ + talloc_report_full(tall_statdummy_ctx, stderr); + signal(SIGABRT, SIG_DFL); + raise(SIGABRT); + break; + case SIGUSR1: + case SIGUSR2: + talloc_report_full(tall_statdummy_ctx, stderr); + break; + } +} + +static int rate_ctr_timer_cb(struct osmo_fd *ofd, unsigned int what) +{ + uint64_t expire_count; + int rc; + + /* check that the timer has actually expired */ + if (!(what & OSMO_FD_READ)) + return 0; + + /* read from timerfd: number of expirations of periodic timer */ + rc = read(ofd->fd, (void *) &expire_count, sizeof(expire_count)); + if (rc < 0 && errno == EAGAIN) + return 0; + + OSMO_ASSERT(rc == sizeof(expire_count)); + + if (expire_count > 1) + LOGP(DLGLOBAL, LOGL_NOTICE, "Stats timer expire_count=%" PRIu64 ": We missed %" PRIu64 " timers\n", + expire_count, expire_count-1); + + /* Increment the counter value */ + rate_ctr_inc(rate_ctr_group_get_ctr(g_ctrg, DUMMY_AUTO)); + + return 0; +} + +DEFUN(update_rate_ctr, update_rate_ctr_cmd, + "update-rate-ctr <0-100000>", + "Update dummy rate counter\n" + "Value to add to rate counter\n") +{ + rate_ctr_add(rate_ctr_group_get_ctr(g_ctrg, DUMMY_VTY), atoi(argv0)); + + return CMD_SUCCESS; +} + +static int statdummy_vty_init(void) +{ + install_element_ve(&update_rate_ctr_cmd); + + return 0; +} + +int main(int argc, char *argv) +{ + struct log_info log_info = {}; + char *config_file; + void *ctx = tall_statdummy_ctx = talloc_named_const(NULL, 0, "osmo-stat-dummy"); + struct ctrl_handle *ctrl; + struct osmo_fd rate_ctr_timer = { .fd = -1 }; + struct timespec ts_interval = { .tv_sec = 0, .tv_nsec = 500000000 }; /* 0.5 seconds */ + int rc = 0; + + const char vty_copyright = + "Copyright (C) 2022 by by sysmocom - s.f.m.c. GmbH\r\n" + "Author: Max Suraev <msuraev@sysmocom.de>\r\n" + "License GNU GPL version 3 or later\r\n" + "This is free software: you are free to change and redistribute it.\r\n" + "There is NO WARRANTY, to the extent permitted by law.\r\n"; + + struct vty_app_info vty_info = { + .name = "OsmoSTATdummy", + .version = PACKAGE_VERSION, + .copyright = vty_copyright, + .tall_ctx = ctx + }; + + const struct rate_ctr_desc dummy_ctr_desc = { + DUMMY_VTY = { "dummy:vty", "Dummy counter updated via VTY" }, + DUMMY_AUTO = { "dummy:auto", "Dummy counter autoupdated via timer" }, + }; + + const struct rate_ctr_group_desc dummy_ctrg_desc = { + "dummy", + "dummy stat tester", + OSMO_STATS_CLASS_GLOBAL, + ARRAY_SIZE(dummy_ctr_desc), + dummy_ctr_desc, + }; + + osmo_init_logging2(ctx, &log_info); + log_set_use_color(osmo_stderr_target, 0); + log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE); + log_set_log_level(osmo_stderr_target, LOGL_INFO); + + msgb_talloc_ctx_init(ctx, 0); + + vty_init(&vty_info); + ctrl_vty_init(ctx); + logging_vty_add_cmds(); + osmo_stats_vty_add_cmds(); + osmo_talloc_vty_add_cmds(); + + config_file = handle_options(argc, argv); + + statdummy_vty_init(); + rc = vty_read_config_file(config_file, NULL); + if (rc < 0) { + if (config_given) { + fprintf(stderr, "Failed to parse the config file: '%s'\n", config_file); + exit(1); + } + fprintf(stderr, "No config file: '%s' Using default config.\n", config_file); + } + + rc = telnet_init_default(ctx, NULL, -1); + if (rc < 0) { + fprintf(stderr, "Error initializing telnet\n"); + exit(1); + } + + ctrl = ctrl_interface_setup(NULL, 1234, NULL); + if (!ctrl) { + fprintf(stderr, "Failed to initialize control interface. Exiting.\n"); + exit(1); + } + + g_ctrg = rate_ctr_group_alloc(ctx, &dummy_ctrg_desc, 0); + if (!g_ctrg) { + fprintf(stderr, "Failed to initialize rate counters. Exiting.\n"); + return -1; + } + + osmo_stats_init(ctx); + rate_ctr_init(ctx); + + rc = osmo_timerfd_setup(&rate_ctr_timer, rate_ctr_timer_cb, NULL); + if (rc < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, "Failed to setup the timer with error code %d (fd=%d)\n", + rc, rate_ctr_timer.fd); + return rc; + } + + rc = osmo_timerfd_schedule(&rate_ctr_timer, NULL, &ts_interval); + if (rc < 0) { + LOGP(DLGLOBAL, LOGL_ERROR, "Failed to schedule the timer with error code %d (fd=%d)\n", + rc, rate_ctr_timer.fd); + } + + signal(SIGINT, sighandler); + signal(SIGTERM, sighandler); + signal(SIGPIPE, sighandler); + signal(SIGABRT, sighandler); + signal(SIGUSR1, sighandler); + signal(SIGUSR2, sighandler); + osmo_init_ignore_signals(); + + while (!quit) { + osmo_select_main(0); + } + + telnet_exit(); + + talloc_report_full(tall_statdummy_ctx, stderr); + talloc_free(tall_statdummy_ctx); + + return 0; +}
View file
libosmocore_1.7.0.87.7a79.tar.xz/utils/osmo-stat-dummy/osmo-stat-dummy.cfg
Added
@@ -0,0 +1,40 @@ +log stderr + logging filter all 1 + logging color 0 + logging timestamp 0 + logging print extended-timestamp 0 + logging print category-hex 0 + logging print category 1 + !logging print file basename + ! log-levels defined by libosmocore and hence available everywhere, can be overridden by inidividual per-app configs below + logging level lstats notice + logging level lglobal notice + logging level llapd notice + logging level linp notice + logging level lmux notice + logging level lmi notice + logging level lmib notice + logging level lsms notice + logging level lctrl notice + logging level lgtp notice + logging level lgsup notice + logging level loap notice + logging level lss7 error + logging level lsccp notice + logging level lsua notice + logging level lm3ua notice + logging level lmgcp notice + logging level ljibuf notice + logging level lrspro notice +stats reporter statsd + !use default https://learn.netdata.cloud/ statsd plugin: + remote-ip 127.0.0.1 + remote-port 8125 + level global + no prefix + enable +stats interval 1 +line vty + bind 127.0.0.2 6969 +ctrl + bind 127.0.0.11 1234
View file
libosmocore_1.7.0.87.7a79.tar.xz/utils/osmo-stat-dummy/osmo-stat-dummy.html
Added
@@ -0,0 +1,59 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="apple-mobile-web-app-capable" content="yes"> + <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> +</head> +<body> + <div data-netdata="statsd_dummy.0.dummy.auto_counter" + data-chart-library="dygraph" + data-title="raw data (timerfd ticks twice per second)" + data-width="600" + data-height="200" + data-after="-600" + ></div> + <div data-netdata="statsd_dummy.0.dummy.auto_counter" + data-chart-library="dygraph" + data-title="aggregated per minute (timerfd ticks twice per second)" + data-width="600" + data-height="200" + data-after="-600" + data-method="average" + data-gtime="60" + data-units="events/min" + ></div> + <div data-netdata="statsd_dummy.0.dummy.auto_counter" + data-chart-library="dygraph" + data-title="aggregated per hour (timerfd ticks twice per second)" + data-width="600" + data-height="200" + data-after="-600" + data-method="average" + data-gtime="3600" + data-units="events/hour" + ></div> + <div data-netdata="statsd_dummy.0.dummy.auto_counter" + data-chart-library="dygraph" + data-title="aggregated per day (timerfd ticks twice per second)" + data-width="600" + data-height="200" + data-after="-600" + data-method="average" + data-gtime="86400" + data-units="events/day" + ></div> + + <div data-netdata="statsd_dummy.0.dummy.vty_counter" + data-chart-library="dygraph" + data-title="raw data (updated manually via vty command)" + data-width="600" + data-height="200" + data-after="-600" + ></div> +</body> +<script type="text/javascript" src="http://localhost:19999/dashboard.js"></script> +</html>
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.