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 UI_EVENTS_LATENCY_INFO_H_ | 5 #ifndef UI_EVENTS_LATENCY_INFO_H_ |
6 #define UI_EVENTS_LATENCY_INFO_H_ | 6 #define UI_EVENTS_LATENCY_INFO_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/containers/small_map.h" | 12 #include "base/containers/small_map.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "ui/events/events_base_export.h" | 14 #include "ui/events/events_base_export.h" |
15 | 15 |
16 namespace ui { | 16 namespace ui { |
17 | 17 |
18 const size_t kMaxLatencyCoordinates = 12; | |
Sami
2014/09/04 19:10:43
Delete.
cvicentiu
2014/09/05 17:19:57
Done.
| |
19 | |
18 enum LatencyComponentType { | 20 enum LatencyComponentType { |
19 // ---------------------------BEGIN COMPONENT------------------------------- | 21 // ---------------------------BEGIN COMPONENT------------------------------- |
20 // BEGIN COMPONENT is when we show the latency begin in chrome://tracing. | 22 // BEGIN COMPONENT is when we show the latency begin in chrome://tracing. |
21 // Timestamp when the input event is sent from RenderWidgetHost to renderer. | 23 // Timestamp when the input event is sent from RenderWidgetHost to renderer. |
22 INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, | 24 INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, |
23 // Timestamp when the input event is received in plugin. | 25 // Timestamp when the input event is received in plugin. |
24 INPUT_EVENT_LATENCY_BEGIN_PLUGIN_COMPONENT, | 26 INPUT_EVENT_LATENCY_BEGIN_PLUGIN_COMPONENT, |
25 // Timestamp when a scroll update for the main thread is begun. | 27 // Timestamp when a scroll update for the main thread is begun. |
26 INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT, | 28 INPUT_EVENT_LATENCY_BEGIN_SCROLL_UPDATE_MAIN_COMPONENT, |
27 // ---------------------------NORMAL COMPONENT------------------------------- | 29 // ---------------------------NORMAL COMPONENT------------------------------- |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 // Nondecreasing number that can be used to determine what events happened | 90 // Nondecreasing number that can be used to determine what events happened |
89 // in the component at the time this struct was sent on to the next | 91 // in the component at the time this struct was sent on to the next |
90 // component. | 92 // component. |
91 int64 sequence_number; | 93 int64 sequence_number; |
92 // Average time of events that happened in this component. | 94 // Average time of events that happened in this component. |
93 base::TimeTicks event_time; | 95 base::TimeTicks event_time; |
94 // Count of events that happened in this component | 96 // Count of events that happened in this component |
95 uint32 event_count; | 97 uint32 event_count; |
96 }; | 98 }; |
97 | 99 |
100 typedef std::vector<std::pair<int32, int32> > LatencyScreenCoordinates; | |
Sami
2014/09/04 19:10:43
float
InputCoordinates
gfx::PointF instead of pa
cvicentiu
2014/09/05 17:19:56
Done.
| |
101 | |
98 // Empirically determined constant based on a typical scroll sequence. | 102 // Empirically determined constant based on a typical scroll sequence. |
99 enum { kTypicalMaxComponentsPerLatencyInfo = 6 }; | 103 enum { kTypicalMaxComponentsPerLatencyInfo = 6 }; |
100 | 104 |
101 // Map a Latency Component (with a component-specific int64 id) to a | 105 // Map a Latency Component (with a component-specific int64 id) to a |
102 // component info. | 106 // component info. |
103 typedef base::SmallMap< | 107 typedef base::SmallMap< |
104 std::map<std::pair<LatencyComponentType, int64>, LatencyComponent>, | 108 std::map<std::pair<LatencyComponentType, int64>, LatencyComponent>, |
105 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; | 109 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; |
106 | 110 |
107 LatencyInfo(); | 111 LatencyInfo(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 LatencyComponent* output) const; | 150 LatencyComponent* output) const; |
147 | 151 |
148 void RemoveLatency(LatencyComponentType type); | 152 void RemoveLatency(LatencyComponentType type); |
149 | 153 |
150 void Clear(); | 154 void Clear(); |
151 | 155 |
152 // Records the |event_type| in trace buffer as TRACE_EVENT_ASYNC_STEP. | 156 // Records the |event_type| in trace buffer as TRACE_EVENT_ASYNC_STEP. |
153 void TraceEventType(const char* event_type); | 157 void TraceEventType(const char* event_type); |
154 | 158 |
155 LatencyMap latency_components; | 159 LatencyMap latency_components; |
160 | |
161 LatencyScreenCoordinates coordinates; | |
Sami
2014/09/04 19:10:43
InputCoordinates input_coordinates, add a comment
cvicentiu
2014/09/05 17:19:56
Done.
| |
162 | |
156 // The unique id for matching the ASYNC_BEGIN/END trace event. | 163 // The unique id for matching the ASYNC_BEGIN/END trace event. |
157 int64 trace_id; | 164 int64 trace_id; |
158 // Whether a terminal component has been added. | 165 // Whether a terminal component has been added. |
159 bool terminated; | 166 bool terminated; |
160 }; | 167 }; |
161 | 168 |
162 } // namespace ui | 169 } // namespace ui |
163 | 170 |
164 #endif // UI_EVENTS_LATENCY_INFO_H_ | 171 #endif // UI_EVENTS_LATENCY_INFO_H_ |
OLD | NEW |