far stricter profiling algorithm

* include first hop in profiling
* decay stats faster
* make fail case for path build profiling far more sensative
pull/1658/head
Jeff Becker 3 years ago
parent 23a82c493f
commit 66f6103832
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -64,7 +64,7 @@ namespace llarp
void
RouterProfile::Tick()
{
static constexpr auto updateInterval = 30min;
static constexpr auto updateInterval = 30s;
const auto now = llarp::time_now_ms();
if (lastDecay < now && now - lastDecay > updateInterval)
Decay();
@ -96,8 +96,9 @@ namespace llarp
bool
RouterProfile::IsGoodForPath(uint64_t chances) const
{
return checkIsGood(pathFailCount, pathSuccessCount, chances)
and checkIsGood(pathTimeoutCount, pathSuccessCount, chances);
if (pathTimeoutCount > chances)
return false;
return checkIsGood(pathFailCount, pathSuccessCount, chances);
}
Profiling::Profiling() : m_DisableProfiling(false)
@ -210,15 +211,10 @@ namespace llarp
Profiling::MarkPathTimeout(path::Path* p)
{
util::Lock lock{m_ProfilesMutex};
size_t idx = 0;
for (const auto& hop : p->hops)
{
if (idx)
{
m_Profiles[hop.rc.pubkey].pathTimeoutCount += 1;
m_Profiles[hop.rc.pubkey].lastUpdated = llarp::time_now_ms();
}
++idx;
m_Profiles[hop.rc.pubkey].pathTimeoutCount += 1;
m_Profiles[hop.rc.pubkey].lastUpdated = llarp::time_now_ms();
}
}

Loading…
Cancel
Save