mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Use the new uptime code. Replace slow, non-monotonic 'time(NULL)' calls
with fast, almost-always-monotonic 'upTime()' calls.
This commit is contained in:
@@ -63,12 +63,12 @@ public:
|
||||
protected:
|
||||
int mBalance;
|
||||
int mFlags;
|
||||
time_t mLastUpdate;
|
||||
time_t mLastWarning;
|
||||
int mLastUpdate;
|
||||
int mLastWarning;
|
||||
|
||||
public:
|
||||
LoadSource() : mBalance(0), mFlags(0), mLastWarning(0)
|
||||
{ mLastUpdate = time(NULL); }
|
||||
{ mLastUpdate = upTime(); }
|
||||
|
||||
bool isPrivileged() const { return (mFlags & lsfPrivileged) != 0; }
|
||||
void setPrivileged() { mFlags |= lsfPrivileged; }
|
||||
@@ -89,11 +89,14 @@ protected:
|
||||
int mDebitLimit; // when a source drops below this, we cut it off (should be negative)
|
||||
|
||||
bool mShutdown;
|
||||
|
||||
int mSpace1[4]; // We want mUptime to have its own cache line
|
||||
int mUptime;
|
||||
int mSpace2[4];
|
||||
|
||||
mutable boost::mutex mLock;
|
||||
|
||||
void canonicalize(LoadSource&, const time_t now) const;
|
||||
void canonicalize(LoadSource&, int upTime) const;
|
||||
|
||||
std::vector<LoadCost> mCosts;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user