Author Topic: perf tool  (Read 1036 times)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
perf tool
« on: 23 September 2012, 22:29:21 »
hi, tomreyn showed me a tool today that I did not know: perf
In ubuntu install "linux-tools-common"

then run megaglest like this:

perf record ./megaglest
after this just do:
perf report

Here is my result of a long ( singleplayer )game with many units ( 4vs4 ) (using svn rev 3576 ):
http://pastebin.com/raw.php?i=mbXasFV1

I think this is quite useful!
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: perf tool
« Reply #1 on: 23 September 2012, 22:37:31 »
And here's one from my ATI box, running
Code: [Select]
perf record ./megaglest --auto-test=,,exit on r3588, which resulted in 20 minute of gameplay on the (rather boring) 'Egypt Mayhem' scenario with these final statistics:

Code: [Select]
Description: Egypt Mayhem
Faction count: 4
Game duration (mins): 20
Max Concurrent Units: 396
Total EndGame Concurrent Unit Count: 396
player #0 CPU (Mega) (CPU (Mega) x 2.5) faction: Egypt Team: 1 victory: 0 # kills: 46 # enemy kills: 42 # deaths: 50
# units produced: 158 # resources harvested: 31050
player #1  (CPU (Mega) x 2.5) faction: Egypt Team: 1 victory: 0 # kills: 80 # enemy kills: 71 # deaths: 53
# units produced: 179 # resources harvested: 37240
player #2  (Human) faction: Egypt Team: 0 victory: 0 # kills: 2 # enemy kills: 2 # deaths: 2
# units produced: 0 # resources harvested: 0
player #3 CPU (Mega) (CPU (Mega) x 2.5) faction: Egypt Team: 0 victory: 0 # kills: 88 # enemy kills: 88 # deaths: 111
# units produced: 174 # resources harvested: 29928

perf report output (incomplete, just the first screen):

Code: [Select]
Events: 453K cycles                                                                                                                                                                                                                                                                 
  8,21%  megaglest  megaglest               [.] streflop_libm::__ieee754_sqrtf(float)
  8,10%  megaglest  megaglest               [.] Glest::Game::World::update()
  7,07%  megaglest  megaglest               [.] Glest::Game::Object::update()
  3,34%  megaglest  [vdso]                  [.] 0x7fff259ff9f1
  2,93%  megaglest  libopenal.so.1.13.0     [.] 0x8c3f
  2,77%  megaglest  megaglest               [.] Glest::Game::Map::getSurfaceCell(int, int) const
  1,92%  megaglest  megaglest               [.] Glest::Game::UnitUpdater::findEnemiesForCell(Glest::Game::AttackSkillType const*, Glest::Game::Cell*, Glest::Game::Unit const*, Glest::Game::Unit const*, std::vector<Glest::Game::Unit*, std::allocator<Glest::Game::
  1,73%  megaglest  libc-2.15.so            [.] _int_malloc
  1,47%  megaglest  libc-2.15.so            [.] __memcpy_ssse3
  1,45%  megaglest  libc-2.15.so            [.] __memset_sse2
  1,38%  megaglest  libc-2.15.so            [.] _int_free
  1,28%  megaglest  libpthread-2.15.so      [.] pthread_mutex_lock
  1,13%  megaglest  libc-2.15.so            [.] malloc
  1,07%  megaglest  megaglest               [.] Shared::Graphics::Pixmap2D::getPixelf(int, int) const
  0,87%  megaglest  megaglest               [.] Glest::Game::UnitUpdater::findCachedCellsEnemies(Shared::Graphics::Vec2<int>, int, int, std::vector<Glest::Game::Unit*, std::allocator<Glest::Game::Unit*> >&, Glest::Game::AttackSkillType const*, Glest::Game::Unit
  0,87%  megaglest  libvorbis.so.0.4.5      [.] 0x10d5b
  0,85%  megaglest  [kernel.kallsyms]       [k] read_hpet
  0,82%  megaglest  megaglest               [.] Glest::Game::PathFinder::processNode(Glest::Game::Unit*, Glest::Game::PathFinder::Node*, Shared::Graphics::Vec2<int>, int, int, bool&, int)
  0,75%  megaglest  libpthread-2.15.so      [.] pthread_mutex_unlock
  0,67%  megaglest  libc-2.15.so            [.] __memcmp_sse4_1
  0,66%  megaglest  megaglest               [.] Glest::Game::World::computeFow(int)
  0,65%  megaglest  libvorbis.so.0.4.5      [.] vorbis_book_decodevv_add
  0,63%  megaglest  megaglest               [.] Glest::Game::World::exploreCells(Shared::Graphics::Vec2<int> const&, int, int)
  0,56%  megaglest  libstdc++.so.6.0.16     [.] std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)
  0,52%  megaglest  libdricore.so           [.] _mesa_PopAttrib
  0,51%  megaglest  [radeon]                [k] r100_cs_parse_packet0
  0,51%  megaglest  megaglest               [.] Glest::Game::Unit::computeHeight(Shared::Graphics::Vec2<int> const&) const
  0,50%  megaglest  libstdc++.so.6.0.16     [.] std::string::assign(std::string const&)
  0,49%  megaglest  megaglest               [.] Glest::Game::Unit::update()
  0,48%  megaglest  libc-2.15.so            [.] malloc_consolidate.part.3
  0,47%  megaglest  megaglest               [.] std::map<Shared::Util::SystemFlags::DebugType, Shared::Util::SystemFlags::SystemFlagsType, std::less<Shared::Util::SystemFlags::DebugType>, std::allocator<std::pair<Shared::Util::SystemFlags::DebugType const, Share
  0,47%  megaglest  megaglest               [.] Glest::Game::Unit::needToUpdate()
  0,46%  megaglest  libstdc++.so.6.0.16     [.] 0x9ebd3
  0,42%  megaglest  megaglest               [.] Glest::Game::Unit::isBuildCommandPending() const
  0,41%  megaglest  [kernel.kallsyms]       [k] find_busiest_group
  0,41%  megaglest  libdricore.so           [.] _mesa_update_state_locked
  0,41%  megaglest  megaglest               [.] Shared::PlatformCommon::BaseThread::getRunningStatus()
  0,39%  megaglest  libvorbis.so.0.4.5      [.] mdct_backward
  0,39%  megaglest  libdricore.so           [.] _mesa_TexParameteri
  0,37%  megaglest  libdricore.so           [.] _mesa_get_fixed_func_fragment_program
  0,37%  megaglest  megaglest               [.] Glest::Game::Minimap::updateFowTex(float)
  0,36%  megaglest  [radeon]                [k] radeon_get_ib_value
  0,36%  megaglest  libdricore.so           [.] _mesa_update_texture
  0,35%  megaglest  [kernel.kallsyms]       [k] __ticket_spin_lock
  0,35%  megaglest  [radeon]                [k] r300_cs_parse
  0,33%  megaglest  [radeon]                [k] r100_cs_packet_parse
  0,33%  megaglest  megaglest               [.] Glest::Game::World::toRenderUnit(Glest::Game::Unit const*) const
  0,32%  megaglest  libdricore.so           [.] _mesa_load_state_parameters
  0,32%  megaglest  libdricore.so           [.] _mesa_TexEnvfv
  0,29%  megaglest  megaglest               [.] Shared::Util::Properties::getString(char const*, char const*) const
  0,29%  megaglest  libdricore.so           [.] _mesa_set_enable
  0,29%  megaglest  r300_dri.so             [.] r300_update_derived_state
  0,28%  megaglest  [radeon]                [k] r300_packet0_check
  0,27%  megaglest  libc-2.15.so            [.] vfprintf
  0,27%  megaglest  megaglest               [.] _ZN5Glest4Game8Renderer12getQuadCacheEbb.constprop.1488
  0,26%  megaglest  r300_dri.so             [.] r300_draw_arrays_immediate
  0,25%  megaglest  libdricore.so           [.] set_tex_parameteri
  0,25%  megaglest  megaglest               [.] Glest::Game::UnitUpdater::updateUnit(Glest::Game::Unit*)
  0,24%  megaglest  libvorbisfile.so.3.3.4  [.] ov_read_filter
  0,24%  megaglest  megaglest               [.] streflop_libm::__floorf(float)
  0,24%  megaglest  libdricore.so           [.] _mesa_copy_texture_object
  0,24%  megaglest  megaglest               [.] Glest::Game::SurfaceCell::setVisible(int, bool)
  0,24%  megaglest  libdricore.so           [.] _mesa_get_fixed_func_vertex_program
  0,24%  megaglest  megaglest               [.] Glest::Game::Map::isFreeCellOrMightBeFreeSoon(Shared::Graphics::Vec2<int>, Shared::Graphics::Vec2<int> const&, Glest::Game::Field) const
  0,24%  megaglest  libgallium.so           [.] st_validate_varrays
  0,24%  megaglest  libdricore.so           [.] _mesa_search_program_cache
  0,23%  megaglest  libc-2.15.so            [.] free
  0,22%  megaglest  libgallium.so           [.] st_finalize_texture
  0,22%  megaglest  libdricore.so           [.] _mesa_PushAttrib
  0,21%  megaglest  libdricore.so           [.] get_texobj
  0,21%  megaglest  [kernel.kallsyms]       [k] copy_user_generic_string
  0,21%  megaglest  libdricore.so           [.] vbo_Vertex3f
  0,20%  megaglest  megaglest               [.] std::map<float, std::vector<Glest::Game::PathFinder::Node*, std::allocator<Glest::Game::PathFinder::Node*> >, std::less<float>, std::allocator<std::pair<float const, std::vector<Glest::Game::PathFinder::Node*, std:
  0,20%  megaglest  libgallium.so           [.] cso_hash_find_node
  0,20%  megaglest  libgallium.so           [.] st_draw_vbo
  0,19%  megaglest  libstdc++.so.6.0.16     [.] __dynamic_cast
  0,19%  megaglest  libstdc++.so.6.0.16     [.] std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()
  0,19%  megaglest  megaglest               [.] Glest::Game::Faction::addCloseResourceTargetToCache(Shared::Graphics::Vec2<int> const&)
  0,19%  megaglest  megaglest               [.] Glest::Game::Map::isAproxFreeCellOrMightBeFreeSoon(Shared::Graphics::Vec2<int>, Shared::Graphics::Vec2<int> const&, Glest::Game::Field, int) const
  0,19%  megaglest  megaglest               [.] Glest::Game::Unit::updateTimedParticles()
  0,19%  megaglest  libc-2.15.so            [.] __strlen_sse2
  0,19%  megaglest  r300_dri.so             [.] radeon_drm_cs_add_reloc
  0,18%  megaglest  megaglest               [.] Glest::Game::PosCircularIterator::next()
  0,18%  megaglest  libdricore.so           [.] _mesa_TexParameterf
  0,18%  megaglest  r300_dri.so             [.] u_vbuf_set_vertex_buffers
  0,18%  megaglest  [kernel.kallsyms]       [k] tg_load_down
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·

tomreyn

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 2,764
    • View Profile
    • MegaGlest - the free and open source cross platform 3D real-time strategy game
Re: perf tool
« Reply #2 on: 5 October 2012, 22:05:13 »
Here's my output (just the red and green lines) from a longer network game on r3634 which I was hosting. Apparently a lot of time is spent on streflop calcluations as well as on openal. Maybe we should double-check whether the sound files in Megapack are all in the right quality, size, length etc...

Code: [Select]
Events: 1M cycles                                                                                                                                                                                                                                                                   
  8,96%        megaglest  megaglest               [.] streflop_libm::__ieee754_sqrtf(float)
  4,32%        megaglest  libopenal.so.1.13.0     [.] 0x17d86
  3,53%        megaglest  libc-2.15.so            [.] __memcpy_ssse3
  2,01%        megaglest  libstdc++.so.6.0.16     [.] std::_Rb_tree_increment(std::_Rb_tree_node_base*)
  1,72%        megaglest  megaglest               [.] Glest::Game::World::update()
  1,69%        megaglest  libpthread-2.15.so      [.] pthread_mutex_lock
  1,69%        megaglest  megaglest               [.] Glest::Game::Object::update()
  1,38%        megaglest  megaglest               [.] Glest::Game::UnitUpdater::findEnemiesForCell(Glest::Game::AttackSkillType const*, Glest::Game::Cell*, Glest::Game::Unit const*, Glest::Game::Unit const*, std::vector<Glest::Game::Unit*, std::allocator<Glest::
  1,33%        megaglest  libc-2.15.so            [.] _int_malloc
  1,32%        megaglest  libc-2.15.so            [.] _int_free
  1,29%        megaglest  libc-2.15.so            [.] __memset_sse2
  1,07%        megaglest  megaglest               [.] Shared::Graphics::InterpolationData::updateVertices(float, bool)
  1,06%        megaglest  libpthread-2.15.so      [.] pthread_mutex_unlock
  1,03%        megaglest  libc-2.15.so            [.] malloc
  1,01%        megaglest  megaglest               [.] Shared::Graphics::InterpolationData::updateNormals(float, bool)
  0,95%        megaglest  libdricore.so           [.] _mesa_get_fixed_func_fragment_program
  0,91%        megaglest  [radeon]                [k] r100_cs_parse_packet0
  0,90%        megaglest  megaglest               [.] Glest::Game::World::computeFow(int)
  0,85%        megaglest  libdricore.so           [.] _mesa_update_texture
  0,84%        megaglest  [vdso]                  [.] 0x7fff39bff770
  0,84%        megaglest  libdricore.so           [.] _mesa_update_state_locked
  0,83%        megaglest  [radeon]                [k] radeon_get_ib_value
  0,81%        megaglest  libc-2.15.so            [.] __memcmp_sse4_1
  0,80%        megaglest  megaglest               [.] Glest::Game::UnitUpdater::getUnitRangeCellsLookupItemCacheStats()
  0,78%        megaglest  libdricore.so           [.] _mesa_load_state_parameters
  0,76%        megaglest  megaglest               [.] Glest::Game::Map::getSurfaceCell(int, int) const
  0,74%        megaglest  libgallium.so           [.] st_validate_varrays
  0,71%        megaglest  [radeon]                [k] r100_cs_packet_parse
  0,67%        megaglest  libgallium.so           [.] st_finalize_texture
  0,67%        megaglest  [radeon]                [k] r300_cs_parse
  0,67%        megaglest  libdricore.so           [.] _mesa_get_fixed_func_vertex_program
  0,63%        megaglest  megaglest               [.] Glest::Game::UnitUpdater::findCachedCellsEnemies(Shared::Graphics::Vec2<int>, int, int, std::vector<Glest::Game::Unit*, std::allocator<Glest::Game::Unit*> >&, Glest::Game::AttackSkillType const*, Glest::Game:
  0,59%        megaglest  r300_dri.so             [.] radeon_drm_cs_add_reloc
  0,58%        megaglest  r300_dri.so             [.] u_vbuf_set_vertex_buffers
  0,56%        megaglest  [radeon]                [k] r300_packet0_check
  0,54%        megaglest  libstdc++.so.6.0.16     [.] std::string::assign(std::string const&)
  0,53%        megaglest  r300_dri.so             [.] r300_update_derived_state
  0,51%        megaglest  libdricore.so           [.] _mesa_PopAttrib
atibox: Ryzen 1800X (8 cores @3.6GHz), 32 GB RAM, MSI Radeon RX 580 Gaming X 8G, PCI subsystem ID [1462:3417], (Radeon RX 580 chipset, POLARIS10) @3440x1440; latest stable Ubuntu release, (open source) radeon (amdgpu) / mesa video driver
atibox (old): Core2Quad Q9400 (4 cores @2.66GHz), 8 GB RAM, XFX HD-467X-DDF2, PCI subsystem ID [1682:2931], (Radeon HD 4670, RV730 XT) @1680x1050; latest stable Ubuntu release, (open source) radeon / mesa video driver
notebook: HP envy13d020ng
internet access: VDSL2+

· · · How YOU can contribute to MG · Latest development snapshot · How to build yourself · Megapack techtree · Currently hosted MG games · · ·