-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
add support for cpu usage #8718
base: master
Are you sure you want to change the base?
Conversation
这个软件包只有总的cpu使用率,并且占用钩子函数 |
#8091 建议是有套独立的框架,兼顾到 SMP/UMP 的场景。用静态 HOOK 插入,而不是这样直接在调度器插入一大堆条件编译代码。否则维护者阅读代码会很累的。 HOOK 可以用 HOOKLIST 实现,无限制 hook 数量的。 |
src/scheduler_up.c
Outdated
rt_weak rt_uint64_t rt_thread_usage_get_now_time(void) | ||
{ | ||
#ifdef PKG_USING_PERF_COUNTER | ||
// #include <perf_counter.h> |
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.
这是考虑软件包出处的结果,我会马上修改
目前代码考虑到调度器的时间占用排除,独立框架要实现可以通过添加hook接入点解决(预计多添加一个接入点),这样是否可行,同时对于兼顾到 SMP/UMP 的场景能否给与一些指点,对于多核场景,我不是太熟悉 |
需要支持到多核的,否则没办法合入。或者也可以把软件包的合并到内核中来。 |
我正在学习多核兼容相关内容,预计很快会有更新 |
拉取/合并请求描述:(PR description)
为什么提交这份PR (why to submit this PR)
让rtthread支持线程cpu占用率统计
你的解决方案是什么 (what is your solution)
使用全局tick或者perfcounter组件获取全局时间,然后记录线程运行总时间,最后得到占用率
请提供验证的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