Lundi 16 juillet 2007
1
16
/07
/2007
21:07
famille: article technique, vous pouvez sauter. Je ne mettrais pas de traduction en francais non plus.
Following the NA-MIC programming week where I could meet some of the engineer from Kitware, I was getting familiar with the code coverage tool and the memory leak tool valgrind. CMake, which I use for most of my projects, being able to use them and to nicely send the results to any dashboard, it proved to be very efficient tools to quickly improve the quality of your code. Too efficient maybe as it revealed that several parts of my code where either never tested or where actually leaking memory (i.e. gave me more work to do), but that's another story.
I was getting familiar with those tools when I saw that the output of gcov could also be used for profiling the code. Profiling a code is basically the process of quantifying the amount of time your code spend in any of its subparts, or the amount of time a subpart is called. It's a very interesting thing to know, as it gives you the best target for (speed) optimization. Indeed, if you spend 90% of your time in a single method, that's the one you want to run faster (or you can also understand you have a design flaw, as that method shoul dnot be used that much).
Unfortunatly, even if using gprof is easy, the outptut is quite crude, and I could only find one front end out there: kprof which was so outdated that I did not think it could be used anymore (it uses qt3 and KDE ...). I took the challenge to compile it on my Mac anyway.
After almost two full days of effort it is working. Here is the simple final way I took:
- Install X on your mac
- Install fink
- use unstable tree for fink (in /sw/etx/fink.conf)
- install kdebase3 (fink install kdebase3, or from the commander)
- download kprof sources
- do NOT make the Makefile.cvs
- modify the configure file to be /sw/include/qt aware
- modify the ./kprof/Log.h file (37) to the fallback define (...*)0
- startx&
- from xterm, ./kprof/kprof
here you have your kprof working!
Note: it's about time someone rewrite a GUI for gprof, if possible distribution/desktop independent.
Par piwi
-
Publié dans : Work
2
-
Recommander