Skip to content

add support for bthread cpu usage#2852

Merged
cdjingit merged 1 commit into
apache:masterfrom
icexin:bthread_cpu_time
Dec 24, 2024
Merged

add support for bthread cpu usage#2852
cdjingit merged 1 commit into
apache:masterfrom
icexin:bthread_cpu_time

Conversation

@icexin

@icexin icexin commented Dec 17, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

LGTM

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

wwbmmm commented Dec 20, 2024

Copy link
Copy Markdown
Contributor

LGTM

@chenBright chenBright left a comment

Copy link
Copy Markdown
Contributor

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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