diff options
-rw-r--r-- | db/dbeval.cpp | 4 | ||||
-rw-r--r-- | dbtests/dbtests.cpp | 1 | ||||
-rw-r--r-- | dbtests/dbtests.h | 1 | ||||
-rw-r--r-- | mongo.xcodeproj/project.pbxproj | 2 | ||||
-rw-r--r-- | stdafx.h | 15 | ||||
-rw-r--r-- | util/util.cpp | 3 |
6 files changed, 13 insertions, 13 deletions
diff --git a/db/dbeval.cpp b/db/dbeval.cpp index a3a235ee082..2932c01dfb9 100644 --- a/db/dbeval.cpp +++ b/db/dbeval.cpp @@ -90,8 +90,8 @@ namespace mongo { int m = t.millis(); if ( m > 100 ) { out() << "dbeval slow, time: " << dec << m << "ms " << ns << endl; - OCCASIONALLY log() << code << endl; - else if ( m >= 1000 ) log() << code << endl; + if ( m >= 1000 ) log() << code << endl; + else OCCASIONALLY log() << code << endl; } } if ( res ) { diff --git a/dbtests/dbtests.cpp b/dbtests/dbtests.cpp index e8d37c76a79..00e33881baf 100644 --- a/dbtests/dbtests.cpp +++ b/dbtests/dbtests.cpp @@ -94,6 +94,7 @@ int main( int argc, char** argv ) { // make sure all tests run with this setup, by running javajs tests first. tests.add( jsTests(), "js" ); + tests.add( basicTests(), "basic" ); tests.add( btreeTests(), "btree" ); tests.add( jsobjTests(), "jsobj" ); tests.add( jsonTests(), "json" ); diff --git a/dbtests/dbtests.h b/dbtests/dbtests.h index 002d17263ed..c3ab8341a13 100644 --- a/dbtests/dbtests.h +++ b/dbtests/dbtests.h @@ -21,6 +21,7 @@ using namespace mongo; +UnitTest::TestPtr basicTests(); UnitTest::TestPtr btreeTests(); UnitTest::TestPtr jsTests(); UnitTest::TestPtr jsobjTests(); diff --git a/mongo.xcodeproj/project.pbxproj b/mongo.xcodeproj/project.pbxproj index 857f59a1a17..19b68b7de4b 100644 --- a/mongo.xcodeproj/project.pbxproj +++ b/mongo.xcodeproj/project.pbxproj @@ -249,6 +249,7 @@ 93B4A81B0F1C01D8000C862C /* lasterror.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lasterror.cpp; sourceTree = "<group>"; }; 93B4A8290F1C024C000C862C /* cursor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cursor.cpp; sourceTree = "<group>"; }; 93B4A82A0F1C0256000C862C /* pdfiletests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pdfiletests.cpp; sourceTree = "<group>"; }; + 93C38E940FA66622007D6E4A /* basictests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = basictests.cpp; sourceTree = "<group>"; }; 93CCC87F0F8562E900E20FA0 /* datasize.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = datasize.js; sourceTree = "<group>"; }; 93D0C1520EF1D377005253B7 /* jsobjtests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsobjtests.cpp; sourceTree = "<group>"; }; 93D0C1FB0EF1E267005253B7 /* namespacetests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = namespacetests.cpp; sourceTree = "<group>"; }; @@ -369,6 +370,7 @@ 934223850EF16D7000608550 /* dbtests */ = { isa = PBXGroup; children = ( + 93C38E940FA66622007D6E4A /* basictests.cpp */, 93AB914E0F4F1C7A0020A046 /* javajstests.cpp */, 932AC3EB0F4A5B34005BF8B0 /* queryoptimizertests.cpp */, 933E22100F4327B2000209E3 /* perf */, @@ -299,14 +299,13 @@ namespace mongo { #define DEBUGGING if( 0 ) - extern unsigned occasion; - extern unsigned occasionR; - extern unsigned once; - -#define OCCASIONALLY if( ++occasion % 16 == 0 ) -#define RARELY if( ++occasionR % 128 == 0 ) -#define ONCE if( ++once == 1 ) - + // The following declare one unique counter per enclosing function. + // NOTE The implementation double-increments on a match, but we don't really care. +#define SOMETIMES( occasion, howOften ) for( static unsigned occasion = 0; ++occasion % howOften == 0; ) +#define OCCASIONALLY SOMETIMES( occasionally, 16 ) +#define RARELY SOMETIMES( rarely, 128 ) +#define ONCE for( static bool undone = true; undone; undone = false ) + #if defined(_WIN32) #define strcasecmp _stricmp inline void our_debug_free(void *p) { diff --git a/util/util.cpp b/util/util.cpp index 0cb8a3e4e31..7cc02b1ac7a 100644 --- a/util/util.cpp +++ b/util/util.cpp @@ -33,9 +33,6 @@ namespace mongo { int logLevel = 0; boost::mutex Logstream::mutex; - unsigned occasion = 0; - unsigned occasionR = 0; - unsigned once = 0; bool goingAway = false; bool isPrime(int n) { |