-
Notifications
You must be signed in to change notification settings - Fork 5.1k
add support for thread usage #8918
New issue
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要支持到多核,同时相关代码放components/utils/cpuusage
中
我会很快更新 |
/* to avoid scheduler time consuming */ | ||
from->duration_tick += pause_tick - from->last_start_tick; | ||
|
||
to->last_start_tick = rt_tick_get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议参考 FMT 的算法设计,用更高精度的时间戳去计算时间间隔
rt-thread 最新添加的 ktme 就挺合适的。
rt-thread/components/drivers/ktime/inc/ktime.h
Lines 37 to 44 in d0cf646
/** | |
* @brief Get boottime with us precision | |
* | |
* @param tv: timeval | |
* @return rt_err_t | |
*/ | |
rt_err_t rt_ktime_boottime_get_us(struct timeval *tv); | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢提供的建议,我会采纳并修改
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dyyt587 这个PR还在跟进吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前没有更进了
话说这个 PR 是不是和已经合并的 #8947 重复了? |
拉取/合并请求描述:(PR description)
为什么提交这份PR (why to submit this PR)
对调度器添加虚函数以支持cpu线程占用率测量,已有软件包仅提供总的cpu占用测量,且占用钩子函数,不满足实际需要
你的解决方案是什么 (what is your solution)
添加两个虚函数实现对每个线程cpu占用率的测量,且保留钩子函数并不占用,以提高扩展性。采用钩子链表可解决钩子函数占用问题但是将导致量钩子相关函数被重写,对内核文件改动过大过于复杂
请提供验证的bsp和config (provide the config and bsp)
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up