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.
This commit is contained in:
Patric Stout
2021-04-30 11:57:37 +02:00
committed by Patric Stout
parent e162aff7a3
commit 665a3928e2
9 changed files with 20 additions and 137 deletions

View File

@@ -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:
@@ -67,12 +65,6 @@ protected:
int m_stats_cost_calcs; ///< stats - how many node's costs were calculated
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)
@@ -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;
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)
);
}
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;
}