Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add support for bthread cpu usage #2852

Merged
merged 1 commit into from
Dec 24, 2024
Merged

Conversation

icexin
Copy link
Contributor

@icexin icexin commented Dec 17, 2024

What problem does this PR solve?

Issue Number: #2833

Problem Summary:

What is changed and the side effects?

Changed:
通过添加一个新的 bthread_cpu_clock_ns 函数来获取当前bthread运行的时间,这个函数受 bthread_enable_cpu_clock_stat flag控制,默认不开启,需要获取运行时间的时候打开这个flag,用户在自己代码里面通过调用 bthread_cpu_clock_ns拿到运行时间采集到指标里面。

Side effects:

  • Performance effects(性能影响): 打开开关后稍微影响bthrad调度的性能,一次调度增加 ~200ns的开销。

  • Breaking backward compatibility(向后兼容性): 无


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@cdjingit
Copy link
Contributor

LGTM

@chenBright chenBright linked an issue Dec 20, 2024 that may be closed by this pull request
@wwbmmm
Copy link
Contributor

wwbmmm commented Dec 20, 2024

LGTM

Copy link
Contributor

@chenBright chenBright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cdjingit cdjingit merged commit 103da1d into apache:master Dec 24, 2024
20 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add feature for bthread cpu time usage
4 participants