Merge "Remove ALOGD_IF_SLOW"

This commit is contained in:
Tom Cherry
2017-07-18 17:20:39 +00:00
committed by Gerrit Code Review
3 changed files with 23 additions and 6 deletions

View File

@@ -23,6 +23,7 @@
#include "android/graphics/Region.h" #include "android/graphics/Region.h"
#include "core_jni_helpers.h" #include "core_jni_helpers.h"
#include <android-base/chrono_utils.h>
#include <JNIHelp.h> #include <JNIHelp.h>
#include <ScopedUtfChars.h> #include <ScopedUtfChars.h>
#include <android_runtime/android_view_Surface.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)); sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
if (token == NULL) return; if (token == NULL) return;
ALOGD_IF_SLOW(100, "Excessive delay in setPowerMode()"); android::base::Timer t;
SurfaceComposerClient::setDisplayPowerMode(token, mode); SurfaceComposerClient::setDisplayPowerMode(token, mode);
if (t.duration() > 100ms) ALOGD("Excessive delay in setPowerMode()");
} }
static jboolean nativeClearContentFrameStats(JNIEnv* env, jclass clazz, jlong nativeObject) { static jboolean nativeClearContentFrameStats(JNIEnv* env, jclass clazz, jlong nativeObject) {

View File

@@ -20,6 +20,7 @@
#include "JNIHelp.h" #include "JNIHelp.h"
#include "android_runtime/AndroidRuntime.h" #include "android_runtime/AndroidRuntime.h"
#include <android-base/chrono_utils.h>
#include <utils/misc.h> #include <utils/misc.h>
#include <utils/Log.h> #include <utils/Log.h>
#include <hardware/hardware.h> #include <hardware/hardware.h>
@@ -137,8 +138,9 @@ static void setLight_native(JNIEnv* /* env */, jobject /* clazz */, jlong ptr,
state.brightnessMode = brightnessMode; state.brightnessMode = brightnessMode;
{ {
ALOGD_IF_SLOW(50, "Excessive delay setting light"); android::base::Timer t;
devices->lights[light]->set_light(devices->lights[light], &state); devices->lights[light]->set_light(devices->lights[light], &state);
if (t.duration() > 50ms) ALOGD("Excessive delay setting light");
} }
} }

View File

@@ -25,6 +25,7 @@
#include <limits.h> #include <limits.h>
#include <android-base/chrono_utils.h>
#include <android_runtime/AndroidRuntime.h> #include <android_runtime/AndroidRuntime.h>
#include <android_runtime/Log.h> #include <android_runtime/Log.h>
#include <utils/Timers.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) { static void nativeSetInteractive(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) {
if (gPowerModule) { if (gPowerModule) {
if (enable) { if (enable) {
ALOGD_IF_SLOW(20, "Excessive delay in setInteractive(true) while turning screen on"); android::base::Timer t;
gPowerModule->setInteractive(gPowerModule, true); gPowerModule->setInteractive(gPowerModule, true);
if (t.duration() > 20ms) {
ALOGD("Excessive delay in setInteractive(true) while turning screen on");
}
} else { } else {
ALOGD_IF_SLOW(20, "Excessive delay in setInteractive(false) while turning screen off"); android::base::Timer t;
gPowerModule->setInteractive(gPowerModule, false); 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) { static void nativeSetAutoSuspend(JNIEnv* /* env */, jclass /* clazz */, jboolean enable) {
if (enable) { if (enable) {
ALOGD_IF_SLOW(100, "Excessive delay in autosuspend_enable() while turning screen off"); android::base::Timer t;
autosuspend_enable(); autosuspend_enable();
if (t.duration() > 100ms) {
ALOGD("Excessive delay in autosuspend_enable() while turning screen off");
}
} else { } else {
ALOGD_IF_SLOW(100, "Excessive delay in autosuspend_disable() while turning screen on"); android::base::Timer t;
autosuspend_disable(); autosuspend_disable();
if (t.duration() > 100ms) {
ALOGD("Excessive delay in autosuspend_disable() while turning screen on");
}
} }
} }