Author: dreiss
Date: Tue Jun 10 15:54:40 2008
New Revision: 666358
URL: http://svn.apache.org/viewvc?rev=666358&view=rev
Log:
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.
Modified:
incubator/thrift/trunk/lib/cpp/src/concurrency/PosixThreadFactory.cpp
Modified: incubator/thrift/trunk/lib/cpp/src/concurrency/PosixThreadFactory.cpp
URL:
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/cpp/src/concurrency/PosixThreadFactory.cpp?rev=666358&r1=666357&r2=666358&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/cpp/src/concurrency/PosixThreadFactory.cpp
(original)
+++ incubator/thrift/trunk/lib/cpp/src/concurrency/PosixThreadFactory.cpp Tue
Jun 10 15:54:40 2008
@@ -7,6 +7,10 @@
#include "PosixThreadFactory.h"
#include "Exception.h"
+#if GOOGLE_PERFTOOLS_REGISTER_THREAD
+# include <google/profiler.h>
+#endif
+
#include <assert.h>
#include <pthread.h>
@@ -162,6 +166,10 @@
return (void*)0;
}
+#if GOOGLE_PERFTOOLS_REGISTER_THREAD
+ ProfilerRegisterThread();
+#endif
+
thread->state_ = starting;
thread->runnable()->run();
if (thread->state_ != stopping && thread->state_ != stopped) {