Skip to content

Commit

Permalink
Update logging messages in scheduled_thread_pool_impl.hpp to not dupl…
Browse files Browse the repository at this point in the history
…icate function name and explicitly call out pool name
  • Loading branch information
msimberg committed Sep 17, 2024
1 parent 451d503 commit 9369fac
Showing 1 changed file with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ namespace pika::threads::detail {
template <typename Lock>
void scheduled_thread_pool<Scheduler>::stop_locked(Lock& l, bool blocking)
{
PIKA_LOG(info, "stop: {} blocking({})", id_.name(), blocking);
PIKA_LOG(info, "pool \"{}\" blocking({})", id_.name(), blocking);

if (!threads_.empty())
{
Expand All @@ -227,11 +227,11 @@ namespace pika::threads::detail {
if (!threads_[i].joinable()) continue;

// make sure no OS thread is waiting
PIKA_LOG(info, "stop: {} notify_all", id_.name());
PIKA_LOG(info, "pool \"{}\" notify_all", id_.name());

sched_->Scheduler::do_some_work(std::size_t(-1));

PIKA_LOG(info, "stop: {} join:{}", id_.name(), i);
PIKA_LOG(info, "pool \"{}\" join:{}", id_.name(), i);

{
// unlock the lock while joining
Expand All @@ -257,9 +257,9 @@ namespace pika::threads::detail {
{
PIKA_ASSERT(l.owns_lock());

PIKA_LOG(info, "run: {} number of processing units available: {}", id_.name(),
PIKA_LOG(info, "pool \"{}\" number of processing units available: {}", id_.name(),
threads::detail::hardware_concurrency());
PIKA_LOG(info, "run: {} creating {} OS thread(s)", id_.name(), pool_threads);
PIKA_LOG(info, "pool \"{}\" creating {} OS thread(s)", id_.name(), pool_threads);

if (0 == pool_threads)
{
Expand All @@ -274,7 +274,7 @@ namespace pika::threads::detail {
init_perf_counter_data(pool_threads);
this->init_pool_time_scale();

PIKA_LOG(info, "run: {} timestamp_scale: {}", id_.name(), timestamp_scale_);
PIKA_LOG(info, "pool \"{}\" timestamp_scale: {}", id_.name(), timestamp_scale_);

// run threads and wait for initialization to complete
std::size_t thread_num = 0;
Expand All @@ -297,7 +297,7 @@ namespace pika::threads::detail {
// in affinity_data::affinity_masks_
// which is in order of occupied PU
PIKA_LOG(info,
"run: {} create OS thread {}: will run on processing units "
"pool \"{}\" create OS thread {}: will run on processing units "
"within this mask: {}",
id_.name(), global_thread_num, pika::threads::detail::to_string(mask));

Expand All @@ -312,7 +312,7 @@ namespace pika::threads::detail {
}
catch (std::exception const& e)
{
PIKA_LOG(critical, "run: {} failed with: {}", id_.name(), e.what());
PIKA_LOG(critical, "pool \"{}\" failed with: {}", id_.name(), e.what());

// trigger the barrier
pool_threads -= (thread_num + 1);
Expand All @@ -324,7 +324,7 @@ namespace pika::threads::detail {
return false;
}

PIKA_LOG(info, "run: {} running", id_.name());
PIKA_LOG(info, "pool \"{}\" running", id_.name());
return true;
}

Expand Down Expand Up @@ -407,8 +407,7 @@ namespace pika::threads::detail {
topo.set_thread_affinity_mask(mask, ec);
if (ec)
{
PIKA_LOG(warn,
"thread_func: {} setting thread affinity on OS thread {} failed with: {}",
PIKA_LOG(warn, "pool \"{}\" setting thread affinity on OS thread {} failed with: {}",
id_.name(), global_thread_num, ec.get_message());
}

Expand All @@ -422,7 +421,7 @@ namespace pika::threads::detail {
if (ec)
{
PIKA_LOG(warn,
"thread_func: {} reducing thread priority on OS thread {} failed with: {}",
"pool \"{}\" reducing thread priority on OS thread {} failed with: {}",
id_.name(), global_thread_num, ec.get_message());
}
}
Expand All @@ -440,7 +439,7 @@ namespace pika::threads::detail {
// wait for all threads to start up before before starting pika work
startup->wait();

PIKA_LOG(info, "thread_func: {} starting OS thread: {}", id_.name(), thread_num);
PIKA_LOG(info, "pool \"{}\" starting OS thread: {}", id_.name(), thread_num);

try
{
Expand Down Expand Up @@ -476,7 +475,7 @@ namespace pika::threads::detail {
catch (pika::exception const& e)
{
PIKA_LOG(critical,
"thread_func: {} thread_num:{} : caught pika::exception: {}, "
"pool \"{}\" thread_num:{} : caught pika::exception: {}, "
"aborted thread execution",
id_.name(), global_thread_num, e.what());

Expand All @@ -486,7 +485,7 @@ namespace pika::threads::detail {
catch (std::system_error const& e)
{
PIKA_LOG(critical,
"thread_func: {} thread_num:{} : caught std::system_error: {}, "
"pool \"{}\" thread_num:{} : caught std::system_error: {}, "
"aborted thread execution",
id_.name(), global_thread_num, e.what());

Expand All @@ -502,15 +501,15 @@ namespace pika::threads::detail {
catch (...)
{
PIKA_LOG(critical,
"thread_func: {} thread_num:{} : caught unexpected exception, aborted "
"pool \"{}\" thread_num:{} : caught unexpected exception, aborted "
"thread execution",
id_.name(), global_thread_num);

report_error(global_thread_num, std::current_exception());
return;
}

PIKA_LOG(info, "thread_func: {} thread_num: {}, ending OS thread, executed {} pika threads",
PIKA_LOG(info, "pool \"{}\" thread_num: {}, ending OS thread, executed {} pika threads",
id_.name(), global_thread_num,
counter_data_[global_thread_num].data_.executed_threads_);
}
Expand Down

0 comments on commit 9369fac

Please sign in to comment.