Change in libosmocore[master]: support for stats static userspace probes via systemtap

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/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Feb 18 13:59:58 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/22958 )


Change subject: support for stats static userspace probes via systemtap
......................................................................

support for stats static userspace probes via systemtap

We currently only have probes for the logging sub-system.

This patch adds two tracepoints for tracing the performance
impact of statistics reporting: stat_start and stat_done.

They can be used to trace the amount of time a libosmocore-using
application spends in reporting/exporting statistics.  This includes
both the CPU time for encoding the statistics, as well as the system
calls for sending them.

Change-Id: I7208c45f6d051505dd2435305c67b4d26c0b1dd2
Related: OS#4311
Related: SYS#4877
---
M src/probes.d
M src/stats.c
M tapset/libosmocore.stp
3 files changed, 26 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/58/22958/1

diff --git a/src/probes.d b/src/probes.d
index c16eb1e..e4150f0 100644
--- a/src/probes.d
+++ b/src/probes.d
@@ -1,4 +1,6 @@
 provider libosmocore {
 	probe log_start();
 	probe log_done();
+	probe stats_start();
+	probe stats_done();
 };
diff --git a/src/stats.c b/src/stats.c
index c91a978..a0834d2 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -90,6 +90,17 @@
 #include <osmocom/core/counter.h>
 #include <osmocom/core/msgb.h>
 
+#ifdef HAVE_SYSTEMTAP
+/* include the generated probes header and put markers in code */
+#include "probes.h"
+#define TRACE(probe) probe
+#define TRACE_ENABLED(probe) probe ## _ENABLED()
+#else
+/* Wrap the probe to allow it to be removed when no systemtap available */
+#define TRACE(probe)
+#define TRACE_ENABLED(probe) (0)
+#endif /* HAVE_SYSTEMTAP */
+
 #define STATS_DEFAULT_INTERVAL 5 /* secs */
 #define STATS_DEFAULT_BUFLEN 256
 
@@ -781,6 +792,7 @@
 int osmo_stats_report()
 {
 	/* per group actions */
+	TRACE(LIBOSMOCORE_STATS_START());
 	osmo_counters_for_each(handle_counter, NULL);
 	rate_ctr_for_each_group(rate_ctr_group_handler, NULL);
 	osmo_stat_item_for_each_group(osmo_stat_item_group_handler, NULL);
@@ -788,6 +800,7 @@
 	/* global actions */
 	osmo_stat_item_discard_all(&current_stat_item_index);
 	flush_all_reporters();
+	TRACE(LIBOSMOCORE_STATS_DONE());
 
 	return 0;
 }
diff --git a/tapset/libosmocore.stp b/tapset/libosmocore.stp
index 0ec3c42..a3e8f21 100644
--- a/tapset/libosmocore.stp
+++ b/tapset/libosmocore.stp
@@ -16,3 +16,14 @@
 {
  probestr = sprintf("%s", $$name);
 }
+
+probe libosmocore_stats_start = process("libosmocore").mark("statsd_start")
+{
+ count = $arg1;
+ probestr = sprintf("%s(count=%d), $$name, count);
+}
+
+probe libosmocore_stats_done = process("libosmocore").mark("statsd_done")
+{
+ probestr = sprintf("%s", $$name);
+}

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7208c45f6d051505dd2435305c67b4d26c0b1dd2
Gerrit-Change-Number: 22958
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210218/01d4e1ad/attachment.htm>


More information about the gerrit-log mailing list