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
profiling verilator #3059
Comments
the individual files are compiled as:
|
GCC also requires you link with profiling, so also add -LDFLAGS "-pg" |
Thanks a lot Verilator doc does not mention LDFLAGS - probably UM needs to be fixed about this, also I had to run other programs as:
which was not clear from UM .. |
Fair point - could you please make a quick pull request to add those steps to the docs? |
I'm not sure how to do this, it will be better if somebody, more familiar to the process, does this .. (also will be nicer if the verilator_profcfunc will sort output for modules based on % of time ...) For our design it looks like:( sorted by module name (?))
|
I would think the --prof-* option should be sufficient to set up all other needed compilation flags inside the generated makefile and also to run report generated tools after simulation ... |
Fair point about adding -pg automatically. I pushed doing this. You'll still need to run gprof manually as Verilator never runs a simulation itself, so it obviously can't do anything "after" the simulation either. |
Still verilator can enable code in executable to run post-processing tools at the exit from simulation , based on the --prof switch. |
The executable can't do it as the data isn't written until exit() is called. |
Also the user currently owns main(), so this is outside the scope of what I'd like Verilator to do - for now anyways. |
can't the "executable file" be a script, running real binary and then postprocessing tools? |
It could be, but the executable and main() is owned by the user at present, and adding a wrapper to change that is a very significant step and effort. This does not seem worth it (vs investing in fixing other items) just to further simplify profiling which is not a common use case. |
@wsnyder Does gprof has limitation on design scales? I found there is no gmon.out for my whole design, but there is gmon.out if I switch to one of the submodules. |
gprof works on C programs, no concept of designs. If you dont get it at some levels you are not using -pg at all complie and links, or are not exiting the simulation cleanly ($finish or any path to C |
I use "--prof-cfuncs -LDFLAGS '-pg' CFLAGS '-pg' " in verilator command line, and I'm sure all the makefile generated by verilator has -pg for both compiling and link. |
it shouldn't, I've never seen a problem myself. There is also as a -pg alternative, |
gcc 3 is ancient, I wouldn't trust that. But I haven't tried feeding in oprofile data, if a change is needed to parse it, a pull would be welcome. |
I've confirmed that because one of the array in gprof is out of range due to too many functions in cpp, it can't dump gmon.out. I have to switch to perf or gperftools for profiling. |
This page https://www.gnu.org/software/libc/manual/html_node/gmon-Tunables.html says change the glibc.mem.maxarcs and glibc.mem.minarcs tunables to fix this. Seems default is MAXARCH in gmon.h of 1<<20, so e.g. try
|
@wsnyder ,
using 4.200,
command:
I didn't get promised gmon.out (?) after simulation run ..
What do I miss?
The text was updated successfully, but these errors were encountered: