PegCount get_total() const
{
PegCount total = 0;
- for ( state_t i = 0; i < static_cast<state_t>(PruneReason::MAX); ++i )
+ for ( state_t i = 0; i < static_cast<state_t>(FlowDeleteState::MAX); ++i )
total += deletes[i];
return total;
void Analyzer::idle()
{
+ idling = true;
+
// FIXIT-L this whole thing could be pub-sub
daq_stats.idle++;
Stream::timeout_flows(packet_time());
HighAvailabilityManager::process_receive();
+
+ handle_uncompleted_commands();
+
+ idling = false;
}
/*
void rotate();
snort::SFDAQInstance* get_daq_instance() { return daq_instance; }
+ bool is_idling() const
+ { return idling; }
+
private:
void analyze();
bool handle_command();
std::atomic<State> state;
unsigned id;
bool exit_requested = false;
+ bool idling = false;
uint64_t exit_after_cnt;
uint64_t pause_after_cnt = 0;
uint64_t skip_cnt = 0;
if ( !reload_tuners->empty() )
{
auto rrt = reload_tuners->front();
- if ( rrt->tune_packet_context() )
- reload_tuners->pop_front();
+ if ( analyzer.is_idling() )
+ {
+ if ( rrt->tune_idle_context() )
+ reload_tuners->pop_front();
+ }
+ else
+ {
+ if ( rrt->tune_packet_context() )
+ reload_tuners->pop_front();
+ }
}
// check for empty again and free list instance if we are done
{ CountType::SUM, "expected_realized", "number of expected flows realized" },
{ CountType::SUM, "expected_pruned", "number of expected flows pruned" },
{ CountType::SUM, "expected_overflows", "number of expected cache overflows" },
+ { CountType::SUM, "reload_tuning_idle", "number of times stream resource tuner called while idle" },
+ { CountType::SUM, "reload_tuning_packets", "number of times stream resource tuner called while processing packets" },
{ CountType::SUM, "reload_total_adds", "number of flows added by config reloads" },
{ CountType::SUM, "reload_total_deletes", "number of flows deleted by config reloads" },
{ CountType::SUM, "reload_freelist_deletes", "number of flows deleted from the free list by config reloads" },
}
sum_stats((PegCount*)&g_stats, (PegCount*)&stream_base_stats,
- array_size(base_pegs)-1);
+ array_size(base_pegs) - 1);
base_reset();
}
void base_stats()
{
- show_stats((PegCount*)&g_stats, base_pegs, array_size(base_pegs)-1, MOD_NAME);
+ show_stats((PegCount*)&g_stats, base_pegs, array_size(base_pegs) - 1, MOD_NAME);
}
void base_reset()
bool StreamReloadResourceManager::tune_packet_context()
{
+ ++stream_base_stats.reload_tuning_packets;
return tune_resources(max_work);
}
bool StreamReloadResourceManager::tune_idle_context()
{
+ ++stream_base_stats.reload_tuning_idle;
return tune_resources(max_work_idle);
}
PegCount expected_realized;
PegCount expected_pruned;
PegCount expected_overflows;
+ PegCount reload_tuning_idle;
+ PegCount reload_tuning_packets;
PegCount reload_total_adds;
PegCount reload_total_deletes;
PegCount reload_freelist_flow_deletes;