[llvm] 1215ff8 - Name threadpool threads.
Benoit Jacob via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 23 10:19:33 PST 2023
Author: Benoit Jacob
Date: 2023-02-23T18:11:15Z
New Revision: 1215ff89cde68bf66d2c883b19ad942fb2c5bf97
URL: https://github.com/llvm/llvm-project/commit/1215ff89cde68bf66d2c883b19ad942fb2c5bf97
DIFF: https://github.com/llvm/llvm-project/commit/1215ff89cde68bf66d2c883b19ad942fb2c5bf97.diff
LOG: 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
Added:
Modified:
llvm/lib/Support/ThreadPool.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/ThreadPool.cpp b/llvm/lib/Support/ThreadPool.cpp
index 31461e31c65ce..4eef339000e19 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<int>(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);
});
More information about the llvm-commits
mailing list