Fix RenderThread and worker thread names used by tools

Test: collected systrace and RenderThread hwuiTask1/2 shown
Change-Id: I1114ff72a7ed8c9dc86a64ebd15ca783d1b2ff08
This commit is contained in:
Stan Iliev
2019-02-06 12:02:28 -05:00
parent b3cd68bc82
commit 978d5321b4
4 changed files with 5 additions and 5 deletions

View File

@@ -1202,12 +1202,12 @@ static const JNINativeMethod gMethods[] = {
static JavaVM* mJvm = nullptr;
static void attachRenderThreadToJvm() {
static void attachRenderThreadToJvm(const char* name) {
LOG_ALWAYS_FATAL_IF(!mJvm, "No jvm but we set the hook??");
JavaVMAttachArgs args;
args.version = JNI_VERSION_1_4;
args.name = NULL;
args.name = name;
args.group = NULL;
JNIEnv* env;
mJvm->AttachCurrentThreadAsDaemon(&env, (void*) &args);

View File

@@ -329,7 +329,7 @@ void RenderThread::requestVsync() {
bool RenderThread::threadLoop() {
setpriority(PRIO_PROCESS, 0, PRIORITY_DISPLAY);
if (gOnStartHook) {
gOnStartHook();
gOnStartHook("RenderThread");
}
initThreadLocals();

View File

@@ -75,7 +75,7 @@ struct VsyncSource {
class DummyVsyncSource;
typedef void (*JVMAttachHook)();
typedef void (*JVMAttachHook)(const char* name);
class RenderThread : private ThreadBase {
PREVENT_COPY_AND_ASSIGN(RenderThread);

View File

@@ -87,7 +87,7 @@ status_t TaskManager::WorkerThread::readyToRun() {
setpriority(PRIO_PROCESS, 0, PRIORITY_FOREGROUND);
auto onStartHook = renderthread::RenderThread::getOnStartHook();
if (onStartHook) {
onStartHook();
onStartHook(mName.c_str());
}
return NO_ERROR;