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