]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common: Update TrackedOp.h to work without using namespace
authorAdam C. Emerson <aemerson@redhat.com>
Fri, 29 Mar 2019 01:39:44 +0000 (21:39 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Fri, 29 Mar 2019 14:30:38 +0000 (10:30 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/common/TrackedOp.h

index 71072070bbe407d0af3fd57a9ab5e192ac737600..ebdb24e394386e7d67713e1bb24a202e452f7363 100644 (file)
@@ -33,7 +33,7 @@ typedef boost::intrusive_ptr<TrackedOp> TrackedOpRef;
 class OpHistoryServiceThread : public Thread
 {
 private:
-  list<pair<utime_t, TrackedOpRef>> _external_queue;
+  std::list<std::pair<utime_t, TrackedOpRef>> _external_queue;
   OpHistory* _ophistory;
   mutable ceph::spinlock queue_spinlock;
   bool _break_thread;
@@ -54,9 +54,9 @@ public:
 
 
 class OpHistory {
-  set<pair<utime_t, TrackedOpRef> > arrived;
-  set<pair<double, TrackedOpRef> > duration;
-  set<pair<utime_t, TrackedOpRef> > slow_op;
+  std::set<std::pair<utime_t, TrackedOpRef> > arrived;
+  std::set<std::pair<double, TrackedOpRef> > duration;
+  std::set<std::pair<utime_t, TrackedOpRef> > 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<string> filters = {""}, bool by_duration=false);
-  void dump_slow_ops(utime_t now, Formatter *f, set<string> filters = {""});
+  void dump_ops(utime_t now, ceph::Formatter *f, std::set<std::string> filters = {""}, bool by_duration=false);
+  void dump_slow_ops(utime_t now, ceph::Formatter *f, std::set<std::string> 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<int64_t> seq = { 0 };
-  vector<ShardedTrackingData*> sharded_in_flight_list;
+  std::vector<ShardedTrackingData*> 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<string> filters = {""});
-  bool dump_historic_ops(Formatter *f, bool by_duration = false, set<string> filters = {""});
-  bool dump_historic_slow_ops(Formatter *f, set<string> filters = {""});
+  bool dump_ops_in_flight(ceph::Formatter *f, bool print_only_blocked = false, std::set<std::string> filters = {""});
+  bool dump_historic_ops(ceph::Formatter *f, bool by_duration = false, std::set<std::string> filters = {""});
+  bool dump_historic_slow_ops(ceph::Formatter *f, std::set<std::string> 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<string> 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<std::string> 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<string> &warning_strings,
+                          std::vector<std::string> &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<Event> events;    ///< list of events and their times
+  std::vector<Event> 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<int> state = {STATE_UNTRACKED};
+  std::atomic<int> 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<bool> want_new_desc = {false};
+  mutable std::atomic<bool> 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<string>& filters) { return true; }
+  virtual bool filter_out(const std::set<std::string>& 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)) {