summaryrefslogtreecommitdiff
path: root/src/pathfinder/yapf/yapf_base.hpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-04-30 11:57:37 +0200
committerPatric Stout <github@truebrain.nl>2021-04-30 12:48:41 +0200
commit665a3928e2f07e6ee1faed1c8b08fe3a68fbc37a (patch)
tree8cd661bfeeddb5a618a2c22519f2b3d89507dfbb /src/pathfinder/yapf/yapf_base.hpp
parente162aff7a3d1dfcde1a9d02780235c617b6d4983 (diff)
downloadopenttd-665a3928e2f07e6ee1faed1c8b08fe3a68fbc37a.tar.xz
Remove: performance measurements in YAPF
YAPF was constantly measuring its performance, but only at certain debug-levels this information was shown. Now after years, I sincerely wonder if anyone still knows about this feature and who still use it. Especially with the new framerate window, this detailed performance is not as meaningful anymore as it once was.
Diffstat (limited to 'src/pathfinder/yapf/yapf_base.hpp')
-rw-r--r--src/pathfinder/yapf/yapf_base.hpp40
1 files changed, 11 insertions, 29 deletions
diff --git a/src/pathfinder/yapf/yapf_base.hpp b/src/pathfinder/yapf/yapf_base.hpp
index c04fa2af9..b34e40a67 100644
--- a/src/pathfinder/yapf/yapf_base.hpp
+++ b/src/pathfinder/yapf/yapf_base.hpp
@@ -13,8 +13,6 @@
#include "../../debug.h"
#include "../../settings_type.h"
-extern int _total_pf_time_us;
-
/**
* CYapfBaseT - A-star type path finder base class.
* Derive your own pathfinder from it. You must provide the following template argument:
@@ -68,12 +66,6 @@ protected:
int m_stats_cache_hits; ///< stats - how many node's costs were reused from cache
public:
- CPerformanceTimer m_perf_cost; ///< stats - total CPU time of this run
- CPerformanceTimer m_perf_slope_cost; ///< stats - slope calculation CPU time
- CPerformanceTimer m_perf_ts_cost; ///< stats - GetTrackStatus() CPU time
- CPerformanceTimer m_perf_other_cost; ///< stats - other CPU time
-
-public:
int m_num_steps; ///< this is there for debugging purposes (hope it doesn't hurt)
public:
@@ -120,9 +112,6 @@ public:
{
m_veh = v;
- CPerformanceTimer perf;
- perf.Start();
-
Yapf().PfSetStartupNodes();
bool bDestFound = true;
@@ -150,25 +139,18 @@ public:
bDestFound &= (m_pBestDestNode != nullptr);
- perf.Stop();
- if (_debug_yapf_level >= 2) {
- int t = perf.Get(1000000);
- _total_pf_time_us += t;
-
- if (_debug_yapf_level >= 3) {
- UnitID veh_idx = (m_veh != nullptr) ? m_veh->unitnumber : 0;
- char ttc = Yapf().TransportTypeChar();
- float cache_hit_ratio = (m_stats_cache_hits == 0) ? 0.0f : ((float)m_stats_cache_hits / (float)(m_stats_cache_hits + m_stats_cost_calcs) * 100.0f);
- int cost = bDestFound ? m_pBestDestNode->m_cost : -1;
- int dist = bDestFound ? m_pBestDestNode->m_estimate - m_pBestDestNode->m_cost : -1;
-
- DEBUG(yapf, 3, "[YAPF%c]%c%4d- %d us - %d rounds - %d open - %d closed - CHR %4.1f%% - C %d D %d - c%d(sc%d, ts%d, o%d) -- ",
- ttc, bDestFound ? '-' : '!', veh_idx, t, m_num_steps, m_nodes.OpenCount(), m_nodes.ClosedCount(),
- cache_hit_ratio, cost, dist, m_perf_cost.Get(1000000), m_perf_slope_cost.Get(1000000),
- m_perf_ts_cost.Get(1000000), m_perf_other_cost.Get(1000000)
- );
- }
+ if (_debug_yapf_level >= 3) {
+ UnitID veh_idx = (m_veh != nullptr) ? m_veh->unitnumber : 0;
+ char ttc = Yapf().TransportTypeChar();
+ float cache_hit_ratio = (m_stats_cache_hits == 0) ? 0.0f : ((float)m_stats_cache_hits / (float)(m_stats_cache_hits + m_stats_cost_calcs) * 100.0f);
+ int cost = bDestFound ? m_pBestDestNode->m_cost : -1;
+ int dist = bDestFound ? m_pBestDestNode->m_estimate - m_pBestDestNode->m_cost : -1;
+
+ DEBUG(yapf, 3, "[YAPF%c]%c%4d- %d rounds - %d open - %d closed - CHR %4.1f%% - C %d D %d",
+ ttc, bDestFound ? '-' : '!', veh_idx, m_num_steps, m_nodes.OpenCount(), m_nodes.ClosedCount(), cache_hit_ratio, cost, dist
+ );
}
+
return bDestFound;
}