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

Side by Side Diff: cc/base/rolling_time_delta_history.h

Issue 833283003: Reland "Add new latency_info for tracking browser composite time." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments Created 5 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CC_BASE_ROLLING_TIME_DELTA_HISTORY_H_ 5 #ifndef CC_BASE_ROLLING_TIME_DELTA_HISTORY_H_
6 #define CC_BASE_ROLLING_TIME_DELTA_HISTORY_H_ 6 #define CC_BASE_ROLLING_TIME_DELTA_HISTORY_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <set> 9 #include <set>
10 10
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "cc/base/cc_export.h" 12 #include "cc/base/cc_export.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 // Stores a limited number of samples. When the maximum size is reached, each 16 // Stores a limited number of samples. When the maximum size is reached, each
17 // insertion results in the deletion of the oldest remaining sample. 17 // insertion results in the deletion of the oldest remaining sample.
18 class CC_EXPORT RollingTimeDeltaHistory { 18 class CC_EXPORT RollingTimeDeltaHistory {
19 public: 19 public:
20 explicit RollingTimeDeltaHistory(size_t max_size); 20 explicit RollingTimeDeltaHistory(size_t max_size);
21 21
22 ~RollingTimeDeltaHistory(); 22 ~RollingTimeDeltaHistory();
23 23
24 void InsertSample(base::TimeDelta time); 24 void InsertSample(base::TimeDelta time);
25 25
26 size_t SampleCount();
Sami 2015/01/06 12:21:40 drive-by nit: const
27
26 void Clear(); 28 void Clear();
27 29
28 // Returns the smallest sample that is greater than or equal to the specified 30 // Returns the smallest sample that is greater than or equal to the specified
29 // percent of samples. If there aren't any samples, returns base::TimeDelta(). 31 // percent of samples. If there aren't any samples, returns base::TimeDelta().
30 base::TimeDelta Percentile(double percent) const; 32 base::TimeDelta Percentile(double percent) const;
31 33
32 private: 34 private:
33 typedef std::multiset<base::TimeDelta> TimeDeltaMultiset; 35 typedef std::multiset<base::TimeDelta> TimeDeltaMultiset;
34 36
35 TimeDeltaMultiset sample_set_; 37 TimeDeltaMultiset sample_set_;
36 std::deque<TimeDeltaMultiset::iterator> chronological_sample_deque_; 38 std::deque<TimeDeltaMultiset::iterator> chronological_sample_deque_;
37 size_t max_size_; 39 size_t max_size_;
38 40
39 DISALLOW_COPY_AND_ASSIGN(RollingTimeDeltaHistory); 41 DISALLOW_COPY_AND_ASSIGN(RollingTimeDeltaHistory);
40 }; 42 };
41 43
42 } // namespace cc 44 } // namespace cc
43 45
44 #endif // CC_BASE_ROLLING_TIME_DELTA_HISTORY_H_ 46 #endif // CC_BASE_ROLLING_TIME_DELTA_HISTORY_H_
OLDNEW
« no previous file with comments | « no previous file | cc/base/rolling_time_delta_history.cc » ('j') | content/browser/renderer_host/compositor_impl_android.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698