diff options
author | smatz <smatz@openttd.org> | 2008-02-20 12:31:28 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-02-20 12:31:28 +0000 |
commit | 2b8d1bcb51b40f6c095ea5addf07cd66e34ef924 (patch) | |
tree | 1270c2e2f53edfd29d6a1354bf0eeee74ec8b6bc /src | |
parent | 169ac7c91da69d0b11dc78b7e9212ce50d4503dc (diff) | |
download | openttd-2b8d1bcb51b40f6c095ea5addf07cd66e34ef924.tar.xz |
(svn r12190) -Fix [FS#1786](r8080): YAPF always shows 0ms PF time in debug for debug level 2 (patch by IguannaB)
Diffstat (limited to 'src')
-rw-r--r-- | src/yapf/yapf_base.hpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/yapf/yapf_base.hpp b/src/yapf/yapf_base.hpp index c3ab93c72..1e8ea8973 100644 --- a/src/yapf/yapf_base.hpp +++ b/src/yapf/yapf_base.hpp @@ -138,21 +138,23 @@ public: #ifndef NO_DEBUG_MESSAGES perf.Stop(); - if (_debug_yapf_level >= 3) { + if (_debug_yapf_level >= 2) { int t = perf.Get(1000000); _total_pf_time_us += t; - UnitID veh_idx = (m_veh != NULL) ? 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(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 != NULL) ? 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(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) + ); + } } #endif /* !NO_DEBUG_MESSAGES */ return bDestFound; |