diff options
author | Eliot Horowitz <eliot@10gen.com> | 2012-12-21 15:29:36 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2012-12-21 16:32:22 -0500 |
commit | db028e3543cf5ffedd0e8256069924a5b970b81c (patch) | |
tree | f90ec15bbf1cd0089c299d156427a88a90035f15 /src/mongo | |
parent | bb852c8a29cda31869d54f610cf4daf143387792 (diff) | |
download | mongo-db028e3543cf5ffedd0e8256069924a5b970b81c.tar.gz |
SERVER-1739 - change path and more things to track
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/curop.cpp | 39 | ||||
-rw-r--r-- | src/mongo/db/curop.h | 4 | ||||
-rw-r--r-- | src/mongo/db/instance.cpp | 9 |
3 files changed, 43 insertions, 9 deletions
diff --git a/src/mongo/db/curop.cpp b/src/mongo/db/curop.cpp index 642a46fc158..bc8f7287220 100644 --- a/src/mongo/db/curop.cpp +++ b/src/mongo/db/curop.cpp @@ -16,6 +16,8 @@ #include "mongo/pch.h" +#include "mongo/base/counter.h" +#include "mongo/db/commands/server_status.h" #include "mongo/db/curop.h" #include "mongo/db/database.h" #include "mongo/db/kill_current_op.h" @@ -200,4 +202,41 @@ namespace mongo { AtomicUInt CurOp::_nextOpNum; + static Counter64 c_returned; + static Counter64 c_inserted; + static Counter64 c_updated; + static Counter64 c_deleted; + static Counter64 c_scanned; + + static ServerStatusMetricField<Counter64> displayReturned( "document.returned", &c_returned ); + static ServerStatusMetricField<Counter64> displayUpdated( "document.updated", &c_updated ); + static ServerStatusMetricField<Counter64> displayInserted( "document.inserted", &c_inserted ); + static ServerStatusMetricField<Counter64> displayDeleted( "document.deleted", &c_deleted ); + static ServerStatusMetricField<Counter64> displayScanned( "document.scanned", &c_scanned ); + + static Counter64 c_idhack; + static Counter64 c_scanAndOrder; + static Counter64 c_fastmod; + + static ServerStatusMetricField<Counter64> displayIdhack( "query.idhack", &c_idhack ); + static ServerStatusMetricField<Counter64> displayScanAndOrder( "query.scanAndOrder", &c_scanAndOrder ); + static ServerStatusMetricField<Counter64> displayFastMod( "query.fastmod", &c_fastmod ); + + void OpDebug::recordStats() { + if ( nreturned > 0 ) + c_returned.increment( nreturned ); + // TODO: insert + if ( nupdated > 0 ) + c_updated.increment( nupdated ); + // TODO: delete + if ( nscanned > 0 ) + c_scanned.increment( nscanned ); + + if ( idhack ) + c_idhack.increment(); + if ( scanAndOrder ) + c_scanAndOrder.increment(); + if ( fastmod ) + c_fastmod.increment(); + } } diff --git a/src/mongo/db/curop.h b/src/mongo/db/curop.h index 3e075cb01fe..035ce30966b 100644 --- a/src/mongo/db/curop.h +++ b/src/mongo/db/curop.h @@ -39,7 +39,9 @@ namespace mongo { OpDebug() : ns(""){ reset(); } void reset(); - + + void recordStats(); + string report( const CurOp& curop ) const; /** diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp index aef7fed4538..ec6c9e0ce10 100644 --- a/src/mongo/db/instance.cpp +++ b/src/mongo/db/instance.cpp @@ -28,7 +28,6 @@ #endif #include "mongo/util/time_support.h" -#include "mongo/base/counter.h" #include "mongo/base/status.h" #include "mongo/bson/util/atomic_int.h" #include "mongo/db/auth/action_type.h" @@ -36,7 +35,6 @@ #include "mongo/db/background.h" #include "mongo/db/cmdline.h" #include "mongo/db/commands/fsync.h" -#include "mongo/db/commands/server_status.h" #include "mongo/db/d_concurrency.h" #include "mongo/db/db.h" #include "mongo/db/dbmessage.h" @@ -89,9 +87,6 @@ namespace mongo { HANDLE lockFileHandle; #endif - Counter64 recordTotalNScanned; - ServerStatusMetricField<Counter64> recordTotalNScannedDisplay( "record.totalNScanned", &recordTotalNScanned ); - /*static*/ OpTime OpTime::_now() { OpTime result; unsigned t = (unsigned) time(0); @@ -495,9 +490,7 @@ namespace mongo { } } - if ( debug.nscanned > 0 ) - recordTotalNScanned.increment( debug.nscanned ); - + debug.recordStats(); debug.reset(); } /* assembleResponse() */ |