]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OpTracker: get rid of TrackedOp::received_time for the Message
authorGreg Farnum <greg@inktank.com>
Fri, 20 Sep 2013 00:12:57 +0000 (17:12 -0700)
committerGreg Farnum <greg@inktank.com>
Fri, 20 Sep 2013 01:15:00 +0000 (18:15 -0700)
Signed-off-by: Greg Farnum <greg@inktank.com>
src/common/TrackedOp.cc
src/common/TrackedOp.h
src/osd/OpRequest.cc

index c9e9a061a49039ec031ab1c1b358f098fbae679a..4ed9f20d1fcd79a8aa11600be5d7c20982d85a86 100644 (file)
@@ -134,7 +134,7 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &warning_vector)
   utime_t too_old = now;
   too_old -= cct->_conf->op_tracker_complaint_time;
 
-  utime_t oldest_secs = now - ops_in_flight.front()->received_time;
+  utime_t oldest_secs = now - ops_in_flight.front()->get_arrived();
 
   dout(10) << "ops_in_flight.size: " << ops_in_flight.size()
            << "; oldest is " << oldest_secs
@@ -148,11 +148,11 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &warning_vector)
 
   int slow = 0;     // total slow
   int warned = 0;   // total logged
-  while (!i.end() && (*i)->received_time < too_old) {
+  while (!i.end() && (*i)->get_arrived() < too_old) {
     slow++;
 
     // exponential backoff of warning intervals
-    if (((*i)->received_time +
+    if (((*i)->get_arrived() +
         (cct->_conf->op_tracker_complaint_time *
          (*i)->warn_interval_multiplier)) < now) {
       // will warn
@@ -162,9 +162,9 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &warning_vector)
       if (warned > cct->_conf->op_tracker_log_threshold)
         break;
 
-      utime_t age = now - (*i)->received_time;
+      utime_t age = now - (*i)->get_arrived();
       stringstream ss;
-      ss << "slow request " << age << " seconds old, received at " << (*i)->received_time
+      ss << "slow request " << age << " seconds old, received at " << (*i)->get_arrived()
         << ": " << *((*i)->request) << " currently "
         << ((*i)->current.size() ? (*i)->current : (*i)->state_string());
       warning_vector.push_back(ss.str());
@@ -198,7 +198,7 @@ void OpTracker::get_age_ms_histogram(pow2_hist_t *h)
   uint32_t lb = 1 << (bin-1);  // lower bound for this bin
   int count = 0;
   for (xlist<TrackedOp*>::iterator i = ops_in_flight.begin(); !i.end(); ++i) {
-    utime_t age = now - (*i)->received_time;
+    utime_t age = now - (*i)->get_arrived();
     uint32_t ms = (long)(age * 1000.0);
     if (ms >= lb) {
       count++;
index 94eb4e3f71e029c5079ce3b900e77171805754e9..9007a4d5bd2dab35481d1c51b60ddcbe203fc136 100644 (file)
@@ -119,7 +119,6 @@ protected:
 
   list<pair<utime_t, string> > events; /// list of events and their times
   Mutex lock; /// to protect the events list
-  utime_t received_time; /// the time the triggering Message was received
   string current; /// the current state the event is in
   uint64_t seq; /// a unique value set by the OpTracker
 
@@ -133,7 +132,6 @@ protected:
     seq(0),
     warn_interval_multiplier(1)
   {
-    received_time = request->get_recv_stamp();
     tracker->register_inflight_op(&xitem);
   }
 
@@ -143,12 +141,12 @@ public:
   virtual ~TrackedOp() { assert(request); request->put(); }
 
   utime_t get_arrived() const {
-    return received_time;
+    return request->get_recv_stamp();
   }
   // This function maybe needs some work; assumes last event is completion time
   double get_duration() const {
     return events.size() ?
-      (events.rbegin()->first - received_time) :
+      (events.rbegin()->first - get_arrived()) :
       0.0;
   }
   Message *get_req() const { return request; }
index 30ff999719f0475e2efbbd36efe75f20626d7922..1c523585a8e21dc3c322ba7819b9621e2a58fe8d 100644 (file)
@@ -30,8 +30,8 @@ void OpRequest::dump(utime_t now, Formatter *f) const
   m->print(name);
   f->dump_string("description", name.str().c_str()); // this OpRequest
   f->dump_unsigned("rmw_flags", rmw_flags);
-  f->dump_stream("received_at") << received_time;
-  f->dump_float("age", now - received_time);
+  f->dump_stream("received_at") << get_arrived();
+  f->dump_float("age", now - get_arrived());
   f->dump_float("duration", get_duration());
   f->dump_string("flag_point", state_string());
   if (m->get_orig_source().is_client()) {