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

Unified Diff: content/child/web_gesture_curve_impl.cc

Issue 764403002: Expand UMA coverage for compositor-handled events and fling FPS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « content/child/web_gesture_curve_impl.h ('k') | content/child/web_gesture_curve_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/web_gesture_curve_impl.cc
diff --git a/content/child/web_gesture_curve_impl.cc b/content/child/web_gesture_curve_impl.cc
index 5324b363969b68d273288b2a734eefa2afc4922e..8117e871b09a556437ff7a99f47c6282f6d21922 100644
--- a/content/child/web_gesture_curve_impl.cc
+++ b/content/child/web_gesture_curve_impl.cc
@@ -8,7 +8,8 @@
#include "third_party/WebKit/public/platform/WebFloatSize.h"
#include "third_party/WebKit/public/platform/WebGestureCurveTarget.h"
#include "ui/events/gestures/fling_curve.h"
-#include "ui/gfx/vector2d.h"
+#include "ui/gfx/geometry/safe_integer_conversions.h"
+#include "ui/gfx/geometry/vector2d.h"
#if defined(OS_ANDROID)
#include "ui/events/android/scroller.h"
@@ -45,25 +46,57 @@ scoped_ptr<ui::GestureCurve> CreateDefaultPlatformCurve(
// static
scoped_ptr<WebGestureCurve> WebGestureCurveImpl::CreateFromDefaultPlatformCurve(
const gfx::Vector2dF& initial_velocity,
- const gfx::Vector2dF& initial_offset) {
- return CreateFrom(CreateDefaultPlatformCurve(initial_velocity),
- initial_offset);
+ const gfx::Vector2dF& initial_offset,
+ bool on_main_thread) {
+ return scoped_ptr<WebGestureCurve>(new WebGestureCurveImpl(
+ CreateDefaultPlatformCurve(initial_velocity), initial_offset,
+ on_main_thread ? ThreadType::MAIN : ThreadType::IMPL));
}
// static
-scoped_ptr<WebGestureCurve> WebGestureCurveImpl::CreateFrom(
+scoped_ptr<WebGestureCurve> WebGestureCurveImpl::CreateFromUICurveForTesting(
scoped_ptr<ui::GestureCurve> curve,
const gfx::Vector2dF& initial_offset) {
return scoped_ptr<WebGestureCurve>(
- new WebGestureCurveImpl(curve.Pass(), initial_offset));
+ new WebGestureCurveImpl(curve.Pass(), initial_offset, ThreadType::TEST));
}
WebGestureCurveImpl::WebGestureCurveImpl(scoped_ptr<ui::GestureCurve> curve,
- const gfx::Vector2dF& initial_offset)
- : curve_(curve.Pass()), last_offset_(initial_offset) {
+ const gfx::Vector2dF& initial_offset,
+ ThreadType animating_thread_type)
+ : curve_(curve.Pass()),
+ last_offset_(initial_offset),
+ animating_thread_type_(animating_thread_type),
+ ticks_since_first_animate_(0),
+ first_animate_time_(0),
+ last_animate_time_(0) {
}
WebGestureCurveImpl::~WebGestureCurveImpl() {
+ if (ticks_since_first_animate_ <= 1)
+ return;
+
+ if (first_animate_time_ >= last_animate_time_)
+ return;
+
+ switch (animating_thread_type_) {
+ case ThreadType::MAIN:
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Event.FPS.Renderer.Fling",
+ gfx::ToRoundedInt(ticks_since_first_animate_ /
+ (last_animate_time_ - first_animate_time_)),
+ 1, 200, 100);
jdduke (slow) 2014/12/01 18:20:59 Any thoughts on bucket extents/count?
Yufeng Shen (Slow to review) 2014/12/01 18:57:07 You can try a few test flings on your device and c
jdduke (slow) 2014/12/01 20:20:28 Well, it *should* be capped by the refresh rate, s
Yufeng Shen (Slow to review) 2014/12/01 20:40:14 Do we push out frames as whatever the display refr
+ break;
+ case ThreadType::IMPL:
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Event.FPS.RendererImpl.Fling",
jdduke (slow) 2014/12/01 18:20:59 Also not sure about the preferred naming scheme...
Rick Byers 2014/12/01 19:47:10 We have Event.Latency.* for all latency measures.
jdduke (slow) 2014/12/01 20:20:29 Yeah, frequency is a nice name for this family.
+ gfx::ToRoundedInt(ticks_since_first_animate_ /
+ (last_animate_time_ - first_animate_time_)),
+ 1, 200, 100);
+ break;
+ case ThreadType::TEST:
+ break;
+ }
}
bool WebGestureCurveImpl::apply(double time,
@@ -73,6 +106,16 @@ bool WebGestureCurveImpl::apply(double time,
if (time <= 0)
return true;
+ if (!first_animate_time_) {
+ first_animate_time_ = time;
+ } else if (time != last_animate_time_) {
+ // Animation can occur multiple times a frame, but with the same timestamp.
+ // Suppress recording of such redundant animate calls, avoiding artificially
Yufeng Shen (Slow to review) 2014/12/01 18:57:07 If this is true, do you want to also guard against
jdduke (slow) 2014/12/01 20:20:28 Good catch, done.
+ // inflated FPS computation.
+ last_animate_time_ = time;
+ ++ticks_since_first_animate_;
+ }
+
const base::TimeTicks time_ticks =
base::TimeTicks() + base::TimeDelta::FromSecondsD(time);
gfx::Vector2dF offset, velocity;
« no previous file with comments | « content/child/web_gesture_curve_impl.h ('k') | content/child/web_gesture_curve_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698