summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authordwight <dwight@dwights-MacBook-Pro.local>2011-06-16 22:38:09 -0400
committerdwight <dwight@dwights-MacBook-Pro.local>2011-06-16 22:38:09 -0400
commitbbb2238e28082ae6bbc8222a62326c374409ce8e (patch)
tree313e91a480c229cbc2b677a48557a62d2e0e7dde /tools
parentb0f0f07ef3c2ca56f5a7f5310a1e1295582e51e1 (diff)
parent625f82720502abca68380fec37c558d115eaf39b (diff)
downloadmongo-bbb2238e28082ae6bbc8222a62326c374409ce8e.tar.gz
Merge branch 'master' of git@github.com:mongodb/mongo
Diffstat (limited to 'tools')
-rw-r--r--tools/dump.cpp1
-rw-r--r--tools/export.cpp5
-rw-r--r--tools/tool.h1
-rw-r--r--tools/top.cpp16
4 files changed, 14 insertions, 9 deletions
diff --git a/tools/dump.cpp b/tools/dump.cpp
index 3b35f95dcc5..59923927e62 100644
--- a/tools/dump.cpp
+++ b/tools/dump.cpp
@@ -18,6 +18,7 @@
#include "../pch.h"
#include "../client/dbclient.h"
+#include "../db/db.h"
#include "tool.h"
#include <fcntl.h>
diff --git a/tools/export.cpp b/tools/export.cpp
index 0262c4bf174..fb32a9e58ff 100644
--- a/tools/export.cpp
+++ b/tools/export.cpp
@@ -40,6 +40,7 @@ public:
("csv","export to csv instead of json")
("out,o", po::value<string>(), "output file; if not specified, stdout is used")
("jsonArray", "output to a json array rather than one object per line")
+ ("slaveOk,k", po::value<bool>()->default_value(true) , "use secondaries for export if available, default true")
;
_usesstdout = false;
}
@@ -110,7 +111,9 @@ public:
if ( q.getFilter().isEmpty() && !hasParam("dbpath"))
q.snapshot();
- auto_ptr<DBClientCursor> cursor = conn().query( ns.c_str() , q , 0 , 0 , fieldsToReturn , QueryOption_SlaveOk | QueryOption_NoCursorTimeout );
+ bool slaveOk = _params["slaveOk"].as<bool>();
+
+ auto_ptr<DBClientCursor> cursor = conn().query( ns.c_str() , q , 0 , 0 , fieldsToReturn , ( slaveOk ? QueryOption_SlaveOk : 0 ) | QueryOption_NoCursorTimeout );
if ( csv ) {
for ( vector<string>::iterator i=_fields.begin(); i != _fields.end(); i++ ) {
diff --git a/tools/tool.h b/tools/tool.h
index fd3403dcb16..95125e8a12a 100644
--- a/tools/tool.h
+++ b/tools/tool.h
@@ -28,6 +28,7 @@
#include "client/dbclient.h"
#include "db/instance.h"
+#include "db/matcher.h"
using std::string;
diff --git a/tools/top.cpp b/tools/top.cpp
index 88c479b45b7..bd3d8e7c26d 100644
--- a/tools/top.cpp
+++ b/tools/top.cpp
@@ -92,16 +92,16 @@ namespace mongo {
cout << "\n"
<< setw(longest) << "ns"
- << "\t total"
- << "\t read"
- << "\t write"
+ << "\ttotal "
+ << "\tread "
+ << "\twrite "
<< "\t\t" << terseCurrentTime()
<< endl;
for ( int i=data.size()-1; i>=0 && data.size() - i < 10 ; i-- ) {
cout << setw(longest) << data[i].ns
- << "\t" << setprecision(3) << ( data[i].timeDiff / ( 1000 * _sleep ) ) << "%"
- << "\t" << setprecision(3) << data[i].percentTime( "readLock" , _sleep) << "%"
- << "\t" << setprecision(3) << data[i].percentTime( "writeLock" , _sleep ) << "%"
+ << "\t" << setprecision(3) << data[i].diffTimeMS( "total" ) << "ms"
+ << "\t" << setprecision(3) << data[i].diffTimeMS( "readLock" ) << "ms"
+ << "\t" << setprecision(3) << data[i].diffTimeMS( "writeLock" ) << "ms"
<< endl;
}
}
@@ -152,8 +152,8 @@ namespace mongo {
}
- double percentTime( const char * field , double sleep ) const {
- return diffTime( field ) / ( 1000 * sleep );
+ int diffTimeMS( const char * field ) const {
+ return (int)(diffTime( field ) / 1000);
}
double diffTime( const char * field ) const {