diff options
| author | 2017-07-10 14:31:18 -0700 | |
|---|---|---|
| committer | 2017-07-12 17:59:39 +0000 | |
| commit | 10fc62756b8d930eab4b4cb181c2431ec2b17e6c (patch) | |
| tree | cbc61bb0d8a4a887d7048258c392019db36c21a1 | |
| parent | a4267fd89ff91222b94999b0c8d682415a31c847 (diff) | |
Remove ALOGD_IF_SLOW
ALOGD_IF_SLOW isn't intuitively implemented as it cannot handle
temporaries used as its parameters. Since there are so few users of
it already and since it's just sugar on top of 2 otherwise trivial
lines, we opt to remove it entirely.
Bug: 62820330
Test: Build
Change-Id: I196443b3717497f6cab31bfaee94a229e4838556
Merged-In: I196443b3717497f6cab31bfaee94a229e4838556
3 files changed, 23 insertions, 6 deletions
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp index 73b3f52f078b..bc3593977a99 100644 --- a/core/jni/android_view_SurfaceControl.cpp +++ b/core/jni/android_view_SurfaceControl.cpp @@ -23,6 +23,7 @@ #include "android/graphics/Region.h" #include "core_jni_helpers.h" +#include <android-base/chrono_utils.h> #include <JNIHelp.h> #include <ScopedUtfChars.h> #include <android_runtime/android_view_Surface.h> @@ -495,8 +496,9 @@ static void nativeSetDisplayPowerMode(JNIEnv* env, jclass clazz, jobject tokenOb sp<IBinder> token(ibinderForJavaObject(env, tokenObj)); if (token == NULL) return; - ALOGD_IF_SLOW(100, "Excessive delay in setPowerMode()"); + android::base::Timer t; SurfaceComposerClient::setDisplayPowerMode(token, mode); + if (t.duration() > 100ms) ALOGD("Excessive delay in setPowerMode()"); } static jboolean nativeClearContentFrameStats(JNIEnv* env, jclass clazz, jlong nativeObject) { diff --git a/services/core/jni/com_android_server_lights_LightsService.cpp b/services/core/jni/com_android_server_lights_LightsService.cpp index bf91fe3fd0b4..dc6bc2ee42cf 100644 --- a/services/core/jni/com_android_server_lights_LightsService.cpp +++ b/services/core/jni/com_android_server_lights_LightsService.cpp @@ -20,6 +20,7 @@ #include "JNIHelp.h" #include "android_runtime/AndroidRuntime.h" +#include <android-base/chrono_utils.h> #include <utils/misc.h> #include <utils/Log.h> #include <hardware/hardware.h> @@ -137,8 +138,9 @@ static void setLight_native(JNIEnv* /* env */, jobject /* clazz */, jlong ptr, state.brightnessMode = brightnessMode; { - ALOGD_IF_SLOW(50, "Excessive delay setting light"); + android::base::Timer t; devices->lights[light]->set_light(devices->lights[light], &state); + if (t.duration() > 50ms) ALOGD("Excessive delay setting light"); } } diff --git a/services/core/jni/com_android_server_power_PowerManagerService.cpp b/services/core/jni/com_android_server_power_PowerManagerService.cpp index 048ef76ed426..4bd7b63f8a27 100644 --- a/services/core/jni/com_android_server_power_PowerManagerService.cpp +++ b/services/core/jni/com_android_server_power_PowerManagerService.cpp @@ -25,6 +25,7 @@ #include <limits.h> +#include <android-base/chrono_utils.h> #include <android_runtime/AndroidRuntime.h> #include <android_runtime/Log.h> #include <utils/Timers.h> @@ -125,22 +126,34 @@ static void nativeReleaseSuspendBlocker(JNIEnv *env, jclass /* clazz */, jstring static void nativeSetInteractive(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) { if (gPowerModule) { if (enable) { - ALOGD_IF_SLOW(20, "Excessive delay in setInteractive(true) while turning screen on"); + android::base::Timer t; gPowerModule->setInteractive(gPowerModule, true); + if (t.duration() > 20ms) { + ALOGD("Excessive delay in setInteractive(true) while turning screen on"); + } } else { - ALOGD_IF_SLOW(20, "Excessive delay in setInteractive(false) while turning screen off"); + android::base::Timer t; gPowerModule->setInteractive(gPowerModule, false); + if (t.duration() > 20ms) { + ALOGD("Excessive delay in setInteractive(false) while turning screen off"); + } } } } static void nativeSetAutoSuspend(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) { if (enable) { - ALOGD_IF_SLOW(100, "Excessive delay in autosuspend_enable() while turning screen off"); + android::base::Timer t; autosuspend_enable(); + if (t.duration() > 100ms) { + ALOGD("Excessive delay in autosuspend_enable() while turning screen off"); + } } else { - ALOGD_IF_SLOW(100, "Excessive delay in autosuspend_disable() while turning screen on"); + android::base::Timer t; autosuspend_disable(); + if (t.duration() > 100ms) { + ALOGD("Excessive delay in autosuspend_disable() while turning screen on"); + } } } |