The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Topic started by: Hanczar on July 29, 2009, 09:01:27 pm

Title: gprof on SE 6.1
Post by: Hanczar on July 29, 2009, 09:01:27 pm
Hi,
I was asked to run gprof with new version.

centralized path search, Yoshi well developed save game ( yoshi87-2-101.sve )
profile from loading game, and fastforward through two months ( 1 August - 2 October )

 
Code: [Select]
Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total          
 time   seconds   seconds    calls   s/call   s/call  name   
 17.78     23.70    23.70     1002     0.02     0.02  path_explorer_t::compartment_t::step()
 10.47     37.66    13.96    14952     0.00     0.00  karte_t::sync_step(long, bool, bool)
  4.43     43.56     5.90  6493920     0.00     0.00  display_img_aux(unsigned int, short, short, int, bool)
  3.07     47.65     4.09   899322     0.00     0.00  haltestelle_t::hole_ab(ware_besch_t const*, unsigned int, schedule_t const*, spieler_t const*, convoi_t*)
  2.30     50.72     3.06 91893479     0.00     0.00  planquadrat_t::get_boden_in_hoehe(short) const
  1.91     53.27     2.55 176115732     0.00     0.00  grund_t::get_hoehe() const
  1.75     55.60     2.33 28919702     0.00     0.00  convoi_t::sync_step(long)
  1.64     57.79     2.19  1721419     0.00     0.00  hashtable_tpl<sync_steppable*, sync_steppable*, ptrhash_tpl<sync_steppable*> >::put(sync_steppable*, sync_steppable*)
  1.43     59.70     1.91 134020314     0.00     0.00  vehikel_basis_t::fahre_basis(unsigned int)
  1.42     61.59     1.89 17172945     0.00     0.00  convoi_t::calc_acceleration(long)
  1.37     63.41     1.82 27709211     0.00     0.00  convoi_t::step()
  1.27     65.11     1.70 145209180     0.00     0.00  ding_t::get_flag(ding_t::flag_values) const
  1.22     66.73     1.62 47299503     0.00     0.00  quickstone_tpl<simline_t>::is_bound() const
  1.19     68.32     1.59 58702496     0.00     0.00  vehikel_t::get_gesamtgewicht() const
  1.13     69.83     1.50 53592195     0.00     0.00  grund_t::get_vmove(koord) const
  1.05     71.23     1.41 95889267     0.00     0.00  dingliste_t::bei(unsigned char) const
  1.05     72.62     1.40 984440325     0.00     0.00  vector_tpl<ware_t>::get_count() const
  1.04     74.02     1.39 96303660     0.00     0.00  grund_t::get_weg(waytype_t) const
  0.99     75.33     1.31 55792036     0.00     0.00  vehikel_t::get_frictionfactor() const
  0.94     76.58     1.25 54594377     0.00     0.00  ding_t::is_moving() const
  0.86     77.73     1.15 451953241     0.00     0.00  ware_t::get_besch() const
  0.82     78.82     1.09 555062394     0.00     0.00  vector_tpl<ware_t>::operator[](unsigned int)
  0.82     79.91     1.09 12484608     0.00     0.00  dingliste_t::remove(ding_t const*)
  0.81     80.99     1.08 410595159     0.00     0.00  slist_iterator_tpl<hashtable_tpl<sync_steppable*, sync_steppable*, ptrhash_tpl<sync_steppable*> >::node_t>::next()
  0.75     81.98     0.99 549415079     0.00     0.00  quickstone_tpl<haltestelle_t>::quickstone_tpl(quickstone_tpl<haltestelle_t> const&)
  0.74     82.97     0.98 279300031     0.00     0.00  koord3d::get_2d() const
  0.73     83.94     0.97 174352925     0.00     0.00  karte_t::lookup(koord) const
  0.69     84.86     0.93  8295244     0.00     0.00  vehikel_t::hop()
  0.64     85.72     0.85 159118527     0.00     0.00  array_tpl<vehikel_t*>::operator[](unsigned int)
  0.64     86.57     0.85 71533136     0.00     0.00  fussgaenger_t::sync_step(long)
  0.64     87.42     0.85  8406673     0.00     0.00  binary_heap_tpl<route_t::ANode*>::pop()
  0.62     88.25     0.83 29154269     0.00     0.00  planquadrat_t::get_boden_count() const
  0.61     89.06     0.81 91983019     0.00     0.00  karte_t::lookup(koord3d) const
  0.59     89.85     0.79 26355641     0.00     0.00  grund_t::get_neighbour(grund_t*&, waytype_t, koord) const
  0.56     90.59     0.74  1264193     0.00     0.00  stadtauto_t::hop_check()
  0.54     91.31     0.72   116007     0.00     0.00  route_t::intern_calc_route(karte_t*, koord3d, koord3d, fahrer_t*, unsigned int, unsigned int, unsigned int)
  0.50     91.97     0.66 448949646     0.00     0.00  ware_besch_t::get_catg_index() const
  0.48     92.61     0.64 15187762     0.00     0.00  convoi_t::calc_adjusted_power()
  0.47     93.23     0.62  8888187     0.00     0.00  int_sqrt(unsigned int)
  0.44     93.82     0.59 436629257     0.00     0.00  ware_t::get_zwischenziel() const
  0.44     94.40     0.58 190850468     0.00     0.00  slist_tpl<hashtable_tpl<quickstone_tpl<haltestelle_t>, haltestelle_t::connexion*, quickstone_hash_tpl<haltestelle_t> >::node_t>::empty() const
  0.42     94.96     0.56  1566383     0.00     0.00  verkehrsteilnehmer_t::hop()
  0.39     95.47     0.52 377485657     0.00     0.00  koord::koord(short, short)
  0.38     95.98     0.51 108387051     0.00     0.00  obj_besch_t::get_child(int) const
  0.38     96.49     0.51  5670071     0.00     0.00  fabrik_t::step(long)
  0.36     96.97     0.48 174432890     0.00     0.00  karte_t::ist_in_kartengrenzen(short, short) const
  0.35     97.44     0.47 123249155     0.00     0.00  route_t::ANode::operator<=(route_t::ANode) const
  0.35     97.91     0.46 160792715     0.00     0.00  ding_t::set_flag(ding_t::flag_values)
  0.34     98.36     0.45 199642923     0.00     0.00  operator==(koord const&, koord const&)
  0.32     98.78     0.43 11351955     0.00     0.00  dingliste_t::intern_add_moving(ding_t*)
  0.32     99.20     0.42  8416847     0.00     0.00  haltestelle_t::get_ware_summe(ware_besch_t const*) const
  0.31     99.62     0.41  5209147     0.00     0.00  freelist_t::gimme_node(unsigned int)
  0.30    100.03     0.41 212712957     0.00     0.00  slist_iterator_tpl<hashtable_tpl<sync_steppable*, sync_steppable*, ptrhash_tpl<sync_steppable*> >::node_t>::access_current()
  0.30    100.42     0.40 12954229     0.00     0.00  dingliste_t::add(ding_t*)
  0.29    100.81     0.39 104961809     0.00     0.00  ding_t::get_pos() const
  0.29    101.19     0.38  8442612     0.00     0.00  vehikel_t::hop_check()
  0.28    101.56     0.38 26296568     0.00     0.00  grund_t::is_connected(grund_t const*, waytype_t, koord) const
  0.28    101.94     0.38  4791280     0.00     0.00  quickstone_tpl<haltestelle_t>::operator!=(quickstone_tpl<haltestelle_t> const&) const
  0.28    102.31     0.37 80174266     0.00     0.00  grund_t::get_grund_hang() const
  0.27    102.67     0.36     4601     0.00     0.00  karte_ansicht_t::display(bool)
  0.27    103.03     0.35 129456349     0.00     0.00  hashtable_iterator_tpl<sync_steppable*, sync_steppable*, ptrhash_tpl<sync_steppable*> >::next()
  0.27    103.38     0.35 27512174     0.00     0.00  planquadrat_t::get_boden_bei(unsigned int) const
  0.26    103.73     0.35  7708304     0.00     0.00  stadtauto_t::sync_step(long)
  0.26    104.07     0.34 208776141     0.00     0.00  quickstone_tpl<haltestelle_t>::operator==(quickstone_tpl<haltestelle_t> const&) const
  0.25    104.40     0.33 17622215     0.00     0.00  fixed_list_tpl<short, 16>::add_index(unsigned char, unsigned char, int)
  0.24    104.72     0.32 14727359     0.00     0.00  vehikel_basis_t::calc_height()
  0.23    105.03     0.31 278284064     0.00     0.00  ptrhash_tpl<sync_steppable*>::comp(sync_steppable*, sync_steppable*)
  0.23    105.33     0.31   580859     0.00     0.00  vector_tpl<ware_t>::vector_tpl()
  0.23    105.64     0.30 36095965     0.00     0.00  quickstone_tpl<haltestelle_t>::is_bound() const
  0.22    105.92     0.29  5626957     0.00     0.00  gebaeude_t::sync_step(long)
  0.21    106.21     0.28 195016241     0.00     0.00  slist_iterator_tpl<hashtable_tpl<sync_steppable*, sync_steppable*, ptrhash_tpl<sync_steppable*> >::node_t>::get_current() const
  0.21    106.49     0.28  2875773     0.00     0.00  hashtable_tpl<quickstone_tpl<haltestelle_t>, haltestelle_t::connexion*, quickstone_hash_tpl<haltestelle_t> >::empty() const
  0.21    106.77     0.28     2291     0.00     0.00  path_explorer_t::compartment_t::clear_all_connexion_tables()
  0.20    107.04     0.27  8193922     0.00     0.00  vehikel_t::calc_modified_speed_limit(koord3d const*, unsigned char, bool)
  0.20    107.30     0.26 45514307     0.00     0.00  waggon_t::get_waytype() const
  0.20    107.56     0.26  2399437     0.00     0.00  automobil_t::ist_weg_frei(int&)
  0.19    107.81     0.26 129445134     0.00     0.00  hashtable_iterator_tpl<sync_steppable*, sync_steppable*, ptrhash_tpl<sync_steppable*> >::get_current_value() const
  0.19    108.06     0.25 10752740     0.00     0.00  vehikel_basis_t::betrete_feld()
  0.18    108.31     0.24  9435275     0.00     0.00  binary_heap_tpl<route_t::ANode*>::insert(route_t::ANode*)
  0.18    108.55     0.24 138061132     0.00     0.00  koord3d::koord3d()
  0.18    108.79     0.24 27986558     0.00     0.00  quickstone_tpl<convoi_t>::operator->() const
  0.18    109.03     0.23 36618546     0.00     0.00  quickstone_tpl<convoi_t>::quickstone_tpl(quickstone_tpl<convoi_t> const&)
  0.18    109.26     0.23 32463838     0.00     0.00  planquadrat_t::get_halt() const
  0.18    109.50     0.23 21664384     0.00     0.00  bild_besch_t::get_nummer() const
  0.18    109.73     0.23 18897828     0.00     0.00  haltestelle_t::get_basis_pos() const
  0.17    109.96     0.23    62824     0.00     0.00  display_fillbox_wh(short, short, short, short, unsigned short, int)
  0.17    110.19     0.23    12196     0.00     0.01  karte_t::step()
  0.17    110.41     0.22 16161647     0.00     0.00  simrand(unsigned int)
  0.17    110.63     0.22  1201129     0.00     0.00  stadt_t::bewerte_loc(koord, char const*, unsigned short)
  0.16    110.84     0.21 30403859     0.00     0.00  bildliste_besch_t::get_bild(unsigned short) const
  0.16    111.06     0.21 33916711     0.00     0.00  planquadrat_t::get_kartenboden() const
  0.16    111.27     0.21 31002367     0.00     0.00  grund_t::get_halt() const
  0.16    111.47     0.21 17999616     0.00     0.00  vehikel_t::rauche()
  0.16    111.69     0.21 16503851     0.00     0.00  convoi_t::get_heaviest_vehicle() const
  0.16    111.89     0.21  2375010     0.00     0.00  fabrik_t::get_base_production() const
  0.16    112.11     0.21   279577     0.00     0.00  stadt_t::step_p****agiere()
  0.15    112.31     0.20  6599533     0.00     0.00  vector_tpl<ware_t>::operator[](unsigned int) const
  0.15    112.51     0.20 73821087     0.00     0.00  grund_t::get_weg_hang() const
  0.15    112.71     0.20 17257899     0.00     0.00  convoi_t::book(long long, int)
  0.15    112.91     0.20 14071617     0.00     0.00  wolke_t::sync_step(long)
  0.14    113.09     0.19 15296269     0.00     0.00  simrand_plain()
  0.14    113.28     0.18 29675138     0.00     0.00  weg_t::get_ribi_unmasked() const
  0.14    113.45     0.18  2960470     0.00     0.00  dingliste_t::suche(ding_t::typ, unsigned char) const
  0.13    113.62     0.17  6949776     0.00     0.00  waggon_t::betrete_feld()
  0.13    113.80     0.17   963244     0.00     0.00  haltestelle_t::recalc_status()
  0.12    113.96     0.17 53798055     0.00     0.00  grund_t::ist_bruecke() const
  0.12    114.12     0.16 26114378     0.00     0.00  marker_t::ist_markiert(grund_t const*) const
  0.12    114.28     0.16 10451171     0.00     0.00  haltestelle_t::get_besitzer() const
  0.12    114.44     0.16  8505637     0.00     0.00  spieler_t::buche(long long, player_cost)
  0.12    114.59     0.15 10760141     0.00     0.00  vehikel_basis_t::verl****e_feld()
  0.11    114.75     0.15 29500972     0.00     0.00  grund_t::get_weg_ribi_unmasked(waytype_t) const
  0.11    114.89     0.15 14913854     0.00     0.00  grund_t::ist_tunnel() const
  0.11    115.05     0.15  9517689     0.00     0.00  vehikel_besch_t::get_bild_nr(unsigned char, ware_besch_t const*) const
  0.11    115.19     0.15  2807502     0.00     0.00  display_mark_img_dirty(unsigned int, short, short)
  0.11    115.34     0.15  2682072     0.00     0.00  int_noise(long, long)
  0.11    115.50     0.15  1045746     0.00     0.00  waggon_t::ist_weg_frei(int&)
  0.11    115.64     0.14  2848702     0.00     0.00  haltestelle_t::is_enabled(ware_besch_t const*)
  0.11    115.78     0.14 50998359     0.00     0.00  str****e_t::get_waytype() const
  0.11    115.92     0.14 45371205     0.00     0.00  ware_t::get_index() const
  0.11    116.06     0.14 41029177     0.00     0.00  quickstone_tpl<haltestelle_t>::operator->() const
  0.11    116.20     0.14  7965269     0.00     0.00  vehikel_t::calc_akt_speed(grund_t const*)
  0.10    116.33     0.14  8193922     0.00     0.00  fixed_list_tpl<short, 16>::add_to_tail(short)
  0.10    116.47     0.14  5645060     0.00     0.00  karte_t::lookup_kartenboden(koord) const
  0.10    116.60     0.13  1257642     0.00     0.00  slist_tpl<grund_t const*>::is_contained(grund_t const* const&) const
  0.10    116.73     0.13   743426     0.00     0.00  waggon_t::block_reserver(route_t const*, unsigned short, int, bool) const
  0.09    116.85     0.12 95029541     0.00     0.00  grund_t::obj_bei(unsigned char) const
  0.09    116.97     0.12   629135     0.00     0.00  stadt_t::step(long)
  0.09    117.09     0.12   227883     0.00     0.00  convoi_t::laden()
  0.09    117.20     0.12 18158865     0.00     0.00  koord::koord(unsigned char)
  0.09    117.32     0.12 10752566     0.00     0.00  grund_t::get_weg_yoff() const
  0.09    117.44     0.12 10045216     0.00     0.00  haltestelle_t::get_halt(karte_t*, koord3d, spieler_t const*)
  0.09    117.55     0.12  1680131     0.00     0.00  dingliste_t::display_dinge(short, short, unsigned char, bool) const
  0.08    117.66     0.11 29236036     0.00     0.00  vehikel_basis_t::get_fahrtrichtung() const
  0.08    117.77     0.11  6028644     0.00     0.00  hashtable_tpl<quickstone_tpl<haltestelle_t>, haltestelle_t::connexion*, quickstone_hash_tpl<haltestelle_t> >::get(quickstone_tpl<haltestelle_t>) const
  0.08    117.88     0.11  1723915     0.00     0.00  hashtable_tpl<sync_steppable*, sync_steppable*, ptrhash_tpl<sync_steppable*> >::remove(sync_steppable*)
  0.08    117.99     0.11  1721419     0.00     0.00  slist_tpl<sync_steppable*>::remove_first()
  0.08    118.10     0.11  1386928     0.00     0.00  path_explorer_t::compartment_t::get_path_between(quickstone_tpl<haltestelle_t>, quickstone_tpl<haltestelle_t>, unsigned short&, quickstone_tpl<haltestelle_t>&)
Title: Re: gprof on SE 6.1
Post by: jamespetts on July 29, 2009, 10:06:08 pm
Thank you very much for running that profiling - that is very helpful. Based on those results, I have done a little optimisation work in haltestelle_t::hole_ab which will be available in the next release.
Title: Re: gprof on SE 6.1
Post by: knightly on July 30, 2009, 07:26:26 am
Hi Hanczar,

Many thanks for your kind ****istance ;)

May I know if you have enabled AI or done something (e.g. adding/removing stops, rotating/enlarging map, etc.) to the game yourself? I ask this because I noticed that path_explorer_t::compartment_t::clear_all_connexion_tables() was called 2291 times. This function should only be called when you (1) load a save game, (2) change from distributed to centralised path searching mode, (3) make certain changes to the game yourself (4) enable AIs which will make similar changes to the game themselves. I just want to make sure that it is not caused by any bug.

Knightly


Title: Re: gprof on SE 6.1
Post by: prissi on July 30, 2009, 08:16:51 am
Incidentally, the time spend in path_explorer_t::compartment_t::step() on this game is the same as needed for suche_route() in simutrans standard (although then of course as many schedule updates could be added whithout much additionally malus.)
Title: Re: gprof on SE 6.1
Post by: knightly on July 30, 2009, 09:13:58 am
Hanczar,

I have checked and most of the calls to path_explorer_t::compartment_t::clear_all_connexion_tables() are actually done during loading and quitting games (deallocating haltestelle_t objects). So, this is not a bug or caused by you/AIs. You can ignore my previous question. ;)

Many thanks!

Knightly