feat: Latency perflog (#364)
* feat: latency perf_window * chore: Increase perf window capacity * chore: fix Makefile * fix: Restore route_latency precomputed idx * fix: clang-format nit * fix: clang-format * fix: Restore accidental deletion * fixed: perf_window_get_percentile was not considering cases where perf_count<CAP * - removed the globals for p50_idx and p90_idx - changed latency unit from ms to us * undo renaming perf_window * upgrade sandbox_total type to u64 make sure sandbox_id starts from 1 * improve Makefile comments Co-authored-by: emil <emil916@gmail.com>master
parent
56f32ec44b
commit
0c3b661301
@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "perf_window.h"
|
||||
|
||||
static inline void
|
||||
route_latency_init(struct perf_window *route_latency)
|
||||
{
|
||||
#ifdef ROUTE_LATENCY
|
||||
perf_window_initialize(route_latency);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
route_latency_get(struct perf_window *route_latency, uint8_t percentile, int precomputed_index)
|
||||
{
|
||||
#ifdef ROUTE_LATENCY
|
||||
lock_node_t node = {};
|
||||
lock_lock(&route_latency->lock, &node);
|
||||
uint64_t res = perf_window_get_percentile(route_latency, percentile, precomputed_index);
|
||||
lock_unlock(&route_latency->lock, &node);
|
||||
return res;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
route_latency_add(struct perf_window *route_latency, uint64_t value)
|
||||
{
|
||||
#ifdef ROUTE_LATENCY
|
||||
lock_node_t node = {};
|
||||
lock_lock(&route_latency->lock, &node);
|
||||
perf_window_add(route_latency, value);
|
||||
lock_unlock(&route_latency->lock, &node);
|
||||
#endif
|
||||
}
|
Loading…
Reference in new issue