coz icon indicating copy to clipboard operation
coz copied to clipboard

Difficulty generating non-empty profiles of benchmarks

Open JosephThomasParker opened this issue 5 years ago • 12 comments

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?

JosephThomasParker avatar Jul 28 '20 21:07 JosephThomasParker

Can you share the benchmark? Have you inserted any progress points?

emeryberger avatar Jul 28 '20 21:07 emeryberger

The benchmark is just histogram-pthread.c as it is in master, with a COZ_PROGRESS on line 129.

JosephThomasParker avatar Jul 28 '20 21:07 JosephThomasParker

Just out of curiosity, have you also tried using it by installing it directly with sudo apt-get install coz-profiler?

emeryberger avatar Jul 28 '20 21:07 emeryberger

Yes, I got the same behaviour (but with my own code, not the benchmarks).

JosephThomasParker avatar Jul 28 '20 21:07 JosephThomasParker

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.

JosephThomasParker avatar Jul 28 '20 22:07 JosephThomasParker

Any luck?

emeryberger avatar Jul 29 '20 15:07 emeryberger

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!

JosephThomasParker avatar Jul 30 '20 19:07 JosephThomasParker

OK, great! That PR has now been merged into the main libelfin repo; would you mind checking that that works?

emeryberger avatar Jul 30 '20 19:07 emeryberger

Yes, the current master (https://github.com/aclements/libelfin/commit/946dde57e5caef8297b9339f3a7971401d540840) works for me too.

JosephThomasParker avatar Aug 03 '20 09:08 JosephThomasParker

@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.

Emerentius avatar Oct 23 '20 23:10 Emerentius

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.so file that is built with -g and linked with -ldl which contains in it a COZ_PROGRESS call
  • a C++ executable built with -g that links to foo.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?

KarateSnowMachine avatar Jan 21 '21 02:01 KarateSnowMachine