-
Notifications
You must be signed in to change notification settings - Fork 85
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 log about resource usages on slow threads #1885
Conversation
I see this code uses |
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.
Thanks, looks good 👍
libstuff/ResourceMonitorThread.h
Outdated
static thread_local double cpuStartTime; | ||
|
||
static void before(); | ||
static void after(); |
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.
I wonder if we should pick a more descriptive name for these? It doesn't really matter that much to me.
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.
changed to beforeProcessStart
and afterProcessFinished
. Let me know what you think
@tylerkaraszewski @flodnv updated, ready for re-review! |
libstuff/ResourceMonitorThread.h
Outdated
thread(ResourceMonitorThread::wrapper<F&&, Args&&...>, forward<F&&>(f), forward<Args&&>(args)...){}; | ||
private: | ||
static uint64_t threadStartTime; | ||
static double cpuStartTime; |
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.
These are broken now, they should not be static, the values are shared between threads that way. These should just be member variables.
Details
We are trying to figure out what is causing high CPU usage in Bedrock for https://github.com/Expensify/Expensify/issues/417250
This PR adds a wrapper on the thread class that allows us to track the CPU time/CPU % any thread is using.
Fixed Issues
related to https://github.com/Expensify/Expensify/issues/417250
https://github.com/Expensify/Expensify/issues/433363
Tests
To test it locally, run the the test suite and confirm that you see logs like this logs:
Internal Testing Reminder: when changing bedrock, please compile auth against your new changes