Use the new uptime code. Replace slow, non-monotonic 'time(NULL)' calls

with fast, almost-always-monotonic 'upTime()' calls.
This commit is contained in:
JoelKatz
2013-02-05 22:31:26 -08:00
parent 8c36646b8c
commit 1808454983
10 changed files with 44 additions and 35 deletions

View File

@@ -7,6 +7,7 @@
#include <boost/shared_ptr.hpp>
#include "types.h"
extern int upTime();
// Monitors load levels and response times
@@ -19,7 +20,7 @@ protected:
uint64 mLatencyMSPeak;
uint64 mTargetLatencyAvg;
uint64 mTargetLatencyPk;
time_t mLastUpdate;
int mLastUpdate;
boost::mutex mLock;
void update();
@@ -27,7 +28,7 @@ protected:
public:
LoadMonitor() : mCounts(0), mLatencyEvents(0), mLatencyMSAvg(0), mLatencyMSPeak(0),
mTargetLatencyAvg(0), mTargetLatencyPk(0)
{ mLastUpdate = time(NULL); }
{ mLastUpdate = upTime(); }
void addCount(int counts);
void addLatency(int latency);