Support #929
Using gProf
100%
Description
I am trying to profile the tracker software with gProf (not a tool I have used before). I change the flag maus_gprof in env.sh (attached) to equal 1 and do a scons; scons -c . The compile takes longer, as expected. I then run the tracker reconstruction over the real cosmic data (using the attached script). The gProf website indicates this should then produce a file called gmon.out which I can use with gProf. I do a find of the current directory (the MAUS root directory) and all its subdirectories, but the file does not seem to be there.
Any thoughts?
Files
Updated by Rogers, Chris over 11 years ago
- Target version set to Future MAUS release
Did you mean scons -c; scons? (Need to clean first, right)
Can you try
echo maus_gprof
and check the env variable is set?
Updated by Dobbs, Adam over 11 years ago
Hi Chris,
Yes, apologies, I meant scons -c; scons . Just did the echo and maus_gprof is coming back as 1, as expected. I'll trying running one of the other python scripts too...
Updated by Rogers, Chris over 11 years ago
Ah, I can't check because I'm rebuilding GEANT4 for some reason. But have a look for -pg flag in the gcc command that scons makes. That's the profile flag...
Updated by Dobbs, Adam over 11 years ago
Good thought... but just looked and the -pg flag is in the gcc command...
Updated by Rogers, Chris over 11 years ago
Okay, wait for geant4 to build and I will have a look. gmon.out should be in the current working directory I think (i.e. where you called python blah.py from).
Updated by Rogers, Chris over 11 years ago
Ah, I think it only works with directly called C++ code, not through python. Probably have to rebuild python with -pg flag for that. Sorry about that. If you wanted to dig, I saw this thread and it looked interesting.
Updated by Rogers, Chris over 11 years ago
Or just profile through unit tests (I think that's what I had in mind when I made the flag). I'll update the comment...
Updated by Dobbs, Adam over 11 years ago
I've had a play, python can be compiled to work with gprof by setting environment variable CC=gcc -pg and LDFLAGS=-pg then running the usual maus python bash install script. It does not however seem to want to then run gprof over the gmon.out file created by running one of our high level .py scripts. Think I shall wave a white flag here and resort to profiling with unit tests...
Updated by Rogers, Chris over 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Okay, I updated the comment... that will have to do...