Replace UptimeTimer with UptimeClock

* UptimeClock is a chrono-compatible seconds-precision clock.

* Like UptimeTimer, its purpose is to make it possible for clients
  to query the uptime thousands of times per second without a
  significant performance hit.

* UptimeClock decouples itself from LoadManager by managing its
  own once-per-second update loop.

* Clients now traffic in chrono time_points and durations instead
  of int.
This commit is contained in:
Howard Hinnant
2018-04-23 13:46:37 -04:00
committed by seelabs
parent 717f874767
commit 7d163a45dc
14 changed files with 159 additions and 186 deletions

View File

@@ -30,7 +30,7 @@
#include <ripple/app/misc/ValidatorList.h>
#include <ripple/app/tx/apply.h>
#include <ripple/basics/random.h>
#include <ripple/basics/UptimeTimer.h>
#include <ripple/basics/UptimeClock.h>
#include <ripple/beast/core/LexicalCast.h>
#include <ripple/beast/core/SemanticVersion.h>
#include <ripple/nodestore/DatabaseShard.h>
@@ -1864,7 +1864,7 @@ PeerImp::doFetchPack (const std::shared_ptr<protocol::TMGetObjectByHash>& packet
memcpy (hash.begin (), packet->ledgerhash ().data (), 32);
std::weak_ptr<PeerImp> weak = shared_from_this();
auto elapsed = UptimeTimer::getInstance().getElapsedSeconds();
auto elapsed = UptimeClock::now();
auto const pap = &app_;
app_.getJobQueue ().addJob (
jtPACK, "MakeFetchPack",