fix(userspace): compute the drop ratio in the right way

Signed-off-by: Andrea Terzolo <andrea.terzolo@polito.it>
Co-authored-by: Shane Lawrence <shane@lawrence.dev>
This commit is contained in:
Andrea Terzolo 2022-07-12 19:23:56 +02:00 committed by poiana
parent c078f7c21d
commit a7153f2fd8

View File

@ -91,8 +91,8 @@ bool syscall_evt_drop_mgr::process_event(std::shared_ptr<sinsp> inspector, sinsp
if(delta.n_drops > 0)
{
double ratio = delta.n_drops;
// Assuming the number of event does not contains the dropped ones
ratio /= delta.n_drops + delta.n_evts;
// The `n_evts` always contains the `n_drops`.
ratio /= delta.n_evts;
// When simulating drops the threshold is always zero
if(ratio > m_threshold)