summaryrefslogtreecommitdiff
path: root/src/node_platform.cc
diff options
context:
space:
mode:
authorAli Ijaz Sheikh <ofrobots@google.com>2018-05-16 15:22:56 -0700
committerAli Ijaz Sheikh <ofrobots@google.com>2018-05-21 11:16:44 -0700
commit32873c5f9bc6e13b9cdff220b50bafeb3a1a2dec (patch)
tree21f9c34f010ff5b9d167b0b4c7653d3bce0ce358 /src/node_platform.cc
parent9c2e67ba97a4af0bb83c621b0c724f84198eac2d (diff)
downloadandroid-node-v8-32873c5f9bc6e13b9cdff220b50bafeb3a1a2dec.tar.gz
android-node-v8-32873c5f9bc6e13b9cdff220b50bafeb3a1a2dec.tar.bz2
android-node-v8-32873c5f9bc6e13b9cdff220b50bafeb3a1a2dec.zip
src: trace_events: background thread events
V8 uses a thread pool provided by the host to schedule background tasks for concurrent GC and compiation. Emit trace events to identify the background threads. Ensure that the tracing infrastructure is started before the thread pool is initialized. PR-URL: https://github.com/nodejs/node/pull/20823 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'src/node_platform.cc')
-rw-r--r--src/node_platform.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/node_platform.cc b/src/node_platform.cc
index b8f1344727..2885c72ed7 100644
--- a/src/node_platform.cc
+++ b/src/node_platform.cc
@@ -16,8 +16,10 @@ using v8::Platform;
using v8::Task;
using v8::TracingController;
-static void BackgroundRunner(void* data) {
- TaskQueue<Task>* background_tasks = static_cast<TaskQueue<Task>*>(data);
+static void BackgroundRunner(void *data) {
+ TRACE_EVENT_METADATA1("__metadata", "thread_name", "name",
+ "BackgroundTaskRunner");
+ TaskQueue<Task> *background_tasks = static_cast<TaskQueue<Task> *>(data);
while (std::unique_ptr<Task> task = background_tasks->BlockingPop()) {
task->Run();
background_tasks->NotifyOfCompletion();