From: Benoit Jacob Date: Thu, 16 Feb 2023 15:23:13 +0000 (+0000) Subject: Name threadpool threads. X-Git-Tag: upstream/17.0.6~16645 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1215ff89cde68bf66d2c883b19ad942fb2c5bf97;p=platform%2Fupstream%2Fllvm.git Name threadpool threads. This gives our worker threads some names that allow easily identifying them in tools such as profilers and debuggers. Differential Revision: https://reviews.llvm.org/D144297 --- diff --git a/llvm/lib/Support/ThreadPool.cpp b/llvm/lib/Support/ThreadPool.cpp index 31461e3..4eef339 100644 --- a/llvm/lib/Support/ThreadPool.cpp +++ b/llvm/lib/Support/ThreadPool.cpp @@ -15,6 +15,7 @@ #include "llvm/Config/llvm-config.h" #if LLVM_ENABLE_THREADS +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/Threading.h" #else #include "llvm/Support/raw_ostream.h" @@ -43,6 +44,7 @@ void ThreadPool::grow(int requested) { while (static_cast(Threads.size()) < newThreadCount) { int ThreadID = Threads.size(); Threads.emplace_back([this, ThreadID] { + set_thread_name(formatv("llvm-worker-{0}", ThreadID)); Strategy.apply_thread_strategy(ThreadID); processTasks(nullptr); });