Difficulty generating non-empty profiles of benchmarks
I've installed Coz from source on a clean VM of Ubuntu 20.04, following the readme:
$ sudo apt-get install clang docutils-common libelfin-dev nodejs npm python3
$ make
$ sudo make check
I've run the benchmarks to generate profile.coz files, but whenever I load these into the viewer, I get the No data to plot message. The readme says that benchmarks "may require several runs before coz has enough measurements to generate a useful profile". I repeated the histogram benchmark by doing
for i in {1..100}; do sudo make bench; done
in the histogram dir. That took around 10 mins, but the profile generated is still "empty". The file itself is about 1000 lines of pairs like
startup time=1595970818471861992
runtime time=6632052719
Is this the expected behaviour? Do I just need to run this command longer to generate a useful profile?
Can you share the benchmark? Have you inserted any progress points?
The benchmark is just histogram-pthread.c as it is in master, with a COZ_PROGRESS on line 129.
Just out of curiosity, have you also tried using it by installing it directly with sudo apt-get install coz-profiler?
Yes, I got the same behaviour (but with my own code, not the benchmarks).
Looks like it's related to #107 and #109. Ubuntu 20.04 distributes libelfin-dev version 0.3, so I'll try a different version.
Any luck?
Yes thanks - I've got it running with @tetzank's fork https://github.com/tetzank/libelfin/commit/c4394ec2aca4f6d858385f8e80ba9440ade2269b (but building version 0.2 from source didn't work for me). This is with gcc 9.3.0.
Thanks for the tool - it's a very neat idea!
OK, great! That PR has now been merged into the main libelfin repo; would you mind checking that that works?
Yes, the current master (https://github.com/aclements/libelfin/commit/946dde57e5caef8297b9339f3a7971401d540840) works for me too.
@JosephThomasParker Could you explain the steps you've taken in detail?
~~Like you, I'm on ubuntu 20.04 and tried the histogram benchmark. I've compiled coz with tetzank's fork and the current master (which hasn't changed in the meantime) and it still fails to generate a non-empty profile.~~
Looks like after installing and later removing libelfin-dev via apt, its dependencies (libelf++0 in particular) were still laying around and were linked in. After apt autoremoveing those, I can now generate profiles from the C benchmarks.
Is it possible to put coz progress points in a shared library that is then linked by an executable? I've got the following setup:
- a C++ library
foo.sofile that is built with-gand linked with-ldlwhich contains in it aCOZ_PROGRESScall - a C++ executable built with
-gthat links tofoo.so
When I run the executable with coz I see the coz bootstrap messages but the profile.coz file contains only the startup time/runtime time timestamps and nothing else. I am able to generate non-empty profile.coz files from some of the included benchmarks like sqlite. So I'm just curious, are there some other limitations that I'm missing? Is there something I can do to get more debug information to see if things are working?