summaryrefslogtreecommitdiff
path: root/accel-pppd/extra
diff options
context:
space:
mode:
authorDenys Fedoryshchenko <denys.f@collabora.com>2026-04-29 15:29:20 +0300
committerDenys Fedoryshchenko <denys.f@collabora.com>2026-05-04 03:09:49 +0300
commite5fe0eaa1fc6b1109db784e818e360159d8dd2ac (patch)
tree8171a65c511849b941fbf492514cb5c89918b4e4 /accel-pppd/extra
parentd6383d69813cf2244f31d8116176733ffbbeaceb (diff)
downloadaccel-ppp-e5fe0eaa1fc6b1109db784e818e360159d8dd2ac.tar.gz
accel-ppp-e5fe0eaa1fc6b1109db784e818e360159d8dd2ac.zip
triton: encapsulate statistics counters
Group the Triton core statistics in struct triton_stat_t and keep the storage private to triton.c instead of exporting the writable triton_stat object through triton.h. This keeps ownership inside the Triton core while preserving the existing CLI and ACCEL-PPP-MIB counter semantics. Route counter updates through triton_stat_*() helpers. Thread, context, md handler, timer, mempool, CPU, and start-time update paths no longer open-code direct triton_stat mutations; the update policy now lives beside the Triton-owned storage and uses relaxed atomic operations for the simple counters. Make the CLI show-stat path render from a local snapshot and update statCore SNMP readers to use triton_stat_start_time() and triton_stat_cpu(). Out-of-tree modules that accessed the exported triton_stat object directly must switch to the new accessors, because triton_stat is no longer part of the public ABI. Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Diffstat (limited to 'accel-pppd/extra')
-rw-r--r--accel-pppd/extra/net-snmp/statCore.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/accel-pppd/extra/net-snmp/statCore.c b/accel-pppd/extra/net-snmp/statCore.c
index 9206f6ed..7e9047da 100644
--- a/accel-pppd/extra/net-snmp/statCore.c
+++ b/accel-pppd/extra/net-snmp/statCore.c
@@ -49,7 +49,7 @@ handle_statCoreUpTime(netsnmp_mib_handler *handler,
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
- ts.tv_sec -= triton_stat.start_time;
+ ts.tv_sec -= triton_stat_start_time();
/* We are never called for a GETNEXT if it's registered as a
"instance", as it's "magically" handled for us. */
@@ -91,7 +91,7 @@ handle_statCoreCPU(netsnmp_mib_handler *handler,
switch(reqinfo->mode) {
case MODE_GET:
- cpu = triton_stat.cpu;
+ cpu = triton_stat_cpu();
snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
(u_char *)&cpu /* XXX: a pointer to the scalar's data */,
sizeof(cpu)/* XXX: the length of the data in bytes */);