0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-27 08:41:02 +08:00

[ui] fixed zero division error

This commit is contained in:
Victor Zarubkin 2019-10-29 23:48:17 +03:00
parent 272c0ceab1
commit 357ac45834

View File

@ -835,8 +835,11 @@ void GraphicsHistogramItem::setSource(profiler::thread_id_t _thread_id, profiler
} }
} }
m_avgDuration = m_blockTotalDuraion / totalCount; if (totalCount != 0)
m_medianDuration = profiler_gui::calculateMedian(durations); {
m_avgDuration = m_blockTotalDuraion / totalCount;
m_medianDuration = profiler_gui::calculateMedian(durations);
}
m_medianDurationFull = m_medianDuration; m_medianDurationFull = m_medianDuration;
m_avgDurationFull = m_avgDuration; m_avgDurationFull = m_avgDuration;
@ -1528,7 +1531,7 @@ void GraphicsHistogramItem::updateImageAsync(QRectF _boundingRect, HistRegime _r
m_workerTopDuration = _top_duration; m_workerTopDuration = _top_duration;
m_workerBottomDuration = _bottom_duration; m_workerBottomDuration = _bottom_duration;
if (_bindMode) if (_bindMode && totalCount != 0)
{ {
m_workerAvgDuration /= totalCount; m_workerAvgDuration /= totalCount;
m_workerMedianDuration = profiler_gui::calculateMedian(durations); m_workerMedianDuration = profiler_gui::calculateMedian(durations);