google-perftools

Install tcmalloc on CentOS

∥☆過路亽.° 提交于 2021-02-08 06:14:37
问题 I installed tcmalloc on CentOS using the command: sudo yum install google-perftools And it proceeds correctly. But I cannot find any installed perftools libraries in /usr/lib/ , so I cannot set LD_PRELOAD variable. Then, when I tried to compile with flag -ltcmalloc , the compiler did not recognize it, which quite made sense. What else should I specify to use tcmalloc on CentOS? Thanks. 回答1: You can always build from source. I have done that with my centos 8. Source code can be found here:

Install tcmalloc on CentOS

徘徊边缘 提交于 2021-02-08 06:08:39
问题 I installed tcmalloc on CentOS using the command: sudo yum install google-perftools And it proceeds correctly. But I cannot find any installed perftools libraries in /usr/lib/ , so I cannot set LD_PRELOAD variable. Then, when I tried to compile with flag -ltcmalloc , the compiler did not recognize it, which quite made sense. What else should I specify to use tcmalloc on CentOS? Thanks. 回答1: You can always build from source. I have done that with my centos 8. Source code can be found here:

Why tcmalloc don't print function name, which provided via dlopen

≡放荡痞女 提交于 2019-12-11 10:39:48
问题 I have next some project: main.cpp #include <iostream> #include <cstddef> #include <dlfcn.h> int main() { void* handle = dlopen("./shared_libs/libshared.so", RTLD_LAZY); if (NULL == handle) { std::cerr << "Cannot open library: " << dlerror() << '\n'; return -1; } typedef int (*foo_t)(const std::size_t); foo_t foo = reinterpret_cast<foo_t>(dlsym(handle, "foo")); const char* dlsym_error = dlerror(); if (dlsym_error) { std::cerr << "Cannot load symbol 'foo': " << dlsym_error << '\n'; dlclose

How exactly does gperftools CPU profiler start?

五迷三道 提交于 2019-12-10 02:26:31
问题 gperftools documentation says that libprofiler should be linked into a target program: $ gcc myprogram.c -lprofiler (without changing a code of the program). And then program should be run with a specific environment variable: CPUPROFILE=/tmp/profiler_output ./a.out The question is: how does libprofile have a chance to start and finish a profiler when it is merely loaded, but its functions are not called? There is no constructor function in that library (proof). All occasions of "CPUPROFILE"

How exactly does gperftools CPU profiler start?

╄→гoц情女王★ 提交于 2019-12-05 02:00:59
gperftools documentation says that libprofiler should be linked into a target program: $ gcc myprogram.c -lprofiler (without changing a code of the program). And then program should be run with a specific environment variable: CPUPROFILE=/tmp/profiler_output ./a.out The question is: how does libprofile have a chance to start and finish a profiler when it is merely loaded, but its functions are not called? There is no constructor function in that library ( proof ). All occasions of "CPUPROFILE" in library code do not refer to any place where profiler is started. I am out of ideas, where to look

How to interpret addresses in Google perf tools CPU profiler

风流意气都作罢 提交于 2019-12-04 20:59:46
问题 My C++ program is consuming a lot of CPU, and more so as it runs. I used Google Performance Tools to profile CPU usage, and this is what I got: (pprof) top Total: 1343 samples 1330 99.0% 99.0% 1330 99.0% 0x0000000801dcb11c 7 0.5% 99.6% 7 0.5% 0x0000000801dcb11e 4 0.3% 99.9% 4 0.3% program::threadWorker 1 0.1% 99.9% 1 0.1% 0x0000000801dcb110 1 0.1% 100.0% 1 0.1% 0x00007fffffffffc0 However, only 1 out of the 5 processes shown here is an actual function name; the rest are addresses. How can I

Line number in Google Perftools CPU profiler on MacOSX

ε祈祈猫儿з 提交于 2019-12-04 07:54:21
问题 I am trying to profile some C++ programs on MacOSX. So I built google-perftools , wrote a program, compiled using MacPorts g++ 4.7, with -g compiler flag, and linked to libprofiler . Then I ran: CPUPROFILE=cpu.profile ./a.out Then I ran pprof to generate the output: [hidden ~]$ pprof --text ./a.out cpu.profile Using local file ./a.out. Using local file cpu.profile. Removing __sigtramp from all stack traces. Total: 282 samples 107 37.9% 37.9% 107 37.9% 0x000000010d72229e 16 5.7% 43.6% 16 5.7%

How to profile RSpec with perftools and bundler?

偶尔善良 提交于 2019-12-03 15:41:38
问题 I need to profile the test suite that I usually run with bundle exec rspec spec/ and produce the GIF image. What is the command to run the perftools.rb so that it works correctly with bundler? 回答1: I too had to dig around to get this. Here is what I did Put this in spec_helper.rb: config.before :suite do PerfTools::CpuProfiler.start("/tmp/rspec_profile") end config.after :suite do PerfTools::CpuProfiler.stop end Run your rspec Run pprof to get your numbers pprof.rb --text /tmp/rspec_profile

How to interpret addresses in Google perf tools CPU profiler

房东的猫 提交于 2019-12-03 13:35:56
My C++ program is consuming a lot of CPU, and more so as it runs. I used Google Performance Tools to profile CPU usage, and this is what I got: (pprof) top Total: 1343 samples 1330 99.0% 99.0% 1330 99.0% 0x0000000801dcb11c 7 0.5% 99.6% 7 0.5% 0x0000000801dcb11e 4 0.3% 99.9% 4 0.3% program::threadWorker 1 0.1% 99.9% 1 0.1% 0x0000000801dcb110 1 0.1% 100.0% 1 0.1% 0x00007fffffffffc0 However, only 1 out of the 5 processes shown here is an actual function name; the rest are addresses. How can I find out what these addresses pertain to? (Of course, I am most interested in the first address shown

How to profile RSpec with perftools and bundler?

ε祈祈猫儿з 提交于 2019-12-03 06:06:19
I need to profile the test suite that I usually run with bundle exec rspec spec/ and produce the GIF image. What is the command to run the perftools.rb so that it works correctly with bundler? I too had to dig around to get this. Here is what I did Put this in spec_helper.rb: config.before :suite do PerfTools::CpuProfiler.start("/tmp/rspec_profile") end config.after :suite do PerfTools::CpuProfiler.stop end Run your rspec Run pprof to get your numbers pprof.rb --text /tmp/rspec_profile 来源: https://stackoverflow.com/questions/9680481/how-to-profile-rspec-with-perftools-and-bundler