ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
stats.c File Reference

Go to the source code of this file.

Data Structures

struct  stats_duration_cell_t
struct  stats_duration_shard_t
 For stats duration cell, this is the live record that ties sequence, observations, total_ns, min_ns together. The owning code creates it, updates it while work is active, and releases its handles and pointed-to storage before freeing the record. More...
struct  stats_scope
 stats duration shard keeps the values that move through the subsystem: owner. Some members are pointers into caller- or subsystem-owned memory, so lifetime follows the API that populated them rather than the struct copy itself. More...
struct  stats_sampler
 This is the handoff point for stats scope. Callers fill observer, observer_context, id, started_ns before passing it on; consumers read the values during the operation and return ownership only where the member contract explicitly says they do. More...

Macros

#define STATS_DURATION_SHARDS   16

Functions

asciichat_error_t stats_scope_create (const stats_capabilities_t *capabilities, stats_scope_t **out_scope)
void stats_scope_destroy (stats_scope_t *scope)
void stats_scope_set_observer (stats_scope_t *scope, stats_observer_fn observer, void *context)
void stats_counter_add (stats_scope_t *scope, stats_counter_id_t id, uint64_t amount)
void stats_gauge_set (stats_scope_t *scope, stats_gauge_id_t id, uint64_t value)
void stats_duration_record (stats_scope_t *scope, stats_duration_id_t id, uint64_t elapsed_ns)
asciichat_error_t stats_scope_snapshot (const stats_scope_t *scope, stats_snapshot_t *out)
 stats sampler config keeps the values that move through the subsystem: window_ns, resolution_ns. Some members are pointers into caller- or subsystem-owned memory, so lifetime follows the API that populated them rather than the struct copy itself.
asciichat_error_t stats_sampler_create (const stats_sampler_config_t *config, stats_sampler_t **out_sampler)
asciichat_error_t stats_sampler_update (stats_sampler_t *sampler, const stats_snapshot_t *snapshot, stats_rates_t *out_rates)
void stats_sampler_destroy (stats_sampler_t *sampler)

Macro Definition Documentation

◆ STATS_DURATION_SHARDS

#define STATS_DURATION_SHARDS   16

Definition at line 12 of file lib/stats/stats.c.

Referenced by stats_scope_snapshot().

Function Documentation

◆ stats_counter_add()

void stats_counter_add ( stats_scope_t * scope,
stats_counter_id_t id,
uint64_t amount )

Thread-safe recording with no module allocations. Platform mutex diagnostics may initialize per-thread storage on first use in debug builds. NULL, invalid IDs, and unsupported metrics are ignored. Counters and duration totals wrap at UINT64_MAX; samplers rebaseline on observed decreases. Durations measure attempts (including failures); successful operations are counted separately. A gauge's producer owns its current value.

Definition at line 120 of file lib/stats/stats.c.

121 {
122 if (scope && (unsigned)id < STATS_COUNTER_COUNT &&
123 scope->capabilities.counters[id]) {
124 atomic_fetch_add_u64_impl(&scope->counters[id], amount);
125 if (scope->observer)
126 scope->observer(STATS_RECORD_COUNTER, id, amount,
127 scope->observer_context);
128 }
129}
uint64_t atomic_fetch_add_u64_impl(atomic_t *a, uint64_t delta)
bool counters[STATS_COUNTER_COUNT]
atomic_t counters[STATS_COUNTER_COUNT]
stats_capabilities_t capabilities
stats_observer_fn observer
void * observer_context

References atomic_fetch_add_u64_impl(), stats_scope::capabilities, stats_capabilities_t::counters, stats_scope::counters, stats_scope::observer, stats_scope::observer_context, STATS_COUNTER_COUNT, and STATS_RECORD_COUNTER.

Referenced by acip_handle_acds_packet(), acip_send_session_joined(), client_video_render_thread(), database_session_cleanup_expired(), database_session_update_host(), h265_decode(), h265_encode(), h265_encoder_flush(), http_request_cancel(), http_response_finish(), http_server_authorize(), http_server_dispatch_http3(), mcp_dispatch(), mcp_error(), packet_decode_frame_data_malloc(), packet_decode_frame_data_workspace(), rate_limiter_check(), session_display_encode_frame(), stats_runtime_packet(), and video_frame_commit().

◆ stats_duration_record()

void stats_duration_record ( stats_scope_t * scope,
stats_duration_id_t id,
uint64_t elapsed_ns )

Definition at line 165 of file lib/stats/stats.c.

166 {
167 if (!scope || (unsigned)id >= STATS_DURATION_COUNT ||
168 !scope->capabilities.durations[id])
169 return;
170 stats_duration_shard_t *shard = duration_shard(scope);
171 if (shard) {
172 stats_duration_cell_t *cell = &shard->durations[id];
173 uint64_t sequence = atomic_load(&cell->sequence);
174 atomic_store(&cell->sequence, duration_add(sequence, 1));
175 uint64_t observations = atomic_load(&cell->observations);
176 if (!observations || elapsed_ns < atomic_load(&cell->min_ns))
177 atomic_store(&cell->min_ns, elapsed_ns);
178 if (elapsed_ns > atomic_load(&cell->max_ns))
179 atomic_store(&cell->max_ns, elapsed_ns);
180 atomic_store(&cell->last_ns, elapsed_ns);
181 atomic_store(&cell->recorded_ns, time_get_ns());
182 atomic_store(&cell->observations, duration_add(observations, 1));
183 atomic_store(&cell->total_ns,
184 duration_add(atomic_load(&cell->total_ns), elapsed_ns));
185 atomic_store(&cell->sequence, duration_add(sequence, 2));
186 if (scope->observer)
187 scope->observer(STATS_RECORD_DURATION, id, elapsed_ns,
188 scope->observer_context);
189 return;
190 }
191 // Unusually many lifetime producers retain the bounded, coherent fallback.
192 if (mutex_lock(&scope->duration_mutex) != 0)
193 return;
194 stats_duration_snapshot_t *duration = &scope->durations[id];
195 duration->last_ns = elapsed_ns;
196 scope->duration_recorded_ns[id] = time_get_ns();
197 if (!duration->observations || elapsed_ns < duration->min_ns)
198 duration->min_ns = elapsed_ns;
199 if (elapsed_ns > duration->max_ns)
200 duration->max_ns = elapsed_ns;
201 duration->observations =
202 duration->observations == UINT64_MAX ? 0 : duration->observations + 1;
203 // Unsigned wrap is intentional; an observed decrease causes samplers to
204 // rebaseline.
205 duration->total_ns = duration->total_ns > UINT64_MAX - elapsed_ns
206 ? elapsed_ns - (UINT64_MAX - duration->total_ns) - 1
207 : duration->total_ns + elapsed_ns;
208 mutex_unlock(&scope->duration_mutex);
209 if (scope->observer)
210 scope->observer(STATS_RECORD_DURATION, id, elapsed_ns,
211 scope->observer_context);
212}
unsigned long long uint64_t
bool durations[STATS_DURATION_COUNT]
_Atomic uint64_t min_ns
_Atomic uint64_t recorded_ns
_Atomic uint64_t max_ns
_Atomic uint64_t last_ns
_Atomic uint64_t observations
_Atomic uint64_t total_ns
_Atomic uint64_t sequence
For stats duration cell, this is the live record that ties sequence, observations,...
stats_duration_cell_t durations[STATS_DURATION_COUNT]
mutex_t duration_mutex
stats_duration_snapshot_t durations[STATS_DURATION_COUNT]
uint64_t duration_recorded_ns[STATS_DURATION_COUNT]

References stats_scope::capabilities, stats_scope::duration_mutex, stats_scope::duration_recorded_ns, stats_capabilities_t::durations, stats_duration_shard_t::durations, stats_scope::durations, stats_duration_cell_t::last_ns, stats_duration_snapshot_t::last_ns, stats_duration_cell_t::max_ns, stats_duration_snapshot_t::max_ns, stats_duration_cell_t::min_ns, stats_duration_snapshot_t::min_ns, stats_duration_cell_t::observations, stats_duration_snapshot_t::observations, stats_scope::observer, stats_scope::observer_context, stats_duration_cell_t::recorded_ns, stats_duration_cell_t::sequence, STATS_DURATION_COUNT, STATS_RECORD_DURATION, stats_duration_cell_t::total_ns, and stats_duration_snapshot_t::total_ns.

Referenced by acip_handle_acds_packet(), client_audio_render_thread(), client_video_render_thread(), h265_decode(), h265_encode(), h265_encoder_flush(), http_server_dispatch_http3(), packet_decode_frame_data_malloc(), packet_decode_frame_data_workspace(), server_connection_pong_received(), session_display_encode_frame(), and session_host_render_audio().

◆ stats_gauge_set()

void stats_gauge_set ( stats_scope_t * scope,
stats_gauge_id_t id,
uint64_t value )

Definition at line 131 of file lib/stats/stats.c.

132 {
133 if (scope && (unsigned)id < STATS_GAUGE_COUNT &&
134 scope->capabilities.gauges[id]) {
135 atomic_store_u64_impl(&scope->gauges[id], value);
136 if (scope->observer)
137 scope->observer(STATS_RECORD_GAUGE, id, value, scope->observer_context);
138 }
139}
void atomic_store_u64_impl(atomic_t *a, uint64_t value)
atomic_t gauges[STATS_GAUGE_COUNT]

References atomic_store_u64_impl(), stats_scope::capabilities, stats_capabilities_t::gauges, stats_scope::gauges, stats_scope::observer, stats_scope::observer_context, STATS_GAUGE_COUNT, and STATS_RECORD_GAUGE.

Referenced by database_stats_snapshot(), http_server_dispatch_http3(), stats_runtime_peer_close(), and stats_runtime_peer_open().

◆ stats_sampler_create()

asciichat_error_t stats_sampler_create ( const stats_sampler_config_t * config,
stats_sampler_t ** out_sampler )

Bounded history: ceil(window/resolution) must be in [1, 4096]. Both durations must be nonzero and resolution <= window. Each consumer owns its own sampler; sampler operations are not thread-safe. All allocation happens at creation.

Definition at line 281 of file lib/stats/stats.c.

282 {
283 if (!out_sampler)
284 return SET_ERRNO(ERROR_INVALID_PARAM, "Missing stats sampler output");
285 *out_sampler = NULL;
286 if (!config || !config->resolution_ns ||
287 config->window_ns < config->resolution_ns)
288 return SET_ERRNO(ERROR_INVALID_PARAM, "Invalid stats sampling interval");
289 uint64_t slots = config->window_ns / config->resolution_ns +
290 (config->window_ns % config->resolution_ns != 0);
291 if (slots > 4096)
293 "Stats sampler exceeds 4096 history intervals");
294 stats_sampler_t *sampler =
295 SAFE_CALLOC(1, sizeof(*sampler), stats_sampler_t *);
296 if (!sampler)
297 return SET_ERRNO(ERROR_MEMORY, "Cannot allocate stats sampler");
298 sampler->capacity = (size_t)slots + 2;
299 sampler->history = SAFE_CALLOC(sampler->capacity, sizeof(*sampler->history),
301 if (!sampler->history) {
302 SAFE_FREE(sampler);
303 return SET_ERRNO(ERROR_MEMORY, "Cannot allocate stats history");
304 }
305 sampler->config = *config;
306 *out_sampler = sampler;
307 return ASCIICHAT_OK;
308}
#define SET_ERRNO(code,...)
#define SAFE_FREE(ptr)
#define SAFE_CALLOC(count, size, cast)
@ ERROR_MEMORY
Definition error_codes.h:55
@ ASCIICHAT_OK
Definition error_codes.h:50
@ ERROR_INVALID_PARAM
struct stats_sampler stats_sampler_t
stats_sampler_config_t config
stats_snapshot_t * history

References ASCIICHAT_OK, stats_sampler::capacity, stats_sampler::config, ERROR_INVALID_PARAM, ERROR_MEMORY, stats_sampler::history, stats_sampler_config_t::resolution_ns, SAFE_CALLOC, SAFE_FREE, SET_ERRNO, and stats_sampler_config_t::window_ns.

Referenced by stats_runtime_peer_open(), and stats_runtime_start().

◆ stats_sampler_destroy()

void stats_sampler_destroy ( stats_sampler_t * sampler)

Definition at line 387 of file lib/stats/stats.c.

387 {
388 if (!sampler)
389 return;
390 SAFE_FREE(sampler->history);
391 SAFE_FREE(sampler);
392}

References stats_sampler::history, and SAFE_FREE.

Referenced by stats_runtime_peer_close(), stats_runtime_start(), and stats_runtime_stop().

◆ stats_sampler_update()

asciichat_error_t stats_sampler_update ( stats_sampler_t * sampler,
const stats_snapshot_t * snapshot,
stats_rates_t * out_rates )

Samples must be supplied regularly, even while idle. Rates use actual elapsed time from the latest retained sample at/before the window boundary (or the oldest available sample during warmup). Resolution controls history retention, not calls. ready becomes true with a positive interval; elapsed_ns exposes window warmup. Scope/capability changes, nonincreasing timestamps, or decreasing totals reset the baseline and return ready=false. Unsupported values are zero/invalid; consult the snapshot capabilities to distinguish unsupported counters from measured zero.

Definition at line 330 of file lib/stats/stats.c.

332 {
333 if (!sampler || !snapshot || !out_rates)
335 "Missing stats sampler, snapshot, or rates output");
336 memset(out_rates, 0, sizeof(*out_rates));
337 if (!sampler->count || stats_baseline_changed(&sampler->latest, snapshot)) {
338 sampler->head = 0;
339 sampler->count = 1;
340 sampler->history[0] = *snapshot;
341 sampler->latest = *snapshot;
342 return ASCIICHAT_OK;
343 }
344 uint64_t cutoff = snapshot->sampled_ns > sampler->config.window_ns
345 ? snapshot->sampled_ns - sampler->config.window_ns
346 : 0;
347 while (sampler->count > 1) {
348 size_t next = (sampler->head + 1) % sampler->capacity;
349 if (sampler->history[next].sampled_ns > cutoff)
350 break;
351 sampler->head = next;
352 sampler->count--;
353 }
354 const stats_snapshot_t *baseline = &sampler->history[sampler->head];
355 out_rates->elapsed_ns = snapshot->sampled_ns - baseline->sampled_ns;
356 out_rates->ready = true;
357 for (size_t i = 0; i < STATS_COUNTER_COUNT; ++i)
358 if (snapshot->capabilities.counters[i])
359 out_rates->counters_per_second[i] =
360 (double)(snapshot->counters[i] - baseline->counters[i]) * 1e9 /
361 (double)out_rates->elapsed_ns;
362 for (size_t i = 0; i < STATS_DURATION_COUNT; ++i) {
363 uint64_t observations = snapshot->durations[i].observations -
364 baseline->durations[i].observations;
365 if (snapshot->capabilities.durations[i] && observations) {
366 out_rates->duration_valid[i] = true;
367 out_rates->duration_mean_ns[i] =
368 (double)(snapshot->durations[i].total_ns -
369 baseline->durations[i].total_ns) /
370 (double)observations;
371 }
372 }
373 size_t tail = (sampler->head + sampler->count - 1) % sampler->capacity;
374 if (snapshot->sampled_ns - sampler->history[tail].sampled_ns >=
375 sampler->config.resolution_ns) {
376 size_t next = (tail + 1) % sampler->capacity;
377 sampler->history[next] = *snapshot;
378 if (sampler->count == sampler->capacity)
379 sampler->head = (sampler->head + 1) % sampler->capacity;
380 else
381 sampler->count++;
382 }
383 sampler->latest = *snapshot;
384 return ASCIICHAT_OK;
385}
double duration_mean_ns[STATS_DURATION_COUNT]
bool duration_valid[STATS_DURATION_COUNT]
double counters_per_second[STATS_COUNTER_COUNT]
stats_snapshot_t latest
stats_capabilities_t capabilities
uint64_t counters[STATS_COUNTER_COUNT]
stats_duration_snapshot_t durations[STATS_DURATION_COUNT]

References ASCIICHAT_OK, stats_snapshot_t::capabilities, stats_sampler::capacity, stats_sampler::config, stats_sampler::count, stats_capabilities_t::counters, stats_snapshot_t::counters, stats_rates_t::counters_per_second, stats_rates_t::duration_mean_ns, stats_rates_t::duration_valid, stats_capabilities_t::durations, stats_snapshot_t::durations, stats_rates_t::elapsed_ns, ERROR_INVALID_PARAM, stats_sampler::head, stats_sampler::history, stats_sampler::latest, stats_duration_snapshot_t::observations, stats_rates_t::ready, stats_sampler_config_t::resolution_ns, stats_snapshot_t::sampled_ns, SET_ERRNO, STATS_COUNTER_COUNT, STATS_DURATION_COUNT, stats_duration_snapshot_t::total_ns, and stats_sampler_config_t::window_ns.

◆ stats_scope_create()

asciichat_error_t stats_scope_create ( const stats_capabilities_t * capabilities,
stats_scope_t ** out_scope )

Copies capabilities. Create before workers start; destroy after all users join. No reset or automatic parent aggregation. New sessions should get new scopes.

Definition at line 76 of file lib/stats/stats.c.

77 {
78 if (!out_scope)
79 return SET_ERRNO(ERROR_INVALID_PARAM, "Missing stats scope output");
80 *out_scope = NULL;
81 if (!capabilities)
82 return SET_ERRNO(ERROR_INVALID_PARAM, "Missing stats capabilities");
83 stats_scope_t *scope = SAFE_CALLOC(1, sizeof(*scope), stats_scope_t *);
84 if (!scope)
85 return SET_ERRNO(ERROR_MEMORY, "Cannot allocate stats scope");
86 if (mutex_init(&scope->snapshot_mutex, "stats_snapshot") != 0) {
87 SAFE_FREE(scope);
88 return SET_ERRNO(ERROR_THREAD, "Cannot initialize stats snapshot mutex");
89 }
90 if (mutex_init(&scope->duration_mutex, "stats_duration") != 0) {
91 mutex_destroy(&scope->snapshot_mutex);
92 SAFE_FREE(scope);
93 return SET_ERRNO(ERROR_THREAD, "Cannot initialize stats duration mutex");
94 }
95 scope->capabilities = *capabilities;
96 // Bypass debug atomic instrumentation so recording never recursively collects
97 // or allocates.
98 scope->id = atomic_fetch_add_u64_impl(&next_scope_id, 1) + 1;
99 scope->started_ns = time_get_ns();
100 *out_scope = scope;
101 return ASCIICHAT_OK;
102}
@ ERROR_THREAD
struct stats_scope stats_scope_t
mutex_t snapshot_mutex
uint64_t started_ns

References ASCIICHAT_OK, atomic_fetch_add_u64_impl(), stats_scope::capabilities, stats_scope::duration_mutex, ERROR_INVALID_PARAM, ERROR_MEMORY, ERROR_THREAD, stats_scope::id, SAFE_CALLOC, SAFE_FREE, SET_ERRNO, stats_scope::snapshot_mutex, and stats_scope::started_ns.

Referenced by stats_runtime_peer_open(), and stats_runtime_start().

◆ stats_scope_destroy()

void stats_scope_destroy ( stats_scope_t * scope)

Definition at line 104 of file lib/stats/stats.c.

104 {
105 if (!scope)
106 return;
107 mutex_destroy(&scope->duration_mutex);
108 mutex_destroy(&scope->snapshot_mutex);
109 SAFE_FREE(scope);
110}

References stats_scope::duration_mutex, SAFE_FREE, and stats_scope::snapshot_mutex.

Referenced by stats_runtime_peer_close(), stats_runtime_peer_open(), stats_runtime_start(), and stats_runtime_stop().

◆ stats_scope_set_observer()

void stats_scope_set_observer ( stats_scope_t * scope,
stats_observer_fn observer,
void * context )

Definition at line 112 of file lib/stats/stats.c.

113 {
114 if (scope) {
115 scope->observer = observer;
116 scope->observer_context = context;
117 }
118}

References stats_scope::observer, and stats_scope::observer_context.

Referenced by ascii_otel_stats_attach().

◆ stats_scope_snapshot()

asciichat_error_t stats_scope_snapshot ( const stats_scope_t * scope,
stats_snapshot_t * out )

stats sampler config keeps the values that move through the subsystem: window_ns, resolution_ns. Some members are pointers into caller- or subsystem-owned memory, so lifetime follows the API that populated them rather than the struct copy itself.

Owned value copy. Concurrent snapshots are serialized. Each duration tuple is

stats rates is intentionally a small, concrete record. Fields such as ready, elapsed_ns give callers the identity and current value they need. It is normally borrowed from, or owned by, the surrounding subsystem—not independently managed. coherent, but independent metrics need not describe one atomic application event. Empty durations have observations/min/max/last/total equal to zero.

Definition at line 214 of file lib/stats/stats.c.

215 {
216 if (!scope || !out)
218 "Missing stats scope or snapshot output");
219 // Logical constness: collection is unchanged; only snapshot synchronization
220 // is mutable.
221 stats_scope_t *mutable_scope = (stats_scope_t *)scope;
222 if (mutex_lock(&mutable_scope->snapshot_mutex) != 0)
223 return SET_ERRNO(ERROR_THREAD, "Cannot lock stats snapshot");
224 memset(out, 0, sizeof(*out));
225 out->scope_id = scope->id;
226 out->started_ns = scope->started_ns;
227 out->capabilities = scope->capabilities;
228 for (size_t i = 0; i < STATS_COUNTER_COUNT; ++i)
229 out->counters[i] = atomic_load_u64_impl(&scope->counters[i]);
230 for (size_t i = 0; i < STATS_GAUGE_COUNT; ++i)
231 out->gauges[i] = atomic_load_u64_impl(&scope->gauges[i]);
232 if (mutex_lock(&mutable_scope->duration_mutex) != 0) {
233 mutex_unlock(&mutable_scope->snapshot_mutex);
234 return SET_ERRNO(ERROR_THREAD, "Cannot lock stats durations");
235 }
236 memcpy(out->durations, scope->durations, sizeof(out->durations));
237 uint64_t recorded_ns[STATS_DURATION_COUNT];
238 memcpy(recorded_ns, scope->duration_recorded_ns, sizeof(recorded_ns));
239 mutex_unlock(&mutable_scope->duration_mutex);
240 for (size_t i = 0; i < STATS_DURATION_SHARDS; ++i) {
241 if (!atomic_load(&scope->shards[i].owner))
242 continue;
243 for (size_t id = 0; id < STATS_DURATION_COUNT; ++id) {
244 const stats_duration_cell_t *cell = &scope->shards[i].durations[id];
246 uint64_t stamp, before;
247 for (;;) {
248 before = atomic_load(&cell->sequence);
249 if (before & 1)
250 continue;
251 sample.observations = atomic_load(&cell->observations);
252 sample.total_ns = atomic_load(&cell->total_ns);
253 sample.min_ns = atomic_load(&cell->min_ns);
254 sample.max_ns = atomic_load(&cell->max_ns);
255 sample.last_ns = atomic_load(&cell->last_ns);
256 stamp = atomic_load(&cell->recorded_ns);
257 if (before == atomic_load(&cell->sequence))
258 break;
259 }
260 if (!sample.observations)
261 continue;
262 stats_duration_snapshot_t *total = &out->durations[id];
263 if (!total->observations || sample.min_ns < total->min_ns)
264 total->min_ns = sample.min_ns;
265 if (sample.max_ns > total->max_ns)
266 total->max_ns = sample.max_ns;
267 if (stamp >= recorded_ns[id]) {
268 recorded_ns[id] = stamp;
269 total->last_ns = sample.last_ns;
270 }
271 total->observations =
272 duration_add(total->observations, sample.observations);
273 total->total_ns = duration_add(total->total_ns, sample.total_ns);
274 }
275 }
276 out->sampled_ns = time_get_ns();
277 mutex_unlock(&mutable_scope->snapshot_mutex);
278 return ASCIICHAT_OK;
279}
uint64_t atomic_load_u64_impl(const atomic_t *a)
#define STATS_DURATION_SHARDS
static bool size_t gotel_query_t * out
Definition queries.h:10
_Atomic uint64_t owner
stats_duration_shard_t shards[16]

References ASCIICHAT_OK, atomic_load_u64_impl(), stats_scope::capabilities, stats_scope::counters, stats_scope::duration_mutex, stats_scope::duration_recorded_ns, stats_duration_shard_t::durations, stats_scope::durations, ERROR_INVALID_PARAM, ERROR_THREAD, stats_scope::gauges, stats_scope::id, stats_duration_cell_t::last_ns, stats_duration_snapshot_t::last_ns, stats_duration_cell_t::max_ns, stats_duration_snapshot_t::max_ns, stats_duration_cell_t::min_ns, stats_duration_snapshot_t::min_ns, stats_duration_cell_t::observations, stats_duration_snapshot_t::observations, out, stats_duration_shard_t::owner, stats_duration_cell_t::recorded_ns, stats_duration_cell_t::sequence, SET_ERRNO, stats_scope::shards, stats_scope::snapshot_mutex, stats_scope::started_ns, STATS_COUNTER_COUNT, STATS_DURATION_COUNT, STATS_DURATION_SHARDS, STATS_GAUGE_COUNT, stats_duration_cell_t::total_ns, and stats_duration_snapshot_t::total_ns.

Referenced by update_server_stats().