PDA

View Full Version : Profiler for g++



SilentStrike
04-27-2002, 01:12 AM
Does anyone have any recommendations for a free profiler for code generated by g++? I searched google for g++ and profiler, but I didn't come up with anything.

taylorguitarman
04-27-2002, 07:48 AM
Have you tried the GNU one yet? You probably even have it already.
http://www.gnu.org/manual/gprof-2.9.1/html_node/gprof_toc.html

SilentStrike
04-27-2002, 12:11 PM
I tried it, but it's weird. It doesn't work for my game. I compile it with the -pg flag and then run it, but instead of the game working like normal, it's just all black. The profiler output is obviously erroroneoss as well, the first few lines...



Flat profile:

Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls us/call us/call name
33.33 0.01 0.01 902 11.09 11.09 _Rb_tree<basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >, pair<basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const, SDL_Surface *>, _Select1st<pair<basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const, SDL_Surface *> >, less<basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > >, allocator<SDL_Surface *> >::end(void)
33.33 0.02 0.01 321 31.15 31.15 basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >::replace(unsigned int, unsigned int, char const *, unsigned int)
33.33 0.03 0.01 83 120.48 120.48 _Rb_tree<basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >, pair<basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const, Parse::ParseAction *>, _Select1st<pair<basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const, Parse::ParseAction *> >, less<basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > >, allocator<Parse::ParseAction *> >::find(basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> > const &)
0.00 0.03 0.00 103503 0.00 0.00 basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >::rep(void) const
0.00 0.03 0.00 37913 0.00 0.00 Util::Matrix<Game::GameMap::MapTile *>::numCols(void) const
0.00 0.03 0.00 30129 0.00 0.00 basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >::length(void) const
0.00 0.03 0.00 29801 0.00 0.00 basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >::Rep::data(void)
0.00 0.03 0.00 18840 0.00 0.00 Util::Matrix<Game::GameMap::MapTile *>::operator()(int, int)
0.00 0.03 0.00 17762 0.00 0.00 basic_string<char, string_char_traits<char>, __default_alloc_template<true, 0> >::data(void) const
0.00 0.03 0.00 17408 0.00 0.00 Game::Flame::drawAt(SDL_Surface *, SDL_Rect *)
0.00 0.03 0.00 15640 0.00 0.00 Graphics::SingleFrameImage::drawAt(SDL_Surface *, SDL_Rect *)

taylorguitarman
04-27-2002, 08:14 PM
Are you looking for something more like CPU monitors and stuff where you can see the realtime stats? Perhaps just build a small class to output what you need to the screen, like FPS and stuff.

SilentStrike
04-27-2002, 09:27 PM
I was looking for a profiler, one that shows the time spent in each function, etc, but using gprof and the -pg flag makes the program not work.

SilentStrike
04-29-2002, 11:01 PM
Same black screen odd behavior with the profiler from MSVC, guess I gotta start hunting for memory errors :).