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 UI_BASE_LATENCY_INFO_H_ |
6 #define CC_DEBUG_LATENCY_INFO_H_ | 6 #define UI_BASE_LATENCY_INFO_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 #include "cc/base/cc_export.h" | 13 #include "ui/base/ui_export.h" |
14 | 14 |
15 namespace cc { | 15 namespace ui { |
16 | 16 |
17 enum LatencyComponentType { | 17 enum LatencyComponentType { |
18 kRendererMainThread, | 18 INPUT_EVENT_LATENCY_COMPONENT, |
19 kRendererImplThread, | |
20 kBrowserMainThread, | |
21 kBrowserImplThread, | |
22 kInputEvent, | |
23 }; | 19 }; |
24 | 20 |
25 struct CC_EXPORT LatencyInfo { | 21 struct UI_EXPORT LatencyInfo { |
26 struct LatencyComponent { | 22 struct LatencyComponent { |
27 // Nondecreasing number that can be used to determine what events happened | 23 // Nondecreasing number that can be used to determine what events happened |
28 // in the component at the time this struct was sent on to the next | 24 // in the component at the time this struct was sent on to the next |
29 // component. | 25 // component. |
30 int64 sequence_number; | 26 int64 sequence_number; |
31 // Average time of events that happened in this component. | 27 // Average time of events that happened in this component. |
32 base::TimeTicks event_time; | 28 base::TimeTicks event_time; |
33 // Count of events that happened in this component | 29 // Count of events that happened in this component |
34 uint32 event_count; | 30 uint32 event_count; |
35 }; | 31 }; |
36 | 32 |
37 // Map a Latency Component (with a component-specific int64 id) to a | 33 // Map a Latency Component (with a component-specific int64 id) to a |
38 // component info. | 34 // component info. |
39 typedef std::map<std::pair<LatencyComponentType, int64>, LatencyComponent> | 35 typedef std::map<std::pair<LatencyComponentType, int64>, LatencyComponent> |
40 LatencyMap; | 36 LatencyMap; |
41 | 37 |
| 38 LatencyInfo(); |
| 39 |
| 40 ~LatencyInfo(); |
| 41 |
| 42 // Merges the contents of another LatencyInfo into this one. |
| 43 void MergeWith(const LatencyInfo& other); |
| 44 |
| 45 // Modifies the current sequence number for a component, and adds a new |
| 46 // sequence number with the current timestamp. |
| 47 void AddLatencyNumber(LatencyComponentType component, |
| 48 int64 id, |
| 49 int64 component_sequence_number); |
| 50 |
| 51 // Modifies the current sequence number and adds a certain number of events |
| 52 // for a specific component. |
| 53 void AddLatencyNumberWithTimestamp(LatencyComponentType component, |
| 54 int64 id, |
| 55 int64 component_sequence_number, |
| 56 base::TimeTicks time, |
| 57 uint32 event_count); |
| 58 |
| 59 void Clear(); |
| 60 |
42 LatencyMap latency_components; | 61 LatencyMap latency_components; |
43 | 62 |
44 // This represents the final time that a frame is displayed it. | 63 // This represents the final time that a frame is displayed it. |
45 base::TimeTicks swap_timestamp; | 64 base::TimeTicks swap_timestamp; |
46 | |
47 LatencyInfo(); | |
48 | |
49 ~LatencyInfo(); | |
50 | |
51 void MergeWith(const LatencyInfo& other); | |
52 | |
53 void AddLatencyNumber(LatencyComponentType component, int64 id, | |
54 int64 component_sequence_number); | |
55 void AddLatencyNumberWithTimestamp(LatencyComponentType component, | |
56 int64 id, int64 component_sequence_number, | |
57 base::TimeTicks time, | |
58 uint32 event_count); | |
59 | |
60 void Clear(); | |
61 }; | 65 }; |
62 | 66 |
63 } // namespace cc | 67 } // namespace ui |
64 | 68 |
65 #endif // CC_DEBUG_LATENCY_INFO_H_ | 69 #endif // UI_BASE_LATENCY_INFO_H_ |
66 | 70 |
OLD | NEW |