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

Side by Side Diff: ui/latency/latency_info.h

Issue 2771053003: WIP: Plumbing input event latency reporting through Mus GPU.
Patch Set: NON_EXPORTED_BASE Created 3 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
« no previous file with comments | « ui/latency/latency_histogram_macros.h ('k') | ui/latency/latency_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_LATENCY_LATENCY_INFO_H_ 5 #ifndef UI_LATENCY_LATENCY_INFO_H_
6 #define UI_LATENCY_LATENCY_INFO_H_ 6 #define UI_LATENCY_LATENCY_INFO_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT, 68 INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT,
69 // Timestamp when the event's ack is received by the RWH. 69 // Timestamp when the event's ack is received by the RWH.
70 INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT, 70 INPUT_EVENT_LATENCY_ACK_RWH_COMPONENT,
71 // Frame number when a browser snapshot was requested. The snapshot 71 // Frame number when a browser snapshot was requested. The snapshot
72 // is taken when the rendering results actually reach the screen. 72 // is taken when the rendering results actually reach the screen.
73 BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT, 73 BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT,
74 // Timestamp when a tab is requested to be shown. 74 // Timestamp when a tab is requested to be shown.
75 TAB_SHOW_COMPONENT, 75 TAB_SHOW_COMPONENT,
76 // Timestamp when the frame is swapped in renderer. 76 // Timestamp when the frame is swapped in renderer.
77 INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT, 77 INPUT_EVENT_LATENCY_RENDERER_SWAP_COMPONENT,
78 // Timestamp of when the browser process receives a buffer swap notification 78 // Timestamp of when the display compositor receives a compositor frame from
79 // from the renderer. 79 // the renderer.
80 INPUT_EVENT_BROWSER_RECEIVED_RENDERER_SWAP_COMPONENT, 80 // Display compositor can be either in the browser process or in Mus.
81 DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT,
81 // Timestamp of when the gpu service began swap buffers, unlike 82 // Timestamp of when the gpu service began swap buffers, unlike
82 // INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT which measures after. 83 // INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT which measures after.
83 INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 84 INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT,
84 // Timestamp of when the gesture scroll update is generated from a mouse wheel 85 // Timestamp of when the gesture scroll update is generated from a mouse wheel
85 // event. 86 // event.
86 INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL, 87 INPUT_EVENT_LATENCY_GENERATE_SCROLL_UPDATE_FROM_MOUSE_WHEEL,
87 // ---------------------------TERMINAL COMPONENT----------------------------- 88 // ---------------------------TERMINAL COMPONENT-----------------------------
88 // Timestamp when the event is acked from renderer when it does not 89 // Timestamp when the event is acked from renderer when it does not
89 // cause any rendering to be scheduled. 90 // cause any rendering to be scheduled.
90 INPUT_EVENT_LATENCY_TERMINATED_NO_SWAP_COMPONENT, 91 INPUT_EVENT_LATENCY_TERMINATED_NO_SWAP_COMPONENT,
(...skipping 14 matching lines...) Expand all
105 }; 106 };
106 107
107 enum SourceEventType { 108 enum SourceEventType {
108 UNKNOWN, 109 UNKNOWN,
109 WHEEL, 110 WHEEL,
110 TOUCH, 111 TOUCH,
111 OTHER, 112 OTHER,
112 SOURCE_EVENT_TYPE_LAST = OTHER, 113 SOURCE_EVENT_TYPE_LAST = OTHER,
113 }; 114 };
114 115
116 const char* GetComponentName(ui::LatencyComponentType type);
117
115 class LatencyInfo { 118 class LatencyInfo {
116 public: 119 public:
117 struct LatencyComponent { 120 struct LatencyComponent {
118 // Nondecreasing number that can be used to determine what events happened 121 // Nondecreasing number that can be used to determine what events happened
119 // in the component at the time this struct was sent on to the next 122 // in the component at the time this struct was sent on to the next
120 // component. 123 // component.
121 int64_t sequence_number; 124 int64_t sequence_number;
122 // Average time of events that happened in this component. 125 // Average time of events that happened in this component.
123 base::TimeTicks event_time; 126 base::TimeTicks event_time;
124 // Count of events that happened in this component 127 // Count of events that happened in this component
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 base::TimeTicks time, 189 base::TimeTicks time,
187 uint32_t event_count); 190 uint32_t event_count);
188 191
189 // Returns true if the a component with |type| and |id| is found in 192 // Returns true if the a component with |type| and |id| is found in
190 // the latency_components and the component is stored to |output| if 193 // the latency_components and the component is stored to |output| if
191 // |output| is not NULL. Returns false if no such component is found. 194 // |output| is not NULL. Returns false if no such component is found.
192 bool FindLatency(LatencyComponentType type, 195 bool FindLatency(LatencyComponentType type,
193 int64_t id, 196 int64_t id,
194 LatencyComponent* output) const; 197 LatencyComponent* output) const;
195 198
199 // Returns true if a component with |type| is found in the latency component.
200 // The first such component (when iterating over latency_components_) is
201 // stored to |output| if |output| is not NULL. Returns false if no such
202 // component is found.
203 bool FindLatency(LatencyComponentType type, LatencyComponent* output) const;
204
196 void RemoveLatency(LatencyComponentType type); 205 void RemoveLatency(LatencyComponentType type);
197 206
198 // Returns true if there is still room for keeping the |input_coordinate|, 207 // Returns true if there is still room for keeping the |input_coordinate|,
199 // false otherwise. 208 // false otherwise.
200 bool AddInputCoordinate(const gfx::PointF& input_coordinate); 209 bool AddInputCoordinate(const gfx::PointF& input_coordinate);
201 210
202 uint32_t input_coordinates_size() const { return input_coordinates_size_; } 211 uint32_t input_coordinates_size() const { return input_coordinates_size_; }
203 const gfx::PointF* input_coordinates() const { return input_coordinates_; } 212 const gfx::PointF* input_coordinates() const { return input_coordinates_; }
204 213
205 const LatencyMap& latency_components() const { return latency_components_; } 214 const LatencyMap& latency_components() const { return latency_components_; }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // Stores the type of the first source event. 258 // Stores the type of the first source event.
250 SourceEventType source_event_type_; 259 SourceEventType source_event_type_;
251 260
252 #if !defined(OS_IOS) 261 #if !defined(OS_IOS)
253 friend struct IPC::ParamTraits<ui::LatencyInfo>; 262 friend struct IPC::ParamTraits<ui::LatencyInfo>;
254 friend struct mojo::StructTraits<ui::mojom::LatencyInfoDataView, 263 friend struct mojo::StructTraits<ui::mojom::LatencyInfoDataView,
255 ui::LatencyInfo>; 264 ui::LatencyInfo>;
256 #endif 265 #endif
257 }; 266 };
258 267
268 // This is declared here for use in gtest-based unit tests, but is defined in
269 // //ui/latency:test_support target.
270 // Without this the default PrintTo template in gtest tries to pass LatencyInfo
271 // by value, which leads to an alignment compile error on Windows.
272 void PrintTo(const LatencyInfo& latency, ::std::ostream* os);
273
259 } // namespace ui 274 } // namespace ui
260 275
261 #endif // UI_LATENCY_LATENCY_INFO_H_ 276 #endif // UI_LATENCY_LATENCY_INFO_H_
OLDNEW
« no previous file with comments | « ui/latency/latency_histogram_macros.h ('k') | ui/latency/latency_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698