task_stats.inl

来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· INL 代码 · 共 56 行

INL
56
字号
//Task_Stats.inl,v 1.1 2001/12/20 00:02:40 pradeep Exp

ACE_INLINE int
Task_Stats::sample (ACE_UINT64 inv_start_time, ACE_UINT64 inv_end_time)
{
  if (this->samples_count_ >= this->max_samples_)
  {
    ACE_DEBUG ((LM_DEBUG, "Task_Stats::sample ret -1\n"));
    return -1;
   }
  ACE_UINT64 inv_value, exec_value;

  inv_value = inv_start_time - base_time_;
  exec_value  = inv_end_time - inv_start_time;

  this->time_inv_[this->samples_count_] = inv_value;
  this->time_exec_[this->samples_count_] = exec_value;

  this->samples_count_++;

  if (this->samples_count_ == 1u)
    {
      this->exec_time_min_ = exec_value;
      this->exec_time_min_at_ = this->samples_count_;
      this->exec_time_max_ = exec_value;
      this->exec_time_max_at_ = this->samples_count_;
      this->sum_ = exec_value;
#if defined ACE_LACKS_LONGLONG_T
      this->sum2_ = exec_value * ACE_U64_TO_U32 (exec_value);
#else  /* ! ACE_LACKS_LONGLONG_T */
      this->sum2_ = exec_value * exec_value;
#endif /* ! ACE_LACKS_LONGLONG_T */
    }
  else
    {
      if (this->exec_time_min_ > exec_value)
        {
          this->exec_time_min_ = exec_value;
          this->exec_time_min_at_ = this->samples_count_;
        }
      if (this->exec_time_max_ < exec_value)
        {
          this->exec_time_max_ = exec_value;
          this->exec_time_max_at_ = this->samples_count_;
        }

      this->sum_  += exec_value;
#if defined ACE_LACKS_LONGLONG_T
      this->sum2_ += exec_value * ACE_U64_TO_U32 (exec_value);
#else  /* ! ACE_LACKS_LONGLONG_T */
      this->sum2_ += exec_value * exec_value;
#endif /* ! ACE_LACKS_LONGLONG_T */
 }
    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?