Profiling... again
weapon_S

Compiling with:
g++ -gstabs+ -pg ../*.cpp -lallegro-profile -lallegro_image-profile -lallegro_font-profile -lallegro_ttf-profile -lallegro_native_dialog-profile -lallegro_primitives-profile -opepg2
Tried to get profiling information with this: (I've tried options with and without leading space. At first didn't specify include dirs, with same result.)

gprof -I/media/BAD/SDevX/A5/src -I/media/BAD/SDevX/A5/src/opengl -I/media/BAD/SDevX/A5/src/linux -fgame_mainline -EPE::Palette::b  pepg2 > pepgn2.txt

It gives me this:

#SelectExpand
1Each sample counts as 0.01 seconds. 2 % cumulative self self total 3 time seconds seconds calls ms/call ms/call name 4 37.50 0.03 0.03 925444 0.00 0.00 PE::Palette::s(double, double, double, double) 5 25.00 0.05 0.02 7850 0.00 0.00 PE::Palette::draw(ALLEGRO_BITMAP*, float const&, float const&) 6 12.50 0.06 0.01 2313609 0.00 0.00 __gnu_cxx::__enable_if<std::__is_arithmetic<double>::__value, int>::__type std::isfinite<double>(double) 7 12.50 0.07 0.01 925443 0.00 0.00 PE::Palette::b(double) const 8 12.50 0.08 0.01 1 10.00 60.00 PE::Palette::prep_alpha_mask() 9 0.00 0.08 0.00 7851 0.00 0.00 PE::BackgroundOrb::draw(ALLEGRO_BITMAP*, float const&, float const&) 10 0.00 0.08 0.00 7851 0.00 0.00 PE::Hud::draw(ALLEGRO_BITMAP*, float const&, float const&) 11 0.00 0.08 0.00 5 0.00 0.00 PE::Position::Position(double const&, double const&) 12 0.00 0.08 0.00 1 0.00 0.00 global constructors keyed to game_mainline(PE::Globals&) 13 0.00 0.08 0.00 1 0.00 0.00 show_intro(S::Globals const&) 14 0.00 0.08 0.00 1 0.00 0.00 menu_choice(PE::Globals&) 15 0.00 0.08 0.00 1 0.00 80.00 game_mainline(PE::Globals&) 16 0.00 0.08 0.00 1 0.00 80.00 execute_choice(int const&, PE::Globals&) 17 0.00 0.08 0.00 1 0.00 0.00 __static_initialization_and_destruction_0(int, int) 18 0.00 0.08 0.00 1 0.00 0.00 S::Globals::Globals(int const&, int const&) 19 0.00 0.08 0.00 1 0.00 0.00 S::Globals::~Globals() 20 0.00 0.08 0.00 1 0.00 0.00 PE::GameLayout::GameLayout() 21 0.00 0.08 0.00 1 0.00 0.00 PE::PlayerState::PlayerState() 22 0.00 0.08 0.00 1 0.00 0.00 PE::BackgroundOrb::initialize_bg() 23 0.00 0.08 0.00 1 0.00 0.00 PE::BackgroundOrb::BackgroundOrb(PE::GameLayout const&) 24 0.00 0.08 0.00 1 0.00 0.00 PE::BackgroundOrb::~BackgroundOrb() 25 0.00 0.08 0.00 1 0.00 0.00 PE::Hud::Hud(PE::GameLayout const&, ALLEGRO_FONT*, ALLEGRO_FONT*, ALLEGRO_FONT*) 26 0.00 0.08 0.00 1 0.00 0.00 PE::Globals::Globals() 27 0.00 0.08 0.00 1 0.00 0.00 PE::Globals::~Globals() 28 0.00 0.08 0.00 1 0.00 0.00 PE::Palette::prep_buffers() 29 0.00 0.08 0.00 1 0.00 0.00 PE::Palette::prep_sources() 30 0.00 0.08 0.00 1 0.00 60.00 PE::Palette::Palette(double const&, double const&, int const&) 31 0.00 0.08 0.00 1 0.00 0.00 PE::Palette::~Palette() 32 0.00 0.08 0.00 1 0.00 0.00 PE::Palette::get_inner_radius() const 33 0.00 0.08 0.00 1 0.00 0.00 __gnu_cxx::__enable_if<std::__is_arithmetic<float>::__value, int>::__type std::isfinite<float>(float) 34 35[...] 36index % time self children called name 37 <spontaneous> 38[1] 100.0 0.00 0.08 main [1] 39 0.00 0.08 1/1 execute_choice(int const&, PE::Globals&) [3] 40 0.00 0.00 1/1 PE::Globals::Globals() [28] 41 0.00 0.00 1/1 show_intro(S::Globals const&) [17] 42 0.00 0.00 1/1 menu_choice(PE::Globals&) [18] 43 0.00 0.00 1/1 PE::Globals::~Globals() [29] 44----------------------------------------------- 45[...] 46 0.01 0.05 1/1 PE::Palette::Palette(double const&, double const&, int const&) [4] 47[5] 75.0 0.01 0.05 1 PE::Palette::prep_alpha_mask() [5] 48 0.03 0.00 925444/925444 PE::Palette::s(double, double, double, double) [6] 49 0.01 0.00 925443/925443 PE::Palette::b(double) const [8] 50 0.01 0.00 1388165/2313609 __gnu_cxx::__enable_if<std::__is_arithmetic<double>::__value, int>::__type std::isfinite<double>(double) [9] 51-----------------------------------------------

The things that bother me:
- No Allegro functions in the flat profile or call-graph; Even though the draw functions rely heavily on them.
- A call graph including main and PE::Palette::b; Even though I specified -f game_mainline and -E PE::Palette::b
Debian, gprof version 2.20.1.
I made a SVN build of Allegro yesterday. Is there a way to verify the library objects have profiling information? Or are the Allegro calls just overshadowed by my own functions? (I think that the program spends most of its time in al_wait_for_event, as CPU is very low.)

Peter Wang

Is Allegro statically linked? I often have trouble profiling shared libraries (edit: seems you can't; need to use sprof then).

I usually try oprofile when gprof is being a pain. Google perftools looks useful, too: just link with -lprofiler then set an environment variable when you run.

Thread #609608. Printed from Allegro.cc