summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/db.vcxproj1
-rwxr-xr-xdb/db.vcxproj.filters3
-rw-r--r--db/dur.cpp9
-rw-r--r--db/dur_journal.cpp2
-rw-r--r--db/dur_stats.h21
-rw-r--r--db/dur_writetodatafiles.cpp2
6 files changed, 38 insertions, 0 deletions
diff --git a/db/db.vcxproj b/db/db.vcxproj
index af27648f97c..c4f9e1edc70 100644
--- a/db/db.vcxproj
+++ b/db/db.vcxproj
@@ -642,6 +642,7 @@
<ClInclude Include="dur_commitjob.h" />
<ClInclude Include="dur_journal.h" />
<ClInclude Include="dur_journalformat.h" />
+ <ClInclude Include="dur_stats.h" />
<ClInclude Include="geo\core.h" />
<ClInclude Include="helpers\dblogger.h" />
<ClInclude Include="instance.h" />
diff --git a/db/db.vcxproj.filters b/db/db.vcxproj.filters
index 2f318ffce93..f77d11b4125 100755
--- a/db/db.vcxproj.filters
+++ b/db/db.vcxproj.filters
@@ -849,6 +849,9 @@
<ClInclude Include="..\util\paths.h">
<Filter>util\core</Filter>
</ClInclude>
+ <ClInclude Include="dur_stats.h">
+ <Filter>_storage engine</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="libs">
diff --git a/db/dur.cpp b/db/dur.cpp
index 49f11401bf3..724f8f0817b 100644
--- a/db/dur.cpp
+++ b/db/dur.cpp
@@ -49,6 +49,7 @@
#include "../util/mongoutils/hash.h"
#include "../util/mongoutils/str.h"
#include "../util/timer.h"
+#include "dur_stats.h"
using namespace mongoutils;
@@ -58,6 +59,12 @@ namespace mongo {
void WRITETODATAFILES();
+ Stats stats;
+
+ Stats::Stats() {
+ memset(this, 0, sizeof(*this));
+ }
+
void NonDurableImpl::startup() {
if( haveJournalFiles() ) {
log() << "Error: journal files are present in journal directory, yet starting without --dur enabled." << endl;
@@ -402,6 +409,8 @@ namespace mongo {
@see MongoMMF::close()
*/
static void groupCommit() {
+ stats.curr._commits++;
+
dbMutex.assertAtLeastReadLocked();
if( !commitJob.hasWritten() )
diff --git a/db/dur_journal.cpp b/db/dur_journal.cpp
index 037467fcc56..f8ac1ff41d9 100644
--- a/db/dur_journal.cpp
+++ b/db/dur_journal.cpp
@@ -22,6 +22,7 @@
#include "namespace.h"
#include "dur_journal.h"
#include "dur_journalformat.h"
+#include "dur_stats.h"
#include "../util/logfile.h"
#include "../util/timer.h"
#include "../util/alignedbuilder.h"
@@ -288,6 +289,7 @@ namespace mongo {
mutex::scoped_lock lk(_lfMutex);
if( _lf == 0 )
open();
+ stats.curr._journaledBytes += b.len();
_written += b.len();
_lf->synchronousAppend((void *) b.buf(), b.len());
}
diff --git a/db/dur_stats.h b/db/dur_stats.h
new file mode 100644
index 00000000000..f9fe3f7eb7b
--- /dev/null
+++ b/db/dur_stats.h
@@ -0,0 +1,21 @@
+// @file dur_stats.h
+
+namespace mongo {
+ namespace dur {
+
+ /** journalling stats. the model here is that the commit thread is the only writer, and that reads are
+ uncommon (from a serverStatus command and such). Thus, there should not be multicore chatter overhead.
+ */
+ struct Stats {
+ Stats();
+ struct S {
+ unsigned _commits;
+ unsigned _dittos;
+ unsigned long long _journaledBytes;
+ unsigned long long _writeToDataFilesBytes;
+ } curr;
+ };
+ extern Stats stats;
+
+ }
+}
diff --git a/db/dur_writetodatafiles.cpp b/db/dur_writetodatafiles.cpp
index 627ce67f989..21b995c5732 100644
--- a/db/dur_writetodatafiles.cpp
+++ b/db/dur_writetodatafiles.cpp
@@ -18,6 +18,7 @@
#include "pch.h"
#include "dur_commitjob.h"
+#include "dur_stats.h"
namespace mongo {
namespace dur {
@@ -49,6 +50,7 @@ namespace mongo {
const WriteIntent& intent = commitJob.writes()[i];
char *dst = (char *) (intent.w_ptr);
memcpy(dst, intent.p, intent.len);
+ stats.curr._writeToDataFilesBytes += intent.len;
}
debugValidateMapsMatch();