Example #1
0
 /**
  * Dump operations tracked
  *
  * @return Vector of trace information in string
  */
 std::vector<std::string> DumpAll() const {
   std::vector<std::string> ret;
   {
     uint64_t end_cnt = gcnt_;
     {
       MUTEX_LOCK_GUARD(data_mutex_);
       BOOST_FOREACH(const ThreadInfo* info, th_info_set_) {
         end_cnt = std::min(end_cnt,
                            info->cnt.load(boost::memory_order_acquire));
       }
     }
     boost::scoped_array<TraceInfo> clone(new TraceInfo[ring_buf_size]);
     for (unsigned i = 0; i < ring_buf_size; ++i)
       clone[i] = logs_[i];
     uint64_t start_cnt = gcnt_;
     start_cnt = start_cnt > ring_buf_size ? start_cnt - ring_buf_size : 0;
     {
       for (uint64_t pos = start_cnt; pos < end_cnt; ++pos) {
         TraceInfo ti = clone[pos % ring_buf_size];
         struct tm time_ret;
         char time_str[64];
         time_t time_added = ti.time_added;
         localtime_r(&time_added, &time_ret);
         strftime(time_str, sizeof(time_str), "%Y-%m-%d %H:%M:%S", &time_ret);
         std::string msg;
         msg = (boost::format("%s %s %s() inode: %d, client: %d") %
                boost::lexical_cast<std::string>(ti.th_id) % time_str %
                reinterpret_cast<const char*>(ti.method.load()) %
                ti.inode % ti.client).str();
         ret.push_back(msg);
       }
     }
   }
Example #2
0
   inline void move_up(node_type node)
   {
      MUTEX_LOCK_GUARD(mtx, normal_lock);

      if(!in_queue(node))
         return;
    
		QUEUE_DEFINE_INTRUSIVE_MOVE_UP();
   }
Example #3
0
   inline size_t pop_tail_half(T **buffer, const size_t max, const queue_id_t new_state)
   {
      MUTEX_LOCK_GUARD(mtx, normal_lock);

      size_t half = std::min(max, total / 2);

      if(half == 0)
         return 0;

      for(size_t i(0); i < half; ++i) {
         buffer[i] = head;
         __INTRUSIVE_QUEUE(head) = new_state;
         LOG_NORMAL_OPERATION();
         head = (node_type)__INTRUSIVE_NEXT(head);
      }
      // head will not be nullptr here.
      assert(head != nullptr);
      __INTRUSIVE_PREV(head) = nullptr;
      total -= half;
      return half;
   }
Example #4
0
void BaseInodeSrc::SetLastUsed(InodeNum inode) {
  MUTEX_LOCK_GUARD(data_mutex_);
  last_used_ = inode;
  Persist_();
}
Example #5
0
InodeNum BaseInodeSrc::GetLastUsed() {
  MUTEX_LOCK_GUARD(data_mutex_);
  return last_used_;
}
Example #6
0
	inline void push_head(node_type data)
	{
      MUTEX_LOCK_GUARD(mtx, normal_lock);
		
		push_head_node(data);
	}
Example #7
0
   inline bool pop_tail(node_type& data, const queue_id_t new_state)
   {
      MUTEX_LOCK_GUARD(mtx, normal_lock);

      QUEUE_DEFINE_INTRUSIVE_DOUBLE_POP_TAIL();
   }
Example #8
0
 inline bool pop_head(node_type& data, const queue_id_t new_state)
 {
    MUTEX_LOCK_GUARD(mtx, normal_lock);
    
    return do_pop_head(data, new_state);
 }
Example #9
0
   inline bool pop_if_not_empty(node_type& data, const queue_id_t new_state)
   {
      MUTEX_LOCK_GUARD(mtx, normal_lock);
      
		QUEUE_DEFINE_INTRUSIVE_DOUBLE_POP_IF_NOT_EMPTY();
   }