We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug (描述bug) 在brpc的统计页面上,很容易就发现bthread_worker_usage的值 超过bthread_worker_count,理论上根据代码,bthread_worker_usage 的值不会超过TaskGroup的个数,因为代码 double TaskControl::get_cumulated_worker_time() { int64_t cputime_ns = 0; BAIDU_SCOPED_LOCK(_modify_group_mutex); const size_t ngroup = _ngroup.load(butil::memory_order_relaxed); for (size_t i = 0; i < ngroup; ++i) { if (_groups[i]) { cputime_ns += _groups[i]->_cumulated_cputime_ns; } } return cputime_ns / 1000000000.0; }
这个函数是一秒钟统计一次,如果定时器完全准的话,一定不会超过ngroup的个数 因此这个值是否强依赖定时器,因而不一定完全准确,是否应该将 cputime_ns / 1000000000.0; 更改为 cputime_ns / (real_elapse_time);其中real_elapse_time是这个函数两次 调用的时间差。
To Reproduce (复现方法)
Expected behavior (期望行为)
Versions (各种版本) OS: Compiler: brpc: 1.0.0 protobuf:
Additional context/screenshots (更多上下文/截图)
The text was updated successfully, but these errors were encountered:
听上去这么修改更合理些,你能否简单改一下验证一下呢?
Sorry, something went wrong.
ok,I will try
No branches or pull requests
Describe the bug (描述bug)
在brpc的统计页面上,很容易就发现bthread_worker_usage的值
超过bthread_worker_count,理论上根据代码,bthread_worker_usage
的值不会超过TaskGroup的个数,因为代码
double TaskControl::get_cumulated_worker_time() {
int64_t cputime_ns = 0;
BAIDU_SCOPED_LOCK(_modify_group_mutex);
const size_t ngroup = _ngroup.load(butil::memory_order_relaxed);
for (size_t i = 0; i < ngroup; ++i) {
if (_groups[i]) {
cputime_ns += _groups[i]->_cumulated_cputime_ns;
}
}
return cputime_ns / 1000000000.0;
}
这个函数是一秒钟统计一次,如果定时器完全准的话,一定不会超过ngroup的个数
因此这个值是否强依赖定时器,因而不一定完全准确,是否应该将
cputime_ns / 1000000000.0;
更改为 cputime_ns / (real_elapse_time);其中real_elapse_time是这个函数两次
调用的时间差。
To Reproduce (复现方法)
Expected behavior (期望行为)
Versions (各种版本)
OS:
Compiler:
brpc: 1.0.0
protobuf:
Additional context/screenshots (更多上下文/截图)
The text was updated successfully, but these errors were encountered: