diff options
author | rharrison@chromium.org <rharrison@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-06 15:04:25 +0000 |
---|---|---|
committer | rharrison@chromium.org <rharrison@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-06 15:04:25 +0000 |
commit | 05b8671eea4d261b644b829e65232ce67c810735 (patch) | |
tree | 63119e54e18ceea6929f99f9e30aac896bd4d85a | |
parent | b441a849460cc2fca0ce9a18fe8e255cadc0656c (diff) | |
download | chromium_src-05b8671eea4d261b644b829e65232ce67c810735.zip chromium_src-05b8671eea4d261b644b829e65232ce67c810735.tar.gz chromium_src-05b8671eea4d261b644b829e65232ce67c810735.tar.bz2 |
Adding metric to tracking the unlock screen request code path
For unlocking the screen we enter a code path were we do a method call, get a
empty reply, and then receive a signal to indicate that chrome can perform the
UI actions for screen unlocking. We have encountered issues where communication
on this path has failed. A fix for the specific bug has been landed, but we
would still like to track information about how we progress through this path to
detect future issues.
The metric that is being introduced is
"LockScreen.UnlockScreenPath".
BUG=chromium-os:31541
TEST=Built Chrome with CL.
Built ChromeOS image using CL.
Ran image to confirm that no regressions had been introduced.
Ran image and locked screen. Checked histogram populated.
Review URL: https://chromiumcodereview.appspot.com/10540013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140763 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chromeos/dbus/power_manager_client.cc | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/chromeos/dbus/power_manager_client.cc b/chromeos/dbus/power_manager_client.cc index a1bf3d1..e3090de 100644 --- a/chromeos/dbus/power_manager_client.cc +++ b/chromeos/dbus/power_manager_client.cc @@ -36,6 +36,14 @@ class PowerManagerClientImpl : public PowerManagerClient { NUM_LOCK_SCREEN_STATES }; + enum UnlockScreensState { + UNLOCK_SCREEN_REQUESTED, // Unlock screen is requested. + UNLOCK_SCREEN_REQUEST_SUCCEEDED, // Method call succeeded. + UNLOCK_SCREEN_REQUEST_FAILED, // Method call failed. + UNLOCK_SCREEN_FINISHED, // Signal is received. + NUM_UNLOCK_SCREEN_STATES + }; + explicit PowerManagerClientImpl(dbus::Bus* bus) : power_manager_proxy_(NULL), screen_locked_(false), @@ -305,7 +313,18 @@ class PowerManagerClientImpl : public PowerManagerClient { } virtual void NotifyScreenUnlockRequested() OVERRIDE { - SimpleMethodCallToPowerManager(power_manager::kRequestUnlockScreenMethod); + dbus::MethodCall method_call(power_manager::kPowerManagerInterface, + power_manager::kRequestUnlockScreenMethod); + UMA_HISTOGRAM_ENUMERATION("LockScreen.UnlockScreenPath", + UNLOCK_SCREEN_REQUESTED, + NUM_UNLOCK_SCREEN_STATES); + power_manager_proxy_->CallMethodWithErrorCallback( + &method_call, + dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, + base::Bind(&PowerManagerClientImpl::OnScreenUnlockRequested, + weak_ptr_factory_.GetWeakPtr()), + base::Bind(&PowerManagerClientImpl::OnScreenUnlockRequestedError, + weak_ptr_factory_.GetWeakPtr())); } virtual void NotifyScreenUnlockCompleted() OVERRIDE { @@ -498,6 +517,27 @@ class PowerManagerClientImpl : public PowerManagerClient { NUM_LOCK_SCREEN_STATES); } + void OnScreenUnlockRequested(dbus::Response* response) { + UMA_HISTOGRAM_ENUMERATION("LockScreen.UnlockScreenPath", + UNLOCK_SCREEN_REQUEST_SUCCEEDED, + NUM_UNLOCK_SCREEN_STATES); + } + + void OnScreenUnlockRequestedError(dbus::ErrorResponse* error_response) { + if (error_response) { + dbus::MessageReader reader(error_response); + std::string error_message; + reader.PopString(&error_message); + LOG(ERROR) << "Failed to call ScreenUnlockRequested: " + << error_response->GetErrorName() + << ": " << error_message; + } + UMA_HISTOGRAM_ENUMERATION("LockScreen.UnlockScreenPath", + UNLOCK_SCREEN_REQUEST_FAILED, + NUM_UNLOCK_SCREEN_STATES); + } + + void OnGetScreenBrightnessPercent( const GetScreenBrightnessPercentCallback& callback, dbus::Response* response) { @@ -528,6 +568,9 @@ class PowerManagerClientImpl : public PowerManagerClient { void ScreenUnlockSignalReceived(dbus::Signal* signal) { screen_locked_ = false; + UMA_HISTOGRAM_ENUMERATION("LockScreen.UnlockScreenPath", + UNLOCK_SCREEN_FINISHED, + NUM_UNLOCK_SCREEN_STATES); FOR_EACH_OBSERVER(Observer, observers_, UnlockScreen()); } |