Skip to content
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

It seems like the CPU load statistics for the thread pool are incorrect. #215

Open
Nic-bit opened this issue Feb 27, 2024 · 1 comment
Open

Comments

@Nic-bit
Copy link

Nic-bit commented Feb 27, 2024

截屏2024-02-27 20 30 08
In the run function of the thread pool, startSleep() and sleepWakeUp() are used to obtain the thread execution time and sleep time. Although both are locked, in the case of multiple threads and multiple CPUs, the statistics of execution time and sleep time are incorrect. Ideally, a ThreadLoadCounter should only count the running data of one thread. eg: You can record the start timestamp and end timestamp for a single thread.

截屏2024-02-27 20 30 08
线程池的run函数这里,使用startSleep()和sleepWakeUp()来获取线程执行时间和休眠时间,虽然两个都加锁,但是多线程多cpu的情况下,统计的执行时间和休眠时间不对,理想情况下一个ThreadLoadCounter只统计一个线程的运行数据。eg:可以对单个线程记录开始时间戳和结束时间戳。

TRANS_BY_GITHUB_AI_ASSISTANT

@xia-chu
Copy link
Member

xia-chu commented Feb 28, 2024

Indeed, this can only count the load of one thread. In the case of multiple threads, this statistic should be turned off.

确实 这个只能统计一个线程的负载情况 在多个线程的情况下 应该关闭这个统计

TRANS_BY_GITHUB_AI_ASSISTANT

@alexliyu7352 alexliyu7352 changed the title Threadpool的cpu负载统计好像有问题 It seems like the CPU load statistics for the thread pool are incorrect. Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants