From 386fea8476ec82ab2de37271b4891305ece9ced3 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Thu, 28 Mar 2019 21:39:44 -0400 Subject: [PATCH] common: Update TrackedOp.h to work without using namespace Signed-off-by: Adam C. Emerson --- src/common/TrackedOp.h | 50 +++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/common/TrackedOp.h b/src/common/TrackedOp.h index 71072070bbe..ebdb24e3943 100644 --- a/src/common/TrackedOp.h +++ b/src/common/TrackedOp.h @@ -33,7 +33,7 @@ typedef boost::intrusive_ptr TrackedOpRef; class OpHistoryServiceThread : public Thread { private: - list> _external_queue; + std::list> _external_queue; OpHistory* _ophistory; mutable ceph::spinlock queue_spinlock; bool _break_thread; @@ -54,9 +54,9 @@ public: class OpHistory { - set > arrived; - set > duration; - set > slow_op; + std::set > arrived; + std::set > duration; + std::set > slow_op; ceph::mutex ops_history_lock = ceph::make_mutex("OpHistory::ops_history_lock"); void cleanup(utime_t now); uint32_t history_size; @@ -88,8 +88,8 @@ public: } void _insert_delayed(const utime_t& now, TrackedOpRef op); - void dump_ops(utime_t now, Formatter *f, set filters = {""}, bool by_duration=false); - void dump_slow_ops(utime_t now, Formatter *f, set filters = {""}); + void dump_ops(utime_t now, ceph::Formatter *f, std::set filters = {""}, bool by_duration=false); + void dump_slow_ops(utime_t now, ceph::Formatter *f, std::set filters = {""}); void on_shutdown(); void set_size_and_duration(uint32_t new_size, uint32_t new_duration) { history_size = new_size; @@ -105,7 +105,7 @@ struct ShardedTrackingData; class OpTracker { friend class OpHistory; std::atomic seq = { 0 }; - vector sharded_in_flight_list; + std::vector sharded_in_flight_list; OpHistory history; uint32_t num_optracker_shards; float complaint_time; @@ -133,9 +133,9 @@ public: void set_tracking(bool enable) { tracking_enabled = enable; } - bool dump_ops_in_flight(Formatter *f, bool print_only_blocked = false, set filters = {""}); - bool dump_historic_ops(Formatter *f, bool by_duration = false, set filters = {""}); - bool dump_historic_slow_ops(Formatter *f, set filters = {""}); + bool dump_ops_in_flight(ceph::Formatter *f, bool print_only_blocked = false, std::set filters = {""}); + bool dump_historic_ops(ceph::Formatter *f, bool by_duration = false, std::set filters = {""}); + bool dump_historic_slow_ops(ceph::Formatter *f, std::set filters = {""}); bool register_inflight_op(TrackedOp *i); void unregister_inflight_op(TrackedOp *i); void record_history_op(TrackedOpRef&& i); @@ -170,14 +170,14 @@ public: * Look for Ops which are too old, and insert warning * strings for each Op that is too old. * - * @param summary[out] a string summarizing slow Ops. - * @param warning_strings[out] A vector reference which is filled - * with a warning string for each old Op. + * @param summary[out] a std::string summarizing slow Ops. + * @param warning_strings[out] A std::vector reference which is filled + * with a warning std::string for each old Op. * @param slow[out] total number of slow ops * @return True if there are any Ops to warn on, false otherwise. */ bool check_ops_in_flight(std::string* summary, - std::vector &warning_strings, + std::vector &warning_strings, int* slow = nullptr); void on_shutdown() { @@ -246,15 +246,15 @@ protected: return str.c_str(); } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { f->dump_stream("time") << stamp; f->dump_string("event", str); } }; - vector events; ///< list of events and their times + std::vector events; ///< std::list of events and their times mutable ceph::mutex lock = ceph::make_mutex("TrackedOp::lock"); ///< to protect the events list - uint64_t seq = 0; ///< a unique value set by the OpTracker + uint64_t seq = 0; ///< a unique value std::set by the OpTracker uint32_t warn_interval_multiplier = 1; //< limits output of a given op warning @@ -263,11 +263,11 @@ protected: STATE_LIVE, STATE_HISTORY }; - atomic state = {STATE_UNTRACKED}; + std::atomic state = {STATE_UNTRACKED}; - mutable string desc_str; ///< protected by lock + mutable std::string desc_str; ///< protected by lock mutable const char *desc = nullptr; ///< readable without lock - mutable atomic want_new_desc = {false}; + mutable std::atomic want_new_desc = {false}; TrackedOp(OpTracker *_tracker, const utime_t& initiated) : tracker(_tracker), @@ -277,15 +277,15 @@ protected: } /// output any type-specific data you want to get when dump() is called - virtual void _dump(Formatter *f) const {} + virtual void _dump(ceph::Formatter *f) const {} /// if you want something else to happen when events are marked, implement virtual void _event_marked() {} /// return a unique descriptor of the Op; eg the message it's attached to - virtual void _dump_op_descriptor_unlocked(ostream& stream) const = 0; + virtual void _dump_op_descriptor_unlocked(std::ostream& stream) const = 0; /// called when the last non-OpTracker reference is dropped virtual void _unregistered() {} - virtual bool filter_out(const set& filters) { return true; } + virtual bool filter_out(const std::set& filters) { return true; } public: ZTracer::Trace osd_trace; @@ -342,7 +342,7 @@ public: } private: void _gen_desc() const { - ostringstream ss; + std::ostringstream ss; _dump_op_descriptor_unlocked(ss); desc_str = ss.str(); desc = desc_str.c_str(); @@ -376,7 +376,7 @@ public: return events.empty() ? std::string_view() : std::string_view(events.rbegin()->str); } - void dump(utime_t now, Formatter *f) const; + void dump(utime_t now, ceph::Formatter *f) const; void tracking_start() { if (tracker->register_inflight_op(this)) { -- 2.39.5