FatalError("Invalid value for flow.hash-size: NULL");
}
- if (StringParseUint32(&configval, 10, strlen(conf_val),
- conf_val) > 0) {
+ if (StringParseUint32(&configval, 10, strlen(conf_val), conf_val) > 0 || configval == 0) {
flow_config.hash_size = configval;
+ } else {
+ FatalError("Invalid value for flow.hash-size");
}
}
if ((ConfGet("flow.prealloc", &conf_val)) == 1)
static uint64_t CyclesToMicroseconds(const uint64_t cycles)
{
const uint64_t ticks_per_us = rte_get_tsc_hz() / 1000000;
+ if (ticks_per_us == 0) {
+ return 0;
+ }
return cycles / ticks_per_us;
}
static uint64_t CyclesToSeconds(const uint64_t cycles)
{
const uint64_t ticks_per_s = rte_get_tsc_hz();
+ if (ticks_per_s == 0) {
+ return 0;
+ }
return cycles / ticks_per_s;
}
struct timeval tv;
int64_t qpc_delta = (int64_t)timestamp_count - wd_tv->qpc_start_count;
- int64_t unix_usec =
- wd_tv->qpc_start_time + (qpc_delta / wd_tv->qpc_freq_usec);
+ int64_t unix_usec = wd_tv->qpc_start_time;
+ if (wd_tv->qpc_freq_usec) {
+ unix_usec += qpc_delta / wd_tv->qpc_freq_usec;
+ }
tv.tv_sec = (long)(unix_usec / (1000 * 1000));
tv.tv_usec = (long)(unix_usec - (int64_t)tv.tv_sec * (1000 * 1000));
void PoolPrintSaturation(Pool *p)
{
- SCLogDebug("pool %p is using %" PRIu32 " out of %" PRIu32 " items (%02.1f%%), max %" PRIu32
- " (%02.1f%%): pool struct memory %" PRIu64 ".",
- p, p->outstanding, p->max_buckets,
- (float)(p->outstanding) / (float)(p->max_buckets) * 100, p->max_outstanding,
- (float)(p->max_outstanding) / (float)(p->max_buckets) * 100,
- (uint64_t)(p->max_buckets * sizeof(PoolBucket)));
+ if (p->max_buckets > 0) {
+ SCLogDebug("pool %p is using %" PRIu32 " out of %" PRIu32 " items (%02.1f%%), max %" PRIu32
+ " (%02.1f%%): pool struct memory %" PRIu64 ".",
+ p, p->outstanding, p->max_buckets,
+ (float)(p->outstanding) / (float)(p->max_buckets) * 100, p->max_outstanding,
+ (float)(p->max_outstanding) / (float)(p->max_buckets) * 100,
+ (uint64_t)(p->max_buckets * sizeof(PoolBucket)));
+ }
}
/*
summary[i].ticks = rules_ctx->data[i].ticks_match + rules_ctx->data[i].ticks_no_match;
summary[i].checks = rules_ctx->data[i].checks;
- if (summary[i].ticks > 0) {
+ if (summary[i].checks > 0) {
summary[i].avgticks = (long double)summary[i].ticks / (long double)summary[i].checks;
}