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

Unified Diff: ui/events/latency_info.h

Issue 25022003: Report LatencyInfo through trace buffer (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/latency_info.h
diff --git a/ui/events/latency_info.h b/ui/events/latency_info.h
index 8bf56100dfd84324c1dc9b40923244ba580f2400..9547ad1af26685042bfc7dd9afc08e64d42081ea 100644
--- a/ui/events/latency_info.h
+++ b/ui/events/latency_info.h
@@ -9,11 +9,31 @@
#include <utility>
#include "base/basictypes.h"
+#include "base/debug/trace_event.h"
+#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "ui/events/events_export.h"
namespace ui {
+// This class is for converting latency info to trace buffer friendly format.
+class LatencyInfoTracedValue : public base::debug::ConvertableToTraceFormat {
nduca 2013/10/01 21:43:44 i think you can put this implementation in the cc
Yufeng Shen (Slow to review) 2013/10/04 00:29:51 Done.
+ public:
+ static scoped_ptr<ConvertableToTraceFormat> FromValue(
+ base::Value* value);
+
+ virtual ~LatencyInfoTracedValue();
+
+ virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE;
+
+ private:
+ explicit LatencyInfoTracedValue(base::Value* value);
+
+ scoped_ptr<base::Value> value_;
+
+ DISALLOW_COPY_AND_ASSIGN(LatencyInfoTracedValue);
+};
+
enum LatencyComponentType {
// Timestamp when the input event is sent from RenderWidgetHost to renderer.
INPUT_EVENT_LATENCY_RWH_COMPONENT,
nduca 2013/10/01 21:43:44 lets prefix this with a name to indicate that it b
Yufeng Shen (Slow to review) 2013/10/04 00:29:51 Done.
@@ -30,9 +50,14 @@ enum LatencyComponentType {
INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
// Timestamp when the UI event is created.
INPUT_EVENT_LATENCY_UI_COMPONENT,
- // Timestamp when the event is acked from renderer. This is currently set
- // only for touch events.
- INPUT_EVENT_LATENCY_ACKED_COMPONENT
+ // Timestamp when the mouse event is acked from renderer.
+ INPUT_EVENT_LATENCY_ACKED_MOUSE_COMPONENT,
nduca 2013/10/01 21:43:44 lets try calling these FINISH_ or TERMINAL ... lat
Rick Byers 2013/10/03 13:12:41 Is the idea that these will always be terminal? W
Yufeng Shen (Slow to review) 2013/10/04 00:29:51 Done.
Yufeng Shen (Slow to review) 2013/10/04 00:29:51 As offline talk, we will only allow one terminal c
+ // Timestamp when the touch event is acked from renderer.
+ INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT,
+ // Timestamp when the gesture event is acked from renderer.
+ INPUT_EVENT_LATENCY_ACKED_GESTURE_COMPONENT,
+ // Timestamp when the frame is swapped.
+ INPUT_EVENT_LATENCY_FRAME_SWAP_COMPONENT,
};
struct EVENTS_EXPORT LatencyInfo {
@@ -56,6 +81,13 @@ struct EVENTS_EXPORT LatencyInfo {
~LatencyInfo();
+ // When the LatencyInfo is considered to have finished its lifetime, call
+ // this function. |terminal_component| is added to indicate when & why
+ // this function is called. And then the whole latency info is reported
+ // to system (i.e. dumped to trace buffer).
+ void Report(LatencyComponentType terminal_component);
+ scoped_ptr<base::debug::ConvertableToTraceFormat> AsTraceableData() const;
jdduke (slow) 2013/10/01 23:45:31 AsTraceableData() appears to be used only be Repor
Yufeng Shen (Slow to review) 2013/10/04 00:29:51 moved into cc file as a global function.
+
// Merges the contents of another LatencyInfo into this one.
void MergeWith(const LatencyInfo& other);
@@ -86,9 +118,6 @@ struct EVENTS_EXPORT LatencyInfo {
void Clear();
LatencyMap latency_components;
-
- // This represents the final time that a frame is displayed it.
- base::TimeTicks swap_timestamp;
};
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698