-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
calling "very flat" callgraphs with bad function names #1
Comments
Hello, Thank you very much for the interest in my program :) If it compiles properly it should work :) Best results are achieved if profiled binary is compiled with debug information enabled and with -fno-omit-frame-pointer compiler option. I didn't use it recently, but I don't see why program shouldn't work. Is source code of your program available anywhere? I can take a look how to build and collect the profile. |
Thanks for the fast answer!
Sure! Let's start with a simple one: Source: https://github.com/KDAB/hotspot/tree/master/tests/test-clients/cpp-libs Compilation: cd test-clients/cpp-libs
gcc -ggdb3 -fPIC -shared sharedlib.cpp -o libshared.so
gcc -ggdb3 -fPIC -c staticlib.cpp -o staticlib.o
ar -rcs libstatic.a staticlib.o
g++ -ggdb3 -fPIC -o main main.cpp -L. -lshared -lstatic Profiling: LD_LIBRARY_PATH=. pgcollect -F 8196 outfile.pgdata ./main
pgconvert outfile.pgdata -d source > callgrind.out.pgdata Note: Ideally I'd like to pgconvert profiles coming directly from |
I believe I know where is the issue, there is even a TODO: determine how to handle pageOffset in mmap event. I will push dirty untested fix to branch |
Please, give a try for https://github.com/ostash/perfgrind/tree/pgoff, it worked for me (with -g -fno-omit-frame-pointer). I do no really remember if -fno-omit-frame-pointer is required, but this is a separate topic. |
That did work quite nice. I still have some func_HASH entries in, but those are from ld-2.31.so. |
Glad to hear that. I'm still not satisfied completely as callgraph doesn't show call from main to sharedlib, want to take a closer look. |
Sounds good. The last "big piece" on shared libraries would be handling of dlopen'd - and much more important - afterwards dlclose'd shared libraries. Should this work already? To get a useful profile with other tools you either need to LD_PRELOAD a dummy dlclose (for example gprof) or inert an explicit library call to the profiler for dumping the profile (gprof/callgrind) or (only possible with callgrind) use a command line option to specify an event where the profile should be dumped (a function call). |
Partially. There is no explicit support for dlclose()/munmap(), but with ASLR enabled there are very low chances that a library gets mapped to the same addresses which were occupied by some other unloaded library previously. I agree that it will be nice to handle that. |
Just to recheck: Do you consider the current result that's quite often reproducible with the current For comparison: that's the output generated by perf record: which is quite similar (also not showing the actual executed pginfo_dbg, because that test runs too fast), but the function names are resolved, so "something" is different.
|
|
I see - and that's actually a reasonable distinction.
I agree. It seems reasonable to mention Line 5 in 2b46aad
in the README with a minimal explanation what this means. Could you do this at the end of the short description as "current limitation", please? |
I can't say that ignoring kernel space is a limitation, rather it was a design decision :) The application I profiled was highly CPU-bound, so I was completely not interested in the kernel. But, you're right is probable worth mentioning that somewhere. |
"feauture/difference": ignoring kernel space |
I've pulled current master, then built (no need for site.mak as dependencies were installed via
apt
in Debian), then followed the docs further (pgcollect with manually increased frequency, then running pgconvert) - but end up with a profile that has all entries named "func_HASH" and a total result of 148%.should this still work and produce a callgrind file that contains reasonable function names and percentage?
The text was updated successfully, but these errors were encountered: