From: David Reiss Date: Tue, 10 Jun 2008 22:54:40 +0000 (+0000) Subject: Add ProfilerRegisterThead() to PosixThread. X-Git-Tag: 0.2.0~786 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=af296954ea59369129b4129633e263fd65b503de;p=common%2Fthrift.git Add ProfilerRegisterThead() to PosixThread. Adds an #ifdef'd block that calls ProfilerRegisterThread() if "REGISTER_THREAD_GOOGLE_PERFTOOLS" is set. Apparently, this makes the Google perftools CPU profiler work much better on x86-64. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666358 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/cpp/src/concurrency/PosixThreadFactory.cpp b/lib/cpp/src/concurrency/PosixThreadFactory.cpp index 27c5dfa2..59953417 100644 --- a/lib/cpp/src/concurrency/PosixThreadFactory.cpp +++ b/lib/cpp/src/concurrency/PosixThreadFactory.cpp @@ -7,6 +7,10 @@ #include "PosixThreadFactory.h" #include "Exception.h" +#if GOOGLE_PERFTOOLS_REGISTER_THREAD +# include +#endif + #include #include @@ -162,6 +166,10 @@ void* PthreadThread::threadMain(void* arg) { return (void*)0; } +#if GOOGLE_PERFTOOLS_REGISTER_THREAD + ProfilerRegisterThread(); +#endif + thread->state_ = starting; thread->runnable()->run(); if (thread->state_ != stopping && thread->state_ != stopped) {