Avoid division by zero in Query Profiler if Linux kernel has a bug

This commit is contained in:
Alexey Milovidov 2022-03-03 21:28:30 +01:00
parent 7d01516202
commit dda6632932

View File

@ -48,13 +48,13 @@ namespace
if (overrun_count)
{
/// But pass with some frequency to avoid drop of all traces.
if (write_trace_iteration % (overrun_count + 1) == 0)
if (overrun_count > 0 && write_trace_iteration % (overrun_count + 1) == 0)
{
ProfileEvents::increment(ProfileEvents::QueryProfilerSignalOverruns, overrun_count);
}
else
{
ProfileEvents::increment(ProfileEvents::QueryProfilerSignalOverruns, overrun_count + 1);
ProfileEvents::increment(ProfileEvents::QueryProfilerSignalOverruns, std::max(0, overrun_count) + 1);
return;
}
}