Commit 883ea6f5 authored by wutao's avatar wutao Committed by Commit bot

Add UMA for CrossFadeAnimation.

Add one UMA for CrossFadeAnimation smoothness, used in maximize windows,
so that we can evaluate how much improvement we can achieve by forcing
use of render surface.

BUG=708513
TEST=has histogram at local device.

Review-Url: https://codereview.chromium.org/2869263002
Cr-Commit-Position: refs/heads/master@{#472191}
parent 0c1b47cd
......@@ -150,8 +150,8 @@ std::unique_ptr<ui::LayerOwner> CreateBlackMaskLayerOwner(
class ScreenRotationAnimationMetricsReporter
: public ui::AnimationMetricsReporter {
public:
ScreenRotationAnimationMetricsReporter() {}
~ScreenRotationAnimationMetricsReporter() override {}
ScreenRotationAnimationMetricsReporter() = default;
~ScreenRotationAnimationMetricsReporter() override = default;
void Report(int value) override {
UMA_HISTOGRAM_PERCENTAGE("Ash.Rotation.AnimationSmoothness", value);
......
......@@ -54,24 +54,45 @@ base::TimeDelta GetAnimationDuration(OverviewAnimationType animation_type) {
}
class OverviewEnterMetricsReporter : public ui::AnimationMetricsReporter {
public:
OverviewEnterMetricsReporter() = default;
~OverviewEnterMetricsReporter() override = default;
void Report(int value) override {
UMA_HISTOGRAM_PERCENTAGE("Ash.WindowSelector.AnimationSmoothness.Enter",
value);
}
private:
DISALLOW_COPY_AND_ASSIGN(OverviewEnterMetricsReporter);
};
class OverviewExitMetricsReporter : public ui::AnimationMetricsReporter {
public:
OverviewExitMetricsReporter() = default;
~OverviewExitMetricsReporter() override = default;
void Report(int value) override {
UMA_HISTOGRAM_PERCENTAGE("Ash.WindowSelector.AnimationSmoothness.Exit",
value);
}
private:
DISALLOW_COPY_AND_ASSIGN(OverviewExitMetricsReporter);
};
class OverviewCloseMetricsReporter : public ui::AnimationMetricsReporter {
public:
OverviewCloseMetricsReporter() = default;
~OverviewCloseMetricsReporter() override = default;
void Report(int value) override {
UMA_HISTOGRAM_PERCENTAGE("Ash.WindowSelector.AnimationSmoothness.Close",
value);
}
private:
DISALLOW_COPY_AND_ASSIGN(OverviewCloseMetricsReporter);
};
base::LazyInstance<OverviewEnterMetricsReporter>::Leaky g_reporter_enter =
......
......@@ -15,8 +15,10 @@
#include "ash/wm/workspace_controller.h"
#include "ash/wm_window.h"
#include "base/i18n/rtl.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.h"
#include "base/time/time.h"
#include "ui/aura/client/aura_constants.h"
......@@ -84,6 +86,22 @@ base::TimeDelta GetCrossFadeDuration(aura::Window* window,
Round64(kCrossFadeDurationMinMs + (factor * kRange)));
}
class CrossFadeMetricsReporter : public ui::AnimationMetricsReporter {
public:
CrossFadeMetricsReporter() = default;
~CrossFadeMetricsReporter() override = default;
void Report(int value) override {
UMA_HISTOGRAM_PERCENTAGE("Ash.Window.AnimationSmoothness.CrossFade", value);
}
private:
DISALLOW_COPY_AND_ASSIGN(CrossFadeMetricsReporter);
};
base::LazyInstance<CrossFadeMetricsReporter>::Leaky g_reporter_cross_fade =
LAZY_INSTANCE_INITIALIZER;
} // namespace
const int kCrossFadeDurationMS = 200;
......@@ -319,6 +337,8 @@ base::TimeDelta CrossFadeAnimation(
new CrossFadeObserver(window, std::move(old_layer_owner)));
settings.SetTransitionDuration(duration);
settings.SetTweenType(tween_type);
// Only add reporter to |old_layer|.
settings.SetAnimationMetricsReporter(g_reporter_cross_fade.Pointer());
gfx::Transform out_transform;
float scale_x = static_cast<float>(new_bounds.width()) /
static_cast<float>(old_bounds.width());
......
......@@ -2379,6 +2379,17 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<summary>The wallpaper type. Recorded at user login.</summary>
</histogram>
<histogram name="Ash.Window.AnimationSmoothness.CrossFade" units="%">
<owner>wutao@chromium.org</owner>
<summary>
Relative smoothness of cross fade animation when setting window bounds. 100%
represents ideally smooth 60 frames per second. 50% represents when only 30
frames per second is achieved during the animations. 0% should not happen.
This metric is recorded exactly once when SetBoundsDirectCrossFade is
called, such as when window is maximized.
</summary>
</histogram>
<histogram name="Ash.WindowCycleController.CycleTime" units="ms">
<owner>varkha@chromium.org</owner>
<owner>tbuckley@google.com</owner>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment