mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 13:35:54 +00:00
Remove legacy upTime() function
This commit is contained in:
@@ -224,9 +224,11 @@ void TaggedCache<c_Key, c_Data, Timer>::sweep()
|
||||
|
||||
assert(cc == mCacheCount);
|
||||
if (ShouldLog (lsTRACE, TaggedCacheLog) && (mapRemovals || cacheRemovals))
|
||||
{
|
||||
WriteLog (lsTRACE, TaggedCacheLog) << mName << ": cache = " << mCache.size() << "-" << cacheRemovals <<
|
||||
", map-=" << mapRemovals;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename c_Key, typename c_Data, class Timer>
|
||||
bool TaggedCache<c_Key, c_Data, Timer>::touch(const key_type& key)
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
|
||||
private:
|
||||
// VFALCO: DEPRECATED, Use a memory barrier instead of forcing a cache line
|
||||
int m_pad1; // make sure m_uptimeSeconds fits in its own cache line
|
||||
int m_pad1; // make sure m_elapsedTime fits in its own cache line
|
||||
int m_elapsedTime;
|
||||
int m_pad2;
|
||||
|
||||
@@ -52,11 +52,4 @@ private:
|
||||
bool m_isUpdatingManually;
|
||||
};
|
||||
|
||||
// VFALCO: DEPRECATED, legacy compatibility function
|
||||
//
|
||||
inline int upTime ()
|
||||
{
|
||||
return UptimeTimer::getInstance ().getElapsedSeconds ();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@ DECLARE_INSTANCE(LedgerAcquire);
|
||||
PeerSet::PeerSet(const uint256& hash, int interval) : mHash(hash), mTimerInterval(interval), mTimeouts(0),
|
||||
mComplete(false), mFailed(false), mProgress(true), mAggressive(false), mTimer(theApp->getIOService())
|
||||
{
|
||||
mLastAction = upTime();
|
||||
mLastAction = UptimeTimer::getInstance().getElapsedSeconds();
|
||||
assert((mTimerInterval > 10) && (mTimerInterval < 30000));
|
||||
}
|
||||
|
||||
@@ -1008,7 +1008,7 @@ void LedgerAcquireMaster::sweep()
|
||||
{
|
||||
mRecentFailures.sweep();
|
||||
|
||||
int now = upTime();
|
||||
int now = UptimeTimer::getInstance().getElapsedSeconds();
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
|
||||
std::map<uint256, LedgerAcquire::pointer>::iterator it = mLedgers.begin();
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
bool isActive();
|
||||
void progress() { mProgress = true; mAggressive = false; }
|
||||
bool isProgress() { return mProgress; }
|
||||
void touch() { mLastAction = upTime(); }
|
||||
void touch() { mLastAction = UptimeTimer::getInstance().getElapsedSeconds(); }
|
||||
int getLastAction() { return mLastAction; }
|
||||
|
||||
void peerHas(Peer::ref);
|
||||
|
||||
@@ -134,7 +134,7 @@ bool LoadManager::shouldWarn(LoadSource& source) const
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
|
||||
int now = upTime();
|
||||
int now = UptimeTimer::getInstance().getElapsedSeconds ();
|
||||
canonicalize(source, now);
|
||||
if (source.isPrivileged() || (source.mBalance > mDebitWarn) || (source.mLastWarning == now))
|
||||
return false;
|
||||
@@ -149,7 +149,7 @@ bool LoadManager::shouldCutoff(LoadSource& source) const
|
||||
{
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
int now = upTime();
|
||||
int now = UptimeTimer::getInstance().getElapsedSeconds ();
|
||||
canonicalize(source, now);
|
||||
if (source.isPrivileged() || (source.mBalance > mDebitLimit))
|
||||
return false;
|
||||
@@ -171,7 +171,7 @@ bool LoadManager::adjust(LoadSource& source, int credits) const
|
||||
{ // return: true = need to warn/cutoff
|
||||
|
||||
// We do it this way in case we want to add exponential decay later
|
||||
int now = upTime();
|
||||
int now = UptimeTimer::getInstance().getElapsedSeconds ();
|
||||
canonicalize(source, now);
|
||||
source.mBalance += credits;
|
||||
if (source.mBalance > mCreditLimit)
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
||||
|
||||
extern int upTime();
|
||||
|
||||
enum LoadType
|
||||
{ // types of load that can be placed on the server
|
||||
|
||||
@@ -66,12 +63,24 @@ protected:
|
||||
bool mLogged;
|
||||
|
||||
public:
|
||||
LoadSource(bool admin) :
|
||||
mBalance(0), mFlags(admin ? lsfPrivileged : 0), mLastUpdate(upTime()), mLastWarning(0), mLogged(false)
|
||||
{ ; }
|
||||
LoadSource(const std::string& name) :
|
||||
mName(name), mBalance(0), mFlags(0), mLastUpdate(upTime()), mLastWarning(0), mLogged(false)
|
||||
{ ; }
|
||||
LoadSource(bool admin)
|
||||
: mBalance(0)
|
||||
, mFlags(admin ? lsfPrivileged : 0)
|
||||
, mLastUpdate(UptimeTimer::getInstance().getElapsedSeconds ())
|
||||
, mLastWarning(0)
|
||||
, mLogged(false)
|
||||
{
|
||||
}
|
||||
|
||||
LoadSource(const std::string& name)
|
||||
: mName(name)
|
||||
, mBalance(0)
|
||||
, mFlags(0)
|
||||
, mLastUpdate(UptimeTimer::getInstance().getElapsedSeconds ())
|
||||
, mLastWarning(0)
|
||||
, mLogged(false)
|
||||
{
|
||||
}
|
||||
|
||||
void rename(const std::string& name) { mName = name; }
|
||||
const std::string& getName() { return mName; }
|
||||
|
||||
@@ -4,7 +4,7 @@ SETUP_LOG (LoadMonitor)
|
||||
|
||||
void LoadMonitor::update()
|
||||
{ // call with the mutex
|
||||
int now = upTime();
|
||||
int now = UptimeTimer::getInstance().getElapsedSeconds ();
|
||||
|
||||
if (now == mLastUpdate) // current
|
||||
return;
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
extern int upTime();
|
||||
|
||||
// Monitors load levels and response times
|
||||
|
||||
class LoadMonitor
|
||||
@@ -27,9 +25,16 @@ protected:
|
||||
void update();
|
||||
|
||||
public:
|
||||
LoadMonitor() : mCounts(0), mLatencyEvents(0), mLatencyMSAvg(0), mLatencyMSPeak(0),
|
||||
mTargetLatencyAvg(0), mTargetLatencyPk(0)
|
||||
{ mLastUpdate = upTime(); }
|
||||
LoadMonitor()
|
||||
: mCounts(0)
|
||||
, mLatencyEvents(0)
|
||||
, mLatencyMSAvg(0)
|
||||
, mLatencyMSPeak(0)
|
||||
, mTargetLatencyAvg(0)
|
||||
, mTargetLatencyPk(0)
|
||||
{
|
||||
mLastUpdate = UptimeTimer::getInstance().getElapsedSeconds ();
|
||||
}
|
||||
|
||||
void addCount();
|
||||
void addLatency(int latency);
|
||||
|
||||
@@ -2005,7 +2005,7 @@ void NetworkOPs::makeFetchPack(Job&, boost::weak_ptr<Peer> wPeer,
|
||||
boost::shared_ptr<ripple::TMGetObjectByHash> request,
|
||||
Ledger::pointer wantLedger, Ledger::pointer haveLedger, uint32 uUptime)
|
||||
{
|
||||
if (upTime() > (uUptime + 1))
|
||||
if (UptimeTimer::getInstance().getElapsedSeconds () > (uUptime + 1))
|
||||
{
|
||||
WriteLog (lsINFO, NetworkOPs) << "Fetch pack request got stale";
|
||||
return;
|
||||
@@ -2066,7 +2066,7 @@ void NetworkOPs::makeFetchPack(Job&, boost::weak_ptr<Peer> wPeer,
|
||||
break;
|
||||
haveLedger = wantLedger;
|
||||
wantLedger = getLedgerByHash(haveLedger->getParentHash());
|
||||
} while (wantLedger && (upTime() <= (uUptime + 1)));
|
||||
} while (wantLedger && (UptimeTimer::getInstance().getElapsedSeconds () <= (uUptime + 1)));
|
||||
|
||||
WriteLog (lsINFO, NetworkOPs) << "Built fetch pack with " << reply.objects().size() << " nodes";
|
||||
PackedMessage::pointer msg = boost::make_shared<PackedMessage>(reply, ripple::mtGET_OBJECTS);
|
||||
|
||||
@@ -1918,7 +1918,7 @@ void Peer::doFetchPack(const boost::shared_ptr<ripple::TMGetObjectByHash>& packe
|
||||
}
|
||||
theApp->getJobQueue().addJob(jtPACK, "MakeFetchPack",
|
||||
BIND_TYPE(&NetworkOPs::makeFetchPack, &theApp->getOPs(), P_1,
|
||||
boost::weak_ptr<Peer>(shared_from_this()), packet, wantLedger, haveLedger, upTime()));
|
||||
boost::weak_ptr<Peer>(shared_from_this()), packet, wantLedger, haveLedger, UptimeTimer::getInstance().getElapsedSeconds ()));
|
||||
}
|
||||
|
||||
bool Peer::hasProto(int version)
|
||||
|
||||
@@ -2309,7 +2309,7 @@ Json::Value RPCHandler::doGetCounts(Json::Value jvRequest, int& cost, ScopedLock
|
||||
ret["AL_hit_rate"] = AcceptedLedger::getCacheHitRate();
|
||||
|
||||
std::string uptime;
|
||||
int s = upTime();
|
||||
int s = UptimeTimer::getInstance().getElapsedSeconds();
|
||||
textTime(uptime, s, "year", 365*24*60*60);
|
||||
textTime(uptime, s, "day", 24*60*60);
|
||||
textTime(uptime, s, "hour", 60*60);
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
DECLARE_INSTANCE(Suppression);
|
||||
|
||||
extern int upTime();
|
||||
|
||||
Suppression& SuppressionTable::findCreateEntry(const uint256& index, bool& created)
|
||||
{
|
||||
boost::unordered_map<uint256, Suppression>::iterator fit = mSuppressionMap.find(index);
|
||||
@@ -17,7 +15,7 @@ Suppression& SuppressionTable::findCreateEntry(const uint256& index, bool& creat
|
||||
}
|
||||
created = true;
|
||||
|
||||
int now = upTime();
|
||||
int now = UptimeTimer::getInstance().getElapsedSeconds ();
|
||||
int expireTime = now - mHoldTime;
|
||||
|
||||
// See if any supressions need to be expired
|
||||
|
||||
Reference in New Issue
Block a user