From af296954ea59369129b4129633e263fd65b503de Mon Sep 17 00:00:00 2001 From: David Reiss Date: Tue, 10 Jun 2008 22:54:40 +0000 Subject: [PATCH] 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 --- lib/cpp/src/concurrency/PosixThreadFactory.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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) { -- 2.17.1