-
Notifications
You must be signed in to change notification settings - Fork 9
feat: set thread name #115
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
Conversation
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.
It’s worth checking --v8-pool-size
as well, in relation to internal Node.js threads.
deps/node/src/node.cc
Outdated
@@ -1051,6 +1051,7 @@ InitializationResult InitializeOncePerProcess(int argc, char** argv) { | |||
V8::SetEntropySource(crypto::EntropySource); | |||
#endif // HAVE_OPENSSL | |||
|
|||
uv_thread_setname("lwnode::Main"); // @lwnode |
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.
uv_thread_setname("lwnode::Main"); // @lwnode | |
uv_thread_setname("MainThread"); // @lwnode |
deps/node/src/node_platform.cc
Outdated
@@ -27,7 +27,7 @@ struct PlatformWorkerData { | |||
static void PlatformWorkerThread(void* data) { | |||
std::unique_ptr<PlatformWorkerData> | |||
worker_data(static_cast<PlatformWorkerData*>(data)); | |||
|
|||
uv_thread_setname("lwnode::PT"); |
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.
uv_thread_setname("lwnode::PT"); | |
uv_thread_setname("V8Worker"); |
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.
IIUC, it's a V8 feature.
deps/node/src/node_platform.cc
Outdated
uv_thread_setname("lwnode::DTask"); | ||
printf("Starting delay thread\n"); |
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.
uv_thread_setname("lwnode::DTask"); | |
printf("Starting delay thread\n"); | |
uv_thread_setname("V8Worker"); |
deps/node/deps/uv/src/threadpool.c
Outdated
static void worker(void* arg) { | ||
uv_thread_setname("lwnode::uv"); |
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.
static void worker(void* arg) { | |
uv_thread_setname("lwnode::uv"); | |
static void worker(void* arg) { |
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.
IMO, naming here isn’t ideal. Naming for debugging should be set at the higher level that uses uv.
src/lwnode/lwnode-gc-strategy.cc
Outdated
@@ -45,6 +47,7 @@ void DelayedGC::handle(v8::Isolate* isolate) { | |||
|
|||
if (state_ == DelayedGCState::TIMER_END) { | |||
std::thread([&]() { | |||
uv_thread_setname("lwnode::gc"); |
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.
uv_thread_setname("lwnode::gc"); | |
uv_thread_setname("ScheduleGC"); |
@@ -1763,6 +1763,7 @@ UV_EXTERN int uv_thread_create_ex(uv_thread_t* tid, | |||
void* arg); | |||
UV_EXTERN uv_thread_t uv_thread_self(void); | |||
UV_EXTERN int uv_thread_join(uv_thread_t *tid); | |||
UV_EXTERN int uv_thread_setname(const char* name); |
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.
UV_EXTERN int uv_thread_setname(const char* name); | |
// @lwnode | |
UV_EXTERN int uv_thread_setname(const char* name); |
Does this API need the // @lwnode
tag like uv_watcher_queue_empty
?
Signed-off-by: Hosung Kim [email protected]
Signed-off-by: Hosung Kim [email protected]