Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: cc/debug/latency_info.cc

Issue 14161019: Fix event_count calculation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/debug/latency_info.h" 5 #include "cc/debug/latency_info.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 namespace cc { 9 namespace cc {
10 10
(...skipping 30 matching lines...) Expand all
41 } else { 41 } else {
42 f->second.sequence_number = std::max(component_sequence_number, 42 f->second.sequence_number = std::max(component_sequence_number,
43 f->second.sequence_number); 43 f->second.sequence_number);
44 uint32 new_count = event_count + f->second.event_count; 44 uint32 new_count = event_count + f->second.event_count;
45 if (event_count > 0 && new_count != 0) { 45 if (event_count > 0 && new_count != 0) {
46 // Do a weighted average, so that the new event_time is the average of 46 // Do a weighted average, so that the new event_time is the average of
47 // the times of events currently in this structure with the time passed 47 // the times of events currently in this structure with the time passed
48 // into this method. 48 // into this method.
49 f->second.event_time += (time - f->second.event_time) * event_count / 49 f->second.event_time += (time - f->second.event_time) * event_count /
50 new_count; 50 new_count;
51 f->second.event_count += new_count; 51 f->second.event_count = new_count;
52 } 52 }
53 } 53 }
54 } 54 }
55 55
56 void LatencyInfo::Clear() { 56 void LatencyInfo::Clear() {
57 latency_components.clear(); 57 latency_components.clear();
58 } 58 }
59 59
60 } // namespace cc 60 } // namespace cc
61 61
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698