Skip to content
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

main missing #55

Closed
githubaf opened this issue Dec 4, 2018 · 3 comments
Closed

main missing #55

githubaf opened this issue Dec 4, 2018 · 3 comments

Comments

@githubaf
Copy link

githubaf commented Dec 4, 2018

I try to get familiar with gprof profiling and use gprof2dot to visualize the results. The used gcc is a cross compiler that produces Amiga executables. gprof2dot produces pretty pictures for big projects.. Now I have an understanding problem. Please see the attached tiny example. In the produced picture I see no main(). Is that abug or am I doing something wrong?

gprof test | gprof2dot -n0 -e0 | dot -Tpng -o output.png && mirage output.png

granularity: each sample hit covers 2 byte(s) for 100.00% of 0.02 seconds

index % time    self  children    called     name
                                                 <spontaneous>
[1]    100.0    0.02    0.00                 strlen [1]
-----------------------------------------------
                0.00    0.00       1/1           main [53]
[2]      0.0    0.00    0.00       1         fct_1 [2]
                0.00    0.00       1/1           fct_2 [3]
-----------------------------------------------
                0.00    0.00       1/1           fct_1 [2]
[3]      0.0    0.00    0.00       1         fct_2 [3]
-----------------------------------------------

output

test.tar.gz

@jrfonseca
Copy link
Owner

There are 2 problems here:

  • gprof couldn't figure out who called strlen. Perhaps because libc had no debug information, or due to some limitation with m68k architecture (e.g., no stack frame pointer by default)?

  • gprof lists main as a caller (ie, an edge on the call graph), but didn't create a node for it in the report. No idea why. I never seen this with x86. Perhaps gprof's -c/--static-call-graph help.

Both issues are in gcc/gprof domain, not the gprof2dot tool. The missing main issue is minor IMO. But the strlen is a showstopper -- if time spent in libc functions is not accurately billed to the callers, then the whole graph will end up biased and useless.

I hope this helps.

@githubaf
Copy link
Author

Thank you very much for the explaination! It's very much appreciated. I am sure it will help our m68k gprof.

Happy New Year!

@ildar
Copy link

ildar commented Jul 4, 2019

I had main() missing on x86_64. But then I used alternative approach:

valgrind --tool=callgrind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants