curTimeMillis() was dubious as it rolls over frequently -- so eliminate it.

This commit is contained in:
dwight
2011-06-02 23:49:49 -04:00
parent f528a0e49d
commit 6510475ff1
8 changed files with 40 additions and 34 deletions

View File

@@ -484,7 +484,7 @@ namespace mongo {
}
long long x;
int ctm = (int) curTimeMillis();
int ctm = (int) curTimeMillis64();
while ( 1 ) {
x = (((long long)rand()) << 32);
x = x | ctm | 0x80000000; // OR to make sure not zero
@@ -580,21 +580,16 @@ namespace mongo {
void ClientCursorMonitor::run() {
Client::initThread("clientcursormon");
Client& client = cc();
unsigned old = curTimeMillis();
Timer t;
const int Secs = 4;
unsigned n = 0;
while ( ! inShutdown() ) {
unsigned now = curTimeMillis();
ClientCursor::idleTimeReport( now - old );
old = now;
ClientCursor::idleTimeReport( t.millisReset() );
sleepsecs(Secs);
if( ++n % (60/4) == 0 /*once a minute*/ ) {
sayMemoryStatus();
}
}
client.shutdown();
}