Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/node_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,17 @@ size_t Worker::NearHeapLimit(void* data, size_t current_heap_limit,
}

void Worker::Run() {
std::string trace_name = "[worker " + std::to_string(thread_id_.id) + "]" +
(name_ == "" ? "" : " " + name_);
std::string trace_name;
// Pre-allocate space: "[worker " (8) + thread_id (20) + "]" (1) + " " (1)
// + typical name (~30) = ~60 bytes. Use 64 for alignment.
trace_name.reserve(64);
trace_name = "[worker ";
trace_name += std::to_string(thread_id_.id);
trace_name += "]";
if (!name_.empty()) {
trace_name += " ";
trace_name += name_;
}
TRACE_EVENT_METADATA1(
"__metadata", "thread_name", "name", TRACE_STR_COPY(trace_name.c_str()));
CHECK_NOT_NULL(platform_);
Expand Down
Loading