summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-08-18 10:26:52 -0700
committerElliott Hughes <enh@google.com>2014-08-18 10:39:55 -0700
commit06451fe081d5ae79121a6f301475c7042f7f3a5d (patch)
tree438c63291d13649ff64da29b62b9a5f7bf40163c
parent8a28e16cd346bf28d00d8d5935ed092ffb59e5c9 (diff)
downloadframeworks_base-06451fe081d5ae79121a6f301475c7042f7f3a5d.zip
frameworks_base-06451fe081d5ae79121a6f301475c7042f7f3a5d.tar.gz
frameworks_base-06451fe081d5ae79121a6f301475c7042f7f3a5d.tar.bz2
Use gettid directly in frameworks JNI.
Bug: 17048545 Change-Id: I1cd45d85368c799b75f76e778722979cbbb68ed2
-rw-r--r--core/jni/android_util_Binder.cpp11
-rw-r--r--core/jni/android_util_Process.cpp6
2 files changed, 5 insertions, 12 deletions
diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp
index 4b2f740..e0003b8 100644
--- a/core/jni/android_util_Binder.cpp
+++ b/core/jni/android_util_Binder.cpp
@@ -1036,16 +1036,9 @@ static void conditionally_log_binder_call(int64_t start_millis,
}
// We only measure binder call durations to potentially log them if
-// we're on the main thread. Unfortunately sim-eng doesn't seem to
-// have gettid, so we just ignore this and don't log if we can't
-// get the thread id.
+// we're on the main thread.
static bool should_time_binder_calls() {
-#ifdef HAVE_GETTID
- return (getpid() == androidGetTid());
-#else
-#warning no gettid(), so not logging Binder calls...
- return false;
-#endif
+ return (getpid() == gettid());
}
static jboolean android_os_BinderProxy_transact(JNIEnv* env, jobject obj,
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index 31876ce..fbe7a17 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -268,7 +268,7 @@ static void android_os_Process_setCanSelfBackground(JNIEnv* env, jobject clazz,
// Establishes the calling thread as illegal to put into the background.
// Typically used only for the system process's main looper.
#if GUARD_THREAD_PRIORITY
- ALOGV("Process.setCanSelfBackground(%d) : tid=%d", bgOk, androidGetTid());
+ ALOGV("Process.setCanSelfBackground(%d) : tid=%d", bgOk, gettid());
{
Mutex::Autolock _l(gKeyCreateMutex);
if (gBgKey == -1) {
@@ -303,7 +303,7 @@ void android_os_Process_setThreadPriority(JNIEnv* env, jobject clazz,
// if we're putting the current thread into the background, check the TLS
// to make sure this thread isn't guarded. If it is, raise an exception.
if (pri >= ANDROID_PRIORITY_BACKGROUND) {
- if (pid == androidGetTid()) {
+ if (pid == gettid()) {
void* bgOk = pthread_getspecific(gBgKey);
if (bgOk == ((void*)0xbaad)) {
ALOGE("Thread marked fg-only put self in background!");
@@ -330,7 +330,7 @@ void android_os_Process_setThreadPriority(JNIEnv* env, jobject clazz,
void android_os_Process_setCallingThreadPriority(JNIEnv* env, jobject clazz,
jint pri)
{
- android_os_Process_setThreadPriority(env, clazz, androidGetTid(), pri);
+ android_os_Process_setThreadPriority(env, clazz, gettid(), pri);
}
jint android_os_Process_getThreadPriority(JNIEnv* env, jobject clazz,