[PATCH] D118550: [Support] Have ThreadPool initialize a TimeTraceProfiler per thread

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 13:16:37 PST 2022


mehdi_amini added a comment.

(There are visible changes around the name associated with the tracer in `lld` that someone familiar with this in `lld` should approve.)



================
Comment at: llvm/lib/Support/ThreadPool.cpp:37
   int newThreadCount = std::min<int>(requested, MaxThreadCount);
+  TimeTraceProfiler *MainThreadProfiler = getTimeTraceProfilerInstance();
   while (static_cast<int>(Threads.size()) < newThreadCount) {
----------------
It seems that we'll always use the instance initialized in the thread that calls "grow".  Also, this instance has to be setup before the call to grow, and the thread can't reinitialize it for the lifetime duration of the ThreadPool if I understand correctly.

I'm not sure this makes sense in the full generality of the ThreadPool API?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118550/new/

https://reviews.llvm.org/D118550



More information about the llvm-commits mailing list