aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-05-07 19:48:31 -0300
committerGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-05-07 19:48:31 -0300
commited12b08e7aa006817265bfe076bd101bcefd455a (patch)
treee463e41f3058b2c440e021ab1fc568ebbc952883 /src
parent52654842a0fa9b4e17d5f3ed283d6a16f1f8ca2b (diff)
Profiler: Fix off-by-one error when computing average.
Diffstat (limited to 'src')
-rw-r--r--src/common/profiler.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/common/profiler.cpp b/src/common/profiler.cpp
index b8cde178..cf6b6b25 100644
--- a/src/common/profiler.cpp
+++ b/src/common/profiler.cpp
@@ -126,10 +126,9 @@ void TimingResultsAggregator::AddFrame(const ProfilingFrameResult& frame_result)
static AggregatedDuration AggregateField(const std::vector<Duration>& v, size_t len) {
AggregatedDuration result;
result.avg = Duration::zero();
-
result.min = result.max = (len == 0 ? Duration::zero() : v[0]);
- for (size_t i = 1; i < len; ++i) {
+ for (size_t i = 0; i < len; ++i) {
Duration value = v[i];
result.avg += value;
result.min = std::min(result.min, value);