我正在使用gperftools v2.3rc,并且希望使用改进的线程分析特性。新闻稿说明的部分内容如下:
现在Linux上实现了新的cpu分析模式。它为不同的线程设置单独的分析计时器。..。如果同时加载了labt.f并设置了CPUPROFILE_PER_THREAD_TIMERS环境变量,则启用它。..。
我的C++应用程序与librt.so ( POSIX.1b实时扩展库)链接,但我以前从未听说过有.f后缀的库。.f是什么意思,在哪里可以找到这个库,以及如何在我的应用程序中加载它?
发布于 2014-12-04 16:38:55
我怀疑是因为缺少咖啡引起的暂时性关节炎(这是个错误)。意思是librt.so。从src/profile-handler.cc的中间
// We use weak alias to timer_create to avoid runtime dependency on
// -lrt and in turn -lpthread.
//
// At runtime we detect if timer_create is available and if so we
// can enable linux-sigev-thread mode of profiling在下面的代码中:
#if HAVE_LINUX_SIGEV_THREAD_ID
if (getenv("CPUPROFILE_PER_THREAD_TIMERS")) {
if (timer_create && pthread_once) { // <-- note this bit here.
timer_sharing_ = TIMERS_SEPARATE;
CreateThreadTimerKey(&thread_timer_key);
per_thread_timer_enabled_ = true;
} else {
RAW_LOG(INFO,
"Not enabling linux-per-thread-timers mode due to lack of timer_create."
" Preload or link to librt.so for this to work");
}
}
#endif它正在检查envvar是否已设置,以及库是否已加载。是关于librt.so的。
https://stackoverflow.com/questions/27298949
复制相似问题