diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2018-07-23 16:50:52 -0400 |
---|---|---|
committer | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2018-07-23 16:50:52 -0400 |
commit | 458ecd6d1075848167995e135947345ad526501b (patch) | |
tree | 00ef8df925ef34d654dafc40070c2648fa743dc6 /src/mongo/tools/mongoebench_main.cpp | |
parent | 418550f93ac695801faf5b8e3a16655daac9c81f (diff) | |
download | mongo-458ecd6d1075848167995e135947345ad526501b.tar.gz |
SERVER-36073 Save benchRun stats generated by mongoebench to JSON file.
The --output command line option to mongoebench can be used to control
the destination.
Diffstat (limited to 'src/mongo/tools/mongoebench_main.cpp')
-rw-r--r-- | src/mongo/tools/mongoebench_main.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/tools/mongoebench_main.cpp b/src/mongo/tools/mongoebench_main.cpp index ef00204a0b4..ec8f1c828ee 100644 --- a/src/mongo/tools/mongoebench_main.cpp +++ b/src/mongo/tools/mongoebench_main.cpp @@ -30,6 +30,8 @@ #include "mongo/platform/basic.h" +#include <boost/filesystem.hpp> + #include "mongo/base/init.h" #include "mongo/db/dbdirectclient.h" #include "mongo/db/service_context.h" @@ -129,7 +131,11 @@ int mongoeBenchMain(int argc, char* argv[], char** envp) { sleepmillis(static_cast<long long>(seconds * 1000)); BSONObj stats = BenchRunner::finish(runner.release()); - log() << "stats: " << stats; + log() << "writing stats to " << mongoeBenchGlobalParams.outputFile.string() << ": " + << stats; + + boost::filesystem::ofstream outfile(mongoeBenchGlobalParams.outputFile); + outfile << stats.jsonString() << '\n'; } shutdown(EXIT_CLEAN); |