diff options
author | David Storch <david.storch@10gen.com> | 2014-10-02 12:47:38 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2014-10-02 16:08:47 -0400 |
commit | 2aac310f11bacb54d3339700171e08d73200a456 (patch) | |
tree | 26ab10ee819cbbf27ecf25e1141109c3ac868f23 /src | |
parent | 795462cb686806b662d3171bd34a00a5813a73a8 (diff) | |
download | mongo-2aac310f11bacb54d3339700171e08d73200a456.tar.gz |
SERVER-15363 fix solaris compile
Diffstat (limited to 'src')
29 files changed, 145 insertions, 31 deletions
diff --git a/src/mongo/db/exec/SConscript b/src/mongo/db/exec/SConscript index be712577ce5..af8ff1db981 100644 --- a/src/mongo/db/exec/SConscript +++ b/src/mongo/db/exec/SConscript @@ -33,6 +33,15 @@ env.Library( ) env.Library( + target = "scoped_timer", + source = [ + "scoped_timer.cpp", + ], + LIBDEPS = [ + ], +) + +env.Library( target = 'exec', source = [ "and_hash.cpp", @@ -70,6 +79,7 @@ env.Library( "working_set_common.cpp", ], LIBDEPS = [ + "scoped_timer", "$BUILD_DIR/mongo/bson", ], ) diff --git a/src/mongo/db/exec/and_hash.cpp b/src/mongo/db/exec/and_hash.cpp index 9a196ae5ecc..029e083c3a2 100644 --- a/src/mongo/db/exec/and_hash.cpp +++ b/src/mongo/db/exec/and_hash.cpp @@ -30,6 +30,7 @@ #include "mongo/db/exec/and_common-inl.h" #include "mongo/db/exec/filter.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/db/exec/working_set.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/db/exec/and_sorted.cpp b/src/mongo/db/exec/and_sorted.cpp index 57d7c1c2e83..bbbf301161c 100644 --- a/src/mongo/db/exec/and_sorted.cpp +++ b/src/mongo/db/exec/and_sorted.cpp @@ -30,6 +30,7 @@ #include "mongo/db/exec/and_common-inl.h" #include "mongo/db/exec/filter.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/util/mongoutils/str.h" @@ -220,7 +221,7 @@ namespace mongo { _targetNode = workingChildNumber; _targetLoc = member->loc; _targetId = id; - _workingTowardRep = queue<size_t>(); + _workingTowardRep = std::queue<size_t>(); for (size_t i = 0; i < _children.size(); ++i) { if (workingChildNumber != i) { _workingTowardRep.push(i); @@ -299,7 +300,7 @@ namespace mongo { _targetId = WorkingSet::INVALID_ID; _targetNode = numeric_limits<size_t>::max(); _targetLoc = DiskLoc(); - _workingTowardRep = queue<size_t>(); + _workingTowardRep = std::queue<size_t>(); } } diff --git a/src/mongo/db/exec/cached_plan.cpp b/src/mongo/db/exec/cached_plan.cpp index 13bc510535e..fec3225eb12 100644 --- a/src/mongo/db/exec/cached_plan.cpp +++ b/src/mongo/db/exec/cached_plan.cpp @@ -27,6 +27,7 @@ */ #include "mongo/db/exec/cached_plan.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/db/exec/collection_scan.cpp b/src/mongo/db/exec/collection_scan.cpp index f05c3431790..04788b8899f 100644 --- a/src/mongo/db/exec/collection_scan.cpp +++ b/src/mongo/db/exec/collection_scan.cpp @@ -31,6 +31,7 @@ #include "mongo/db/catalog/database.h" #include "mongo/db/exec/collection_scan_common.h" #include "mongo/db/exec/filter.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set.h" #include "mongo/db/catalog/collection.h" #include "mongo/util/fail_point_service.h" diff --git a/src/mongo/db/exec/count.cpp b/src/mongo/db/exec/count.cpp index 9f76ae10d1b..5a9251d9858 100644 --- a/src/mongo/db/exec/count.cpp +++ b/src/mongo/db/exec/count.cpp @@ -31,6 +31,7 @@ #include "mongo/db/exec/count.h" #include "mongo/db/catalog/collection.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" namespace mongo { diff --git a/src/mongo/db/exec/count_scan.cpp b/src/mongo/db/exec/count_scan.cpp index 4658ab9f759..1b278f9b541 100644 --- a/src/mongo/db/exec/count_scan.cpp +++ b/src/mongo/db/exec/count_scan.cpp @@ -28,6 +28,7 @@ #include "mongo/db/exec/count_scan.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/index/index_cursor.h" #include "mongo/db/index/index_descriptor.h" diff --git a/src/mongo/db/exec/delete.cpp b/src/mongo/db/exec/delete.cpp index b8c4b8c0d93..b758efabd4d 100644 --- a/src/mongo/db/exec/delete.cpp +++ b/src/mongo/db/exec/delete.cpp @@ -31,6 +31,7 @@ #include "mongo/db/exec/delete.h" #include "mongo/db/catalog/collection.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/db/repl/oplog.h" #include "mongo/db/repl/repl_coordinator_global.h" diff --git a/src/mongo/db/exec/distinct_scan.cpp b/src/mongo/db/exec/distinct_scan.cpp index 073a2ada59e..c960347ee42 100644 --- a/src/mongo/db/exec/distinct_scan.cpp +++ b/src/mongo/db/exec/distinct_scan.cpp @@ -29,6 +29,7 @@ #include "mongo/db/exec/distinct_scan.h" #include "mongo/db/exec/filter.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_computed_data.h" #include "mongo/db/index/index_access_method.h" #include "mongo/db/index/index_cursor.h" diff --git a/src/mongo/db/exec/eof.cpp b/src/mongo/db/exec/eof.cpp index f17084d7dae..46d9ba8c334 100644 --- a/src/mongo/db/exec/eof.cpp +++ b/src/mongo/db/exec/eof.cpp @@ -30,6 +30,8 @@ #include "mongo/db/exec/eof.h" +#include "mongo/db/exec/scoped_timer.h" + namespace mongo { // static diff --git a/src/mongo/db/exec/fetch.cpp b/src/mongo/db/exec/fetch.cpp index 62be74eda40..de7e5b2000b 100644 --- a/src/mongo/db/exec/fetch.cpp +++ b/src/mongo/db/exec/fetch.cpp @@ -30,6 +30,7 @@ #include "mongo/db/catalog/collection.h" #include "mongo/db/exec/filter.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/db/exec/group.cpp b/src/mongo/db/exec/group.cpp index 9d7a7592d0b..a8fae936a32 100644 --- a/src/mongo/db/exec/group.cpp +++ b/src/mongo/db/exec/group.cpp @@ -33,6 +33,7 @@ #include "mongo/db/auth/authorization_session.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/client_basic.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/scripting/engine.h" diff --git a/src/mongo/db/exec/idhack.cpp b/src/mongo/db/exec/idhack.cpp index 7b1845da8d2..800378c97d7 100644 --- a/src/mongo/db/exec/idhack.cpp +++ b/src/mongo/db/exec/idhack.cpp @@ -32,6 +32,7 @@ #include "mongo/client/dbclientinterface.h" #include "mongo/db/exec/projection.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_computed_data.h" #include "mongo/db/index/btree_access_method.h" #include "mongo/s/d_state.h" diff --git a/src/mongo/db/exec/index_scan.cpp b/src/mongo/db/exec/index_scan.cpp index 3e6532126ac..b5cdc410baa 100644 --- a/src/mongo/db/exec/index_scan.cpp +++ b/src/mongo/db/exec/index_scan.cpp @@ -29,6 +29,7 @@ #include "mongo/db/exec/index_scan.h" #include "mongo/db/exec/filter.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_computed_data.h" #include "mongo/db/index/index_access_method.h" #include "mongo/db/index/index_cursor.h" diff --git a/src/mongo/db/exec/keep_mutations.cpp b/src/mongo/db/exec/keep_mutations.cpp index 6698465b27f..83e637a2c91 100644 --- a/src/mongo/db/exec/keep_mutations.cpp +++ b/src/mongo/db/exec/keep_mutations.cpp @@ -27,7 +27,9 @@ */ #include "mongo/db/exec/keep_mutations.h" + #include "mongo/db/exec/filter.h" +#include "mongo/db/exec/scoped_timer.h" namespace mongo { diff --git a/src/mongo/db/exec/limit.cpp b/src/mongo/db/exec/limit.cpp index a5bf2a1ad80..9a8afada7f3 100644 --- a/src/mongo/db/exec/limit.cpp +++ b/src/mongo/db/exec/limit.cpp @@ -27,6 +27,8 @@ */ #include "mongo/db/exec/limit.h" + +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/db/exec/merge_sort.cpp b/src/mongo/db/exec/merge_sort.cpp index f8b30416dce..34b13791595 100644 --- a/src/mongo/db/exec/merge_sort.cpp +++ b/src/mongo/db/exec/merge_sort.cpp @@ -28,6 +28,7 @@ #include "mongo/db/exec/merge_sort.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/db/exec/multi_plan.cpp b/src/mongo/db/exec/multi_plan.cpp index 938995a2529..2732c501bba 100644 --- a/src/mongo/db/exec/multi_plan.cpp +++ b/src/mongo/db/exec/multi_plan.cpp @@ -31,6 +31,7 @@ #include "mongo/platform/basic.h" #include "mongo/db/exec/multi_plan.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/db/exec/or.cpp b/src/mongo/db/exec/or.cpp index bbbbc0d8bd2..6ff4a0dbab6 100644 --- a/src/mongo/db/exec/or.cpp +++ b/src/mongo/db/exec/or.cpp @@ -27,7 +27,9 @@ */ #include "mongo/db/exec/or.h" + #include "mongo/db/exec/filter.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/db/exec/plan_stats.h b/src/mongo/db/exec/plan_stats.h index 9ab2d9d214d..d24f522fcc6 100644 --- a/src/mongo/db/exec/plan_stats.h +++ b/src/mongo/db/exec/plan_stats.h @@ -99,35 +99,6 @@ namespace mongo { CommonStats(); }; - /** - * This class increments a counter by a rough estimate of the time elapsed since its - * construction when it goes out of scope. - */ - class ScopedTimer { - public: - ScopedTimer(long long* counter) : - _counter(counter), - _start(Listener::getElapsedTimeMillis()) { - } - - ~ScopedTimer() { - long long elapsed = Listener::getElapsedTimeMillis() - _start; - *_counter += elapsed; - } - - private: - // Default constructor disallowed. - ScopedTimer(); - - MONGO_DISALLOW_COPYING(ScopedTimer); - - // Reference to the counter that we are incrementing with the elapsed time. - long long* _counter; - - // Time at which the timer was constructed. - long long _start; - }; - // The universal container for a stage's stats. struct PlanStageStats { PlanStageStats(const CommonStats& c, StageType t) : stageType(t), common(c) { } diff --git a/src/mongo/db/exec/projection.cpp b/src/mongo/db/exec/projection.cpp index de6f8885dd2..842ea610d6f 100644 --- a/src/mongo/db/exec/projection.cpp +++ b/src/mongo/db/exec/projection.cpp @@ -30,6 +30,7 @@ #include "mongo/db/diskloc.h" #include "mongo/db/exec/plan_stage.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/db/jsobj.h" #include "mongo/db/matcher/expression.h" diff --git a/src/mongo/db/exec/scoped_timer.cpp b/src/mongo/db/exec/scoped_timer.cpp new file mode 100644 index 00000000000..9cf6f60ebad --- /dev/null +++ b/src/mongo/db/exec/scoped_timer.cpp @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2013-2014 MongoDB Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the GNU Affero General Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + +#include "mongo/platform/basic.h" + +#include "mongo/db/exec/scoped_timer.h" + +#include "mongo/util/net/listen.h" + +namespace mongo { + + ScopedTimer::ScopedTimer(long long* counter) : + _counter(counter), + _start(Listener::getElapsedTimeMillis()) { + } + + ScopedTimer::~ScopedTimer() { + long long elapsed = Listener::getElapsedTimeMillis() - _start; + *_counter += elapsed; + } + +} // namespace mongo diff --git a/src/mongo/db/exec/scoped_timer.h b/src/mongo/db/exec/scoped_timer.h new file mode 100644 index 00000000000..fa4c0d1f5c8 --- /dev/null +++ b/src/mongo/db/exec/scoped_timer.h @@ -0,0 +1,57 @@ +/** + * Copyright (C) 2013-2014 MongoDB Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the GNU Affero General Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + +#pragma once + +#include "mongo/base/disallow_copying.h" + +namespace mongo { + + /** + * This class increments a counter by a rough estimate of the time elapsed since its + * construction when it goes out of scope. + */ + class ScopedTimer { + MONGO_DISALLOW_COPYING(ScopedTimer); + public: + ScopedTimer(long long* counter); + + ~ScopedTimer(); + + private: + // Default constructor disallowed. + ScopedTimer(); + + // Reference to the counter that we are incrementing with the elapsed time. + long long* _counter; + + // Time at which the timer was constructed. + long long _start; + }; + +} // namespace mongo diff --git a/src/mongo/db/exec/shard_filter.cpp b/src/mongo/db/exec/shard_filter.cpp index 7ccd53b23dc..72d5d4a14a3 100644 --- a/src/mongo/db/exec/shard_filter.cpp +++ b/src/mongo/db/exec/shard_filter.cpp @@ -29,6 +29,7 @@ #include "mongo/db/exec/shard_filter.h" #include "mongo/db/exec/filter.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/db/keypattern.h" #include "mongo/s/stale_exception.h" diff --git a/src/mongo/db/exec/skip.cpp b/src/mongo/db/exec/skip.cpp index 6d0c1e6b657..067c068015c 100644 --- a/src/mongo/db/exec/skip.cpp +++ b/src/mongo/db/exec/skip.cpp @@ -27,6 +27,7 @@ */ #include "mongo/db/exec/skip.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/util/mongoutils/str.h" diff --git a/src/mongo/db/exec/sort.cpp b/src/mongo/db/exec/sort.cpp index 02665c9b5b0..308a09309e8 100644 --- a/src/mongo/db/exec/sort.cpp +++ b/src/mongo/db/exec/sort.cpp @@ -32,6 +32,7 @@ #include "mongo/db/catalog/collection.h" #include "mongo/db/index_names.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/db/exec/working_set_computed_data.h" #include "mongo/db/index/btree_key_generator.h" diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp index 973c1d8a54b..25af192a464 100644 --- a/src/mongo/db/exec/subplan.cpp +++ b/src/mongo/db/exec/subplan.cpp @@ -32,6 +32,7 @@ #include "mongo/client/dbclientinterface.h" #include "mongo/db/exec/multi_plan.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/query/canonical_query.h" #include "mongo/db/query/get_executor.h" #include "mongo/db/query/plan_executor.h" diff --git a/src/mongo/db/exec/text.cpp b/src/mongo/db/exec/text.cpp index 91a696ab186..98c0742537a 100644 --- a/src/mongo/db/exec/text.cpp +++ b/src/mongo/db/exec/text.cpp @@ -30,6 +30,7 @@ #include "mongo/base/owned_pointer_vector.h" #include "mongo/db/exec/filter.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/db/exec/working_set_computed_data.h" diff --git a/src/mongo/db/exec/update.cpp b/src/mongo/db/exec/update.cpp index e32f24d4b4c..74a3d008adf 100644 --- a/src/mongo/db/exec/update.cpp +++ b/src/mongo/db/exec/update.cpp @@ -33,6 +33,7 @@ #include "mongo/db/exec/update.h" #include "mongo/bson/mutable/algorithm.h" +#include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/db/ops/update_lifecycle.h" #include "mongo/db/repl/repl_coordinator_global.h" |