OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CC_DEBUG_LATENCY_INFO_H_ | 5 #ifndef CC_DEBUG_LATENCY_INFO_H_ |
6 #define CC_DEBUG_LATENCY_INFO_H_ | 6 #define CC_DEBUG_LATENCY_INFO_H_ |
7 | 7 |
8 #include <map> | |
9 #include <utility> | |
10 | |
8 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "cc/base/cc_export.h" | |
9 | 13 |
10 namespace cc { | 14 namespace cc { |
11 | 15 |
12 struct LatencyInfo { | 16 enum LatencyComponentType { |
13 int64 renderer_main_frame_number; | 17 kRendererMainThread, |
14 int64 renderer_impl_frame_number; | 18 kRendererImplThread, |
15 int64 browser_main_frame_number; | 19 kBrowserMainThread, |
16 int64 browser_impl_frame_number; | 20 kBrowserImplThread, |
21 kInputEvent, | |
22 }; | |
17 | 23 |
24 struct CC_EXPORT LatencyInfo { | |
25 struct LatencyComponent { | |
26 // Nondecreasing number that can be used to determine what events happened | |
27 // in the component at the time this struct was sent on to the next | |
28 // component. | |
29 int64 sequence_number; | |
30 // Average time of events that happened in this component. | |
31 base::TimeTicks event_time; | |
32 // Count of events that happened in this component | |
33 int event_count; | |
Chris Evans
2013/04/15 21:06:25
A negative event_count would probably be non-sensi
| |
34 }; | |
35 | |
36 // Map a Latency Component (with a component-specific int64 id) to a | |
37 // component info. | |
38 typedef std::map<std::pair<LatencyComponentType, int64>, LatencyComponent> | |
39 LatencyMap; | |
40 | |
41 LatencyMap latency_components; | |
42 | |
43 // This represents the final time that a frame is displayed it. | |
18 base::TimeTicks swap_timestamp; | 44 base::TimeTicks swap_timestamp; |
19 | 45 |
20 LatencyInfo() : | 46 LatencyInfo() {} |
21 renderer_main_frame_number(0), | 47 |
22 renderer_impl_frame_number(0), | 48 void MergeWith(const LatencyInfo& other); |
23 browser_main_frame_number(0), | 49 |
24 browser_impl_frame_number(0) {} | 50 void AddLatencyNumber(LatencyComponentType component, int64 id, |
51 int64 component_sequence_number); | |
52 void AddLatencyNumberWithTimestamp(LatencyComponentType component, | |
53 int64 id, int64 component_sequence_number, | |
54 base::TimeTicks time, int event_count); | |
55 | |
56 void Clear(); | |
25 }; | 57 }; |
26 | 58 |
27 } // namespace cc | 59 } // namespace cc |
28 | 60 |
29 #endif // CC_DEBUG_LATENCY_INFO_H_ | 61 #endif // CC_DEBUG_LATENCY_INFO_H_ |
30 | 62 |
OLD | NEW |