diff options
author | Ben Caimano <ben.caimano@mongodb.com> | 2019-10-21 20:04:47 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-21 20:04:47 +0000 |
commit | b641599cf48d33bc79a4131ac8a8f5018dea83c4 (patch) | |
tree | 50500c6436bdb90ae0893fee20541cffeb4538ce /src/mongo/util/diagnostic_info.h | |
parent | a843d5a714e415e128916e49b76e2b2d333bb5d8 (diff) | |
download | mongo-b641599cf48d33bc79a4131ac8a8f5018dea83c4.tar.gz |
SERVER-42967 SERVER-42895 SERVER-44086 Expand DiagnosticInfo hooks in Interruptible and Mutex
This commit:
- Adds Listener hooks for Interruptible
- Expands Listener hooks for Mutex
- Updates the DiagnosticInfo and its tests to use the new hooks
- Removes stacktracing pieces from DiagnosticInfo and its tests
- Removes mongo::ConditionVariable entirely in favor of Interruptible
Diffstat (limited to 'src/mongo/util/diagnostic_info.h')
-rw-r--r-- | src/mongo/util/diagnostic_info.h | 50 |
1 files changed, 11 insertions, 39 deletions
diff --git a/src/mongo/util/diagnostic_info.h b/src/mongo/util/diagnostic_info.h index 4c4eb15c7ea..2b457fc50fe 100644 --- a/src/mongo/util/diagnostic_info.h +++ b/src/mongo/util/diagnostic_info.h @@ -31,8 +31,8 @@ #include "mongo/base/string_data.h" #include "mongo/db/client.h" -#include "mongo/platform/condition_variable.h" #include "mongo/platform/mutex.h" +#include "mongo/stdx/condition_variable.h" #include "mongo/util/fail_point.h" #include "mongo/util/time_support.h" @@ -43,6 +43,12 @@ namespace mongo { */ class DiagnosticInfo { public: + // Maximum number of stack frames to appear in a DiagnosticInfo::Backtrace. + static constexpr size_t kMaxBackTraceFrames = 100ull; + struct Backtrace { + std::vector<void*> data = std::vector<void*>(kMaxBackTraceFrames, nullptr); + }; + /** * A simple RAII guard to attempt to join a blocked op once it is no longer needed * @@ -57,32 +63,6 @@ public: virtual ~DiagnosticInfo() = default; - // Maximum number of stack frames to appear in a backtrace. - static constexpr size_t kMaxBackTraceFrames = 100ull; - struct Backtrace { - std::vector<void*> data = std::vector<void*>(kMaxBackTraceFrames, nullptr); - }; - - struct StackFrame { - std::string toString() const; - friend bool operator==(const StackFrame& frame1, const StackFrame& frame2); - friend bool operator!=(const StackFrame& frame1, const StackFrame& frame2) { - return !(frame1 == frame2); - } - - StringData objectPath; - uintptr_t instructionOffset = 0; - }; - struct StackTrace { - std::string toString() const; - friend bool operator==(const StackTrace& trace1, const StackTrace& trace2); - friend bool operator!=(const StackTrace& trace1, const StackTrace& trace2) { - return !(trace1 == trace2); - } - - std::vector<StackFrame> frames; - }; - Date_t getTimestamp() const { return _timestamp; } @@ -91,10 +71,6 @@ public: return _captureName; } - StackTrace makeStackTrace() const; - - static Backtrace getBacktrace(); - std::string toString() const; /** @@ -117,6 +93,10 @@ public: */ static std::unique_ptr<BlockedOpGuard> maybeMakeBlockedOpForTest(Client* client); + friend std::ostream& operator<<(std::ostream& s, const DiagnosticInfo& info) { + return s << info.toString(); + } + private: friend bool operator==(const DiagnosticInfo& info1, const DiagnosticInfo& info2); friend bool operator!=(const DiagnosticInfo& info1, const DiagnosticInfo& info2) { @@ -133,12 +113,4 @@ private: }; -inline std::ostream& operator<<(std::ostream& s, const DiagnosticInfo::StackFrame& frame) { - return s << frame.toString(); -} - -inline std::ostream& operator<<(std::ostream& s, const DiagnosticInfo& info) { - return s << info.toString(); -} - } // namespace mongo |