.flags = KNOT_XDP_FILTER_UDP | KNOT_XDP_FILTER_PASS,
.xdp_config = { .ring_size = 2048 },
.jw = NULL,
- .stats_period = 0,
+ .stats_period_ns = 0,
};
static void sigterm_handler(int signo)
uint64_t duration_ns = timer_end_ns(&timer);
duration_us = duration_ns / 1000;
uint64_t dura_exp = ((local_stats.qry_sent + periodic_stats.qry_sent) * 1000000) / ctx->qps;
- if (ctx->thread_id == 0 && ctx->stats_period != 0 && global_stats.collected == 0
- && (duration_ns - (periodic_stats.since - local_stats.since)) >= ctx->stats_period) {
+ if (ctx->thread_id == 0 && ctx->stats_period_ns != 0 && global_stats.collected == 0
+ && (duration_ns - (periodic_stats.since - local_stats.since)) >= ctx->stats_period_ns) {
ATOMIC_SET(stats_switch, STATS_PERIODIC);
ATOMIC_ADD(stats_trigger, 1);
}
assert(optarg);
arg = atoi(optarg);
if (arg > 0) {
- ctx->stats_period = arg * 1000000; // convert to ns
+ ctx->stats_period_ns = arg * 1000000ull; // convert to ns
} else {
ERR2("period must be a positive integer\n");
return false;
jsonw_end(w);
jsonw_ulong(w, "time_units_per_sec", 1000000000);
- if (ctx->stats_period > 0) {
- jsonw_double(w, "stats_interval", ctx->stats_period / 1000.0);
+ if (ctx->stats_period_ns > 0) {
+ jsonw_double(w, "stats_interval", ctx->stats_period_ns / 1000000000.0);
}
// TODO: timeout