Thread: Profiler for g++

  1. #1
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141

    Profiler for g++

    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.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  2. #2
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    Have you tried the GNU one yet? You probably even have it already.
    http://www.gnu.org/manual/gprof-2.9....gprof_toc.html

  3. #3
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    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...

    Code:
    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 *)
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  4. #4
    Fingerstyle Guitarist taylorguitarman's Avatar
    Join Date
    Aug 2001
    Posts
    564
    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.
    If a tree falls in the forest, and no one is around to see it, do the other trees make fun of it?

  5. #5
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    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.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  6. #6
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    Same black screen odd behavior with the profiler from MSVC, guess I gotta start hunting for memory errors .
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Looking for free c++ simple profiler
    By umen242 in forum C++ Programming
    Replies: 3
    Last Post: 05-25-2008, 02:38 AM
  2. Code profiler?
    By h3ro in forum Tech Board
    Replies: 5
    Last Post: 04-07-2008, 09:16 AM
  3. How can I make a .NET profiler?
    By honeysting in forum C# Programming
    Replies: 0
    Last Post: 03-26-2006, 06:30 AM
  4. Memory profiler for PHP
    By alphaoide in forum Tech Board
    Replies: 2
    Last Post: 01-27-2005, 04:18 PM
  5. Visual C++ Profiler
    By robquigley in forum C++ Programming
    Replies: 2
    Last Post: 01-17-2003, 09:17 AM