Use built-in benchmarking for expedition caching

This commit is contained in:
hg 2020-05-23 17:04:53 -04:00
parent 8c1f556f29
commit 780cf148fa
2 changed files with 9 additions and 12 deletions

View File

@ -209,7 +209,7 @@ void Expedition::CacheFromDatabase(uint32_t expedition_id)
{
if (zone)
{
auto start = std::chrono::steady_clock::now();
BenchTimer benchmark;
auto results = ExpeditionDatabase::LoadExpedition(expedition_id);
if (!results.Success())
@ -220,9 +220,8 @@ void Expedition::CacheFromDatabase(uint32_t expedition_id)
CacheExpeditions(results);
auto end = std::chrono::steady_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::duration<float>>(end - start);
LogExpeditions("Caching new expedition [{}] took {}s", expedition_id, elapsed.count());
auto elapsed = benchmark.elapsed();
LogExpeditions("Caching new expedition [{}] took {}s", expedition_id, elapsed);
}
}
@ -233,7 +232,7 @@ bool Expedition::CacheAllFromDatabase()
return false;
}
auto start = std::chrono::steady_clock::now();
BenchTimer benchmark;
zone->expedition_cache.clear();
@ -247,9 +246,8 @@ bool Expedition::CacheAllFromDatabase()
CacheExpeditions(results);
auto end = std::chrono::steady_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::duration<float>>(end - start);
LogExpeditions("Caching [{}] expedition(s) took {}s", zone->expedition_cache.size(), elapsed.count());
auto elapsed = benchmark.elapsed();
LogExpeditions("Caching [{}] expedition(s) took {}s", zone->expedition_cache.size(), elapsed);
return true;
}

View File

@ -59,7 +59,7 @@ bool ExpeditionRequest::Validate(Client* requester)
// a message is sent to leader for every member that fails a requirement
auto start = std::chrono::steady_clock::now();
BenchTimer benchmark;
bool requirements_met = false;
@ -81,9 +81,8 @@ bool ExpeditionRequest::Validate(Client* requester)
requirements_met = ValidateMembers(fmt::format("'{}'", m_leader_name), 1);
}
auto end = std::chrono::steady_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::duration<float>>(end - start);
LogExpeditions("Create validation for [{}] members took {}s", m_members.size(), elapsed.count());
auto elapsed = benchmark.elapsed();
LogExpeditions("Create validation for [{}] members took {}s", m_members.size(), elapsed);
return requirements_met;
}