• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #856

28 Dec 2022 02:00AM UTC coverage: 86.602% (+0.05%) from 86.55%
#856

push

StellarBot
Merge #6119

6119: Update CMakeLists.txt r=hkaiser a=khuck

updating the default APEX version


Co-authored-by: Kevin Huck <khuck@cs.uoregon.edu>

174566 of 201573 relevant lines covered (86.6%)

1876093.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.71
/libs/full/performance_counters/src/threadmanager_counter_types.cpp
1
//  Copyright (c) 2007-2022 Hartmut Kaiser
2
//  Copyright (c)      2011 Bryce Lelbach, Katelyn Kufahl
3
//  Copyright (c) 2008-2009 Chirag Dekate, Anshul Tandon
4
//  Copyright (c) 2015 Patricia Grubel
5
//  Copyright (c) 2017 Shoshana Jakobovits
6
//
7
//  SPDX-License-Identifier: BSL-1.0
8
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
9
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10

11
#include <hpx/config.hpp>
12
#include <hpx/assert.hpp>
13
#include <hpx/functional/bind_back.hpp>
14
#include <hpx/functional/bind_front.hpp>
15
#include <hpx/modules/errors.hpp>
16
#include <hpx/modules/threadmanager.hpp>
17
#include <hpx/performance_counters/counter_creators.hpp>
18
#include <hpx/performance_counters/counters.hpp>
19
#include <hpx/performance_counters/manage_counter_type.hpp>
20
#include <hpx/performance_counters/threadmanager_counter_types.hpp>
21
#include <hpx/runtime_local/thread_pool_helpers.hpp>
22
#include <hpx/schedulers/maintain_queue_wait_times.hpp>
23

24
#include <cstddef>
25
#include <cstdint>
26
#include <utility>
27

28
///////////////////////////////////////////////////////////////////////////////
29
namespace hpx::performance_counters::detail {
30

31
    using threadmanager_counter_func = std::int64_t (threads::threadmanager::*)(
32
        bool reset);
33
    using threadpool_counter_func = std::int64_t (threads::thread_pool_base::*)(
34
        std::size_t num_thread, bool reset);
35

36
    naming::gid_type locality_pool_thread_counter_creator(
37
        threads::threadmanager* tm, threadmanager_counter_func total_func,
38
        threadpool_counter_func pool_func, counter_info const& info,
39
        error_code& ec);
40

41
#ifdef HPX_HAVE_THREAD_QUEUE_WAITTIME
42
    naming::gid_type queue_wait_time_counter_creator(threads::threadmanager* tm,
43
        threadmanager_counter_func total_func,
44
        threadpool_counter_func pool_func, counter_info const& info,
45
        error_code& ec)
46
    {
47
        naming::gid_type gid = locality_pool_thread_counter_creator(
48
            tm, total_func, pool_func, info, ec);
49

50
        if (!ec)
51
        {
52
            threads::policies::set_maintain_queue_wait_times_enabled(true);
53
        }
54
        return gid;
55
    }
56
#endif
57

58
    naming::gid_type locality_pool_thread_counter_creator(
48✔
59
        threads::threadmanager* tm, threadmanager_counter_func total_func,
60
        threadpool_counter_func pool_func, counter_info const& info,
61
        error_code& ec)
62
    {
63
        // verify the validity of the counter instance name
64
        counter_path_elements paths;
48✔
65
        get_counter_path_elements(info.fullname_, paths, ec);
48✔
66
        if (ec)
48✔
67
        {
68
            return naming::invalid_gid;
×
69
        }
70

71
        if (paths.parentinstance_is_basename_)
48✔
72
        {
73
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
74
                "queue_length_counter_creator",
75
                "invalid counter instance parent name: {}",
76
                paths.parentinstancename_);
77
            return naming::invalid_gid;
×
78
        }
79

80
        threads::thread_pool_base& pool = tm->default_pool();
48✔
81
        if (paths.instancename_ == "total" && paths.instanceindex_ == -1)
48✔
82
        {
83
            // overall counter
84
            using detail::create_raw_counter;
85
            hpx::function<std::int64_t(bool)> f =
86
                hpx::bind_front(total_func, tm);
10✔
87
            return create_raw_counter(info, HPX_MOVE(f), ec);
10✔
88
        }
10✔
89
        else if (paths.instancename_ == "pool")
38✔
90
        {
91
            if (paths.instanceindex_ >= 0 &&
48✔
92
                std::size_t(paths.instanceindex_) <
24✔
93
                    hpx::resource::get_num_thread_pools())
24✔
94
            {
95
                // specific for given pool counter
96
                threads::thread_pool_base& pool_instance =
24✔
97
                    hpx::resource::get_thread_pool(paths.instanceindex_);
24✔
98

99
                using detail::create_raw_counter;
100
                hpx::function<std::int64_t(bool)> f =
101
                    hpx::bind_front(pool_func, &pool_instance,
48✔
102
                        static_cast<std::size_t>(paths.subinstanceindex_));
24✔
103
                return create_raw_counter(info, HPX_MOVE(f), ec);
24✔
104
            }
24✔
105
        }
×
106
        else if (paths.instancename_ == "worker-thread" &&
28✔
107
            paths.instanceindex_ >= 0 &&
14✔
108
            std::size_t(paths.instanceindex_) < pool.get_os_thread_count())
14✔
109
        {
110
            // specific counter from default
111
            using detail::create_raw_counter;
112
            hpx::function<std::int64_t(bool)> f = hpx::bind_front(pool_func,
14✔
113
                &pool, static_cast<std::size_t>(paths.instanceindex_));
14✔
114
            return create_raw_counter(info, HPX_MOVE(f), ec);
14✔
115
        }
14✔
116

117
        HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
118
            "locality_pool_thread_counter_creator",
119
            "invalid counter instance name: {}", paths.instancename_);
120
        return naming::invalid_gid;
×
121
    }
48✔
122

123
    // scheduler utilization counter creation function
124
    naming::gid_type scheduler_utilization_counter_creator(
1✔
125
        threads::threadmanager* tm, counter_info const& info, error_code& ec)
126
    {
127
        // verify the validity of the counter instance name
128
        counter_path_elements paths;
1✔
129
        get_counter_path_elements(info.fullname_, paths, ec);
1✔
130
        if (ec)
1✔
131
        {
132
            return naming::invalid_gid;
×
133
        }
134
        // /scheduler{locality#%d/total}/utilization/instantaneous
135
        // /scheduler{locality#%d/pool#%s/total}/utilization/instantaneous
136
        if (paths.parentinstance_is_basename_)
1✔
137
        {
138
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
139
                "scheduler_utilization_creator",
140
                "invalid counter instance parent name: {}",
141
                paths.parentinstancename_);
142
            return naming::invalid_gid;
×
143
        }
144

145
        using detail::create_raw_counter;
146

147
        threads::thread_pool_base& pool = tm->default_pool();
1✔
148
        if (paths.instancename_ == "total" && paths.instanceindex_ == -1)
1✔
149
        {
150
            // counter for default pool
151
            hpx::function<std::int64_t()> f = hpx::bind_back(
1✔
152
                &threads::thread_pool_base::get_scheduler_utilization, &pool);
1✔
153
            return create_raw_counter(info, HPX_MOVE(f), ec);
1✔
154
        }
1✔
155
        else if (paths.instancename_ == "pool")
×
156
        {
157
            if (paths.instanceindex_ < 0)
×
158
            {
159
                // counter for default pool
160
                hpx::function<std::int64_t()> f = hpx::bind_back(
×
161
                    &threads::thread_pool_base::get_scheduler_utilization,
×
162
                    &pool);
×
163
                return create_raw_counter(info, HPX_MOVE(f), ec);
×
164
            }
×
165
            else if (std::size_t(paths.instanceindex_) <
×
166
                hpx::resource::get_num_thread_pools())
×
167
            {
168
                // counter specific for given pool
169
                threads::thread_pool_base& pool_instance =
×
170
                    hpx::resource::get_thread_pool(paths.instanceindex_);
×
171

172
                hpx::function<std::int64_t()> f = hpx::bind_back(
×
173
                    &threads::thread_pool_base::get_scheduler_utilization,
×
174
                    &pool_instance);
×
175
                return create_raw_counter(info, HPX_MOVE(f), ec);
×
176
            }
×
177
        }
×
178

179
        HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
180
            "scheduler_utilization_creator",
181
            "invalid counter instance name: {}", paths.instancename_);
182
        return naming::invalid_gid;
×
183
    }
1✔
184

185
    ///////////////////////////////////////////////////////////////////////
186
    // locality/pool/worker-thread counter creation function with no total
187
    // /threads{locality#%d/worker-thread#%d}/idle-loop-count/instantaneous
188
    // /threads{locality#%d/pool#%s/worker-thread#%d}/idle-loop-count/instantaneous
189
    naming::gid_type locality_pool_thread_no_total_counter_creator(
2✔
190
        threads::threadmanager* tm, threadpool_counter_func pool_func,
191
        counter_info const& info, error_code& ec)
192
    {
193
        // verify the validity of the counter instance name
194
        counter_path_elements paths;
2✔
195
        get_counter_path_elements(info.fullname_, paths, ec);
2✔
196
        if (ec)
2✔
197
        {
198
            return naming::invalid_gid;
×
199
        }
200
        if (paths.parentinstance_is_basename_)
2✔
201
        {
202
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
203
                "locality_pool_thread_no_total_counter_creator",
204
                "invalid counter instance parent name: {}",
205
                paths.parentinstancename_);
206
            return naming::invalid_gid;
×
207
        }
208

209
        threads::thread_pool_base& pool = tm->default_pool();
2✔
210
        if (paths.instancename_ == "total" && paths.instanceindex_ == -1)
2✔
211
        {
212
            // overall counter, not supported
213
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
214
                "locality_pool_thread_no_total_counter_creator",
215
                "invalid counter instance name: {} 'total' is not supported",
216
                paths.instancename_);
217
        }
×
218
        else if (paths.instancename_ == "pool")
2✔
219
        {
220
            if (paths.instanceindex_ >= 0 &&
4✔
221
                std::size_t(paths.instanceindex_) <
2✔
222
                    hpx::resource::get_num_thread_pools())
2✔
223
            {
224
                // specific for given pool counter
225
                threads::thread_pool_base& pool_instance =
2✔
226
                    hpx::resource::get_thread_pool(paths.instanceindex_);
2✔
227

228
                using detail::create_raw_counter;
229
                hpx::function<std::int64_t(bool)> f =
230
                    hpx::bind_front(pool_func, &pool_instance,
4✔
231
                        static_cast<std::size_t>(paths.subinstanceindex_));
2✔
232
                return create_raw_counter(info, HPX_MOVE(f), ec);
2✔
233
            }
2✔
234
        }
×
235
        else if (paths.instancename_ == "worker-thread" &&
×
236
            paths.instanceindex_ >= 0 &&
×
237
            std::size_t(paths.instanceindex_) < pool.get_os_thread_count())
×
238
        {
239
            // specific counter
240
            using detail::create_raw_counter;
241
            hpx::function<std::int64_t(bool)> f = hpx::bind_front(pool_func,
×
242
                &pool, static_cast<std::size_t>(paths.instanceindex_));
×
243
            return create_raw_counter(info, HPX_MOVE(f), ec);
×
244
        }
×
245

246
        HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
247
            "locality_pool_thread_no_total_counter_creator",
248
            "invalid counter instance name: {}", paths.instancename_);
249
        return naming::invalid_gid;
×
250
    }
2✔
251

252
    ///////////////////////////////////////////////////////////////////////////
253
    naming::gid_type counter_creator(counter_info const& info,
×
254
        counter_path_elements const& paths,
255
        hpx::function<std::int64_t(bool)> const& total_creator,
256
        hpx::function<std::int64_t(bool)> const& individual_creator,
257
        char const* individual_name, std::size_t individual_count,
258
        error_code& ec)
259
    {
260
        if (paths.parentinstance_is_basename_)
×
261
        {
262
            HPX_THROWS_IF(ec, hpx::error::bad_parameter, "counter_creator",
×
263
                "invalid counter instance parent name: {}",
264
                paths.parentinstancename_);
265
            return naming::invalid_gid;
×
266
        }
267

268
        if (!total_creator.empty() && paths.instancename_ == "total" &&
×
269
            paths.instanceindex_ == -1)
×
270
        {
271
            // overall counter
272
            using detail::create_raw_counter;
273
            return create_raw_counter(info, total_creator, ec);
×
274
        }
275
        else if (!individual_creator.empty() &&
×
276
            paths.instancename_ == individual_name &&
×
277
            paths.instanceindex_ >= 0 &&
×
278
            std::size_t(paths.instanceindex_) < individual_count)
×
279
        {
280
            // specific counter
281
            using detail::create_raw_counter;
282
            return create_raw_counter(info, individual_creator, ec);
×
283
        }
284

285
        HPX_THROWS_IF(ec, hpx::error::bad_parameter, "counter_creator",
×
286
            "invalid counter instance name: {}", paths.instancename_);
287
        return naming::invalid_gid;
×
288
    }
×
289

290
    ///////////////////////////////////////////////////////////////////////
291
    // thread counts counter creation function
292
#if defined(HPX_HAVE_COROUTINE_COUNTERS)
293
    naming::gid_type thread_counts_counter_creator(
294
        counter_info const& info, error_code& ec)
295
    {
296
        // verify the validity of the counter instance name
297
        counter_path_elements paths;
298
        get_counter_path_elements(info.fullname_, paths, ec);
299
        if (ec)
300
        {
301
            return naming::invalid_gid;
302
        }
303

304
        struct creator_data
305
        {
306
            char const* const countername;
307
            hpx::function<std::int64_t(bool)> total_func;
308
            hpx::function<std::int64_t(bool)> individual_func;
309
            char const* const individual_name;
310
            std::size_t individual_count;
311
        };
312

313
        creator_data data[] = {
314
            // /threads{locality#%d/total}/count/stack-recycles
315
            {"count/stack-recycles",
316
                hpx::bind_front(&threads::coroutine_type::impl_type::
317
                                    get_stack_recycle_count),
318
                hpx::function<std::uint64_t(bool)>(), "", 0},
319
#if !defined(HPX_WINDOWS) && !defined(HPX_HAVE_GENERIC_CONTEXT_COROUTINES)
320
            // /threads{locality#%d/total}/count/stack-unbinds
321
            {"count/stack-unbinds",
322
                hpx::bind_front(&threads::coroutine_type::impl_type::
323
                                    get_stack_unbind_count),
324
                hpx::function<std::uint64_t(bool)>(), "", 0},
325
#endif
326
        };
327
        std::size_t const data_size = sizeof(data) / sizeof(data[0]);
328

329
        for (creator_data const* d = data; d < &d[data_size]; ++d)
330
        {
331
            if (paths.countername_ == d->countername)
332
            {
333
                return counter_creator(info, paths, d->total_func,
334
                    d->individual_func, d->individual_name, d->individual_count,
335
                    ec);
336
            }
337
        }
338

339
        HPX_THROWS_IF(ec, hpx::error::bad_parameter,
340
            "thread_counts_counter_creator",
341
            "invalid counter instance name: {}", paths.instancename_);
342
        return naming::invalid_gid;
343
    }
344
#endif
345
}    // namespace hpx::performance_counters::detail
346

347
namespace hpx::performance_counters {
348

349
    ///////////////////////////////////////////////////////////////////////////
350
    void register_threadmanager_counter_types(threads::threadmanager& tm)
594✔
351
    {
352
#if defined(HPX_HAVE_COROUTINE_COUNTERS)
353
        create_counter_func counts_creator(
354
            hpx::bind_front(&detail::thread_counts_counter_creator));
355
#endif
356

357
        generic_counter_type_data counter_types[] = {
8,316✔
358
            // length of thread queue(s)
359
            {"/threadqueue/length", counter_type::raw,
1,188✔
360
                "returns the current queue length for the referenced queue",
594✔
361
                HPX_PERFORMANCE_COUNTER_V1,
362
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
1,188✔
363
                    &tm, &threads::threadmanager::get_queue_length,
594✔
364
                    &threads::thread_pool_base::get_queue_length),
594✔
365
                &locality_pool_thread_counter_discoverer, ""},
594✔
366
#ifdef HPX_HAVE_THREAD_QUEUE_WAITTIME
367
            // average thread wait time for queue(s)
368
            {"/threads/wait-time/pending", counter_type::average_timer,
369
                "returns the average wait time of pending threads for the "
370
                "referenced queue",
371
                HPX_PERFORMANCE_COUNTER_V1,
372
                hpx::bind_front(&detail::queue_wait_time_counter_creator, &tm,
373
                    &threads::threadmanager::get_average_thread_wait_time,
374
                    &threads::thread_pool_base::get_average_thread_wait_time),
375
                &locality_pool_thread_counter_discoverer, "ns"},
376
            // average task wait time for queue(s)
377
            {"/threads/wait-time/staged", counter_type::average_timer,
378
                "returns the average wait time of staged threads (task "
379
                "descriptions) for the referenced queue",
380
                HPX_PERFORMANCE_COUNTER_V1,
381
                hpx::bind_front(&detail::queue_wait_time_counter_creator, &tm,
382
                    &threads::threadmanager::get_average_task_wait_time,
383
                    &threads::thread_pool_base::get_average_task_wait_time),
384
                &locality_pool_thread_counter_discoverer, "ns"},
385
#endif
386
#ifdef HPX_HAVE_THREAD_IDLE_RATES
387
            // idle rate
388
            {"/threads/idle-rate", counter_type::average_count,
389
                "returns the idle rate for the referenced object",
390
                HPX_PERFORMANCE_COUNTER_V1,
391
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
392
                    &tm, &threads::threadmanager::avg_idle_rate,
393
                    &threads::thread_pool_base::avg_idle_rate),
394
                &locality_pool_thread_counter_discoverer, "0.01%"},
395
#ifdef HPX_HAVE_THREAD_CREATION_AND_CLEANUP_RATES
396
            {"/threads/creation-idle-rate", counter_type::average_count,
397
                "returns the % of idle-rate spent creating HPX-threads for the "
398
                "referenced object",
399
                HPX_PERFORMANCE_COUNTER_V1,
400
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
401
                    &tm, &threads::threadmanager::avg_creation_idle_rate,
402
                    &threads::thread_pool_base::avg_creation_idle_rate),
403
                &locality_pool_thread_counter_discoverer, "0.01%"},
404
            {"/threads/cleanup-idle-rate", counter_type::average_count,
405
                "returns the % of time spent cleaning up terminated "
406
                "HPX-threads for the referenced object",
407
                HPX_PERFORMANCE_COUNTER_V1,
408
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
409
                    &tm, &threads::threadmanager::avg_cleanup_idle_rate,
410
                    &threads::thread_pool_base::avg_cleanup_idle_rate),
411
                &locality_pool_thread_counter_discoverer, "0.01%"},
412
#endif
413
#endif
414
#ifdef HPX_HAVE_THREAD_CUMULATIVE_COUNTS
415
            // thread counts
416
            {"/threads/count/cumulative",
1,188✔
417
                counter_type::monotonically_increasing,
418
                "returns the overall number of executed (retired) HPX-threads "
594✔
419
                "for the referenced locality",
420
                HPX_PERFORMANCE_COUNTER_V1,
421
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
1,188✔
422
                    &tm, &threads::threadmanager::get_executed_threads,
594✔
423
                    &threads::thread_pool_base::get_executed_threads),
594✔
424
                &locality_pool_thread_counter_discoverer, ""},
594✔
425
            {"/threads/count/cumulative-phases",
1,188✔
426
                counter_type::monotonically_increasing,
427
                "returns the overall number of HPX-thread phases executed for "
594✔
428
                "the referenced locality",
429
                HPX_PERFORMANCE_COUNTER_V1,
430
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
1,188✔
431
                    &tm, &threads::threadmanager::get_executed_thread_phases,
594✔
432
                    &threads::thread_pool_base::get_executed_thread_phases),
594✔
433
                &locality_pool_thread_counter_discoverer, ""},
594✔
434
#ifdef HPX_HAVE_THREAD_IDLE_RATES
435
            {"/threads/time/average", counter_type::average_timer,
436
                "returns the average time spent executing one HPX-thread",
437
                HPX_PERFORMANCE_COUNTER_V1,
438
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
439
                    &tm, &threads::threadmanager::get_thread_duration,
440
                    &threads::thread_pool_base::get_thread_duration),
441
                &locality_pool_thread_counter_discoverer, "ns"},
442
            {"/threads/time/average-phase", counter_type::average_timer,
443
                "returns the average time spent executing one HPX-thread phase",
444
                HPX_PERFORMANCE_COUNTER_V1,
445
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
446
                    &tm, &threads::threadmanager::get_thread_phase_duration,
447
                    &threads::thread_pool_base::get_thread_phase_duration),
448
                &locality_pool_thread_counter_discoverer, "ns"},
449
            {"/threads/time/average-overhead", counter_type::average_timer,
450
                "returns average overhead time executing one HPX-thread",
451
                HPX_PERFORMANCE_COUNTER_V1,
452
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
453
                    &tm, &threads::threadmanager::get_thread_overhead,
454
                    &threads::thread_pool_base::get_thread_overhead),
455
                &locality_pool_thread_counter_discoverer, "ns"},
456
            {"/threads/time/average-phase-overhead",
457
                counter_type::average_timer,
458
                "returns average overhead time executing one HPX-thread phase",
459
                HPX_PERFORMANCE_COUNTER_V1,
460
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
461
                    &tm, &threads::threadmanager::get_thread_phase_overhead,
462
                    &threads::thread_pool_base::get_thread_phase_overhead),
463
                &locality_pool_thread_counter_discoverer, "ns"},
464
            {"/threads/time/cumulative", counter_type::elapsed_time,
465
                "returns the cumulative time spent executing HPX-threads",
466
                HPX_PERFORMANCE_COUNTER_V1,
467
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
468
                    &tm,
469
                    &threads::threadmanager::get_cumulative_thread_duration,
470
                    &threads::thread_pool_base::get_cumulative_thread_duration),
471
                &locality_pool_thread_counter_discoverer, "ns"},
472
            {"/threads/time/cumulative-overhead", counter_type::elapsed_time,
473
                "returns the cumulative overhead time incurred by executing "
474
                "HPX threads",
475
                HPX_PERFORMANCE_COUNTER_V1,
476
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
477
                    &tm,
478
                    &threads::threadmanager::get_cumulative_thread_overhead,
479
                    &threads::thread_pool_base::get_cumulative_thread_overhead),
480
                &locality_pool_thread_counter_discoverer, "ns"},
481
#endif
482
#endif
483

484
#if defined(HPX_HAVE_BACKGROUND_THREAD_COUNTERS) &&                            \
485
    defined(HPX_HAVE_THREAD_IDLE_RATES)
486
            {"/threads/time/background-work-duration",
487
                counter_type::elapsed_time,
488
                "returns the overall time spent running background work",
489
                HPX_PERFORMANCE_COUNTER_V1,
490
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
491
                    &tm, &threads::threadmanager::get_background_work_duration,
492
                    &threads::thread_pool_base::get_background_work_duration),
493
                &locality_pool_thread_counter_discoverer, "ns"},
494
            {"/threads/background-overhead", counter_type::aggregating,
495
                "returns the overall background overhead",
496
                HPX_PERFORMANCE_COUNTER_V1,
497
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
498
                    &tm, &threads::threadmanager::get_background_overhead,
499
                    &threads::thread_pool_base::get_background_overhead),
500
                &locality_pool_thread_counter_discoverer, "0.1%"},
501
            {"/threads/time/background-send-duration",
502
                counter_type::elapsed_time,
503
                "returns the overall time spent running background work "
504
                "related to sending parcels",
505
                HPX_PERFORMANCE_COUNTER_V1,
506
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
507
                    &tm, &threads::threadmanager::get_background_send_duration,
508
                    &threads::thread_pool_base::get_background_send_duration),
509
                &locality_pool_thread_counter_discoverer, "ns"},
510
            {"/threads/background-send-overhead", counter_type::aggregating,
511
                "returns the overall background overhead "
512
                "related to sending parcels",
513
                HPX_PERFORMANCE_COUNTER_V1,
514
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
515
                    &tm, &threads::threadmanager::get_background_send_overhead,
516
                    &threads::thread_pool_base::get_background_send_overhead),
517
                &locality_pool_thread_counter_discoverer, "0.1%"},
518
            {"/threads/time/background-receive-duration",
519
                counter_type::elapsed_time,
520
                "returns the overall time spent running background work "
521
                "related to receiving parcels",
522
                HPX_PERFORMANCE_COUNTER_V1,
523
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
524
                    &tm,
525
                    &threads::threadmanager::get_background_receive_duration,
526
                    &threads::thread_pool_base::
527
                        get_background_receive_duration),
528
                &locality_pool_thread_counter_discoverer, "ns"},
529
            {"/threads/background-receive-overhead", counter_type::aggregating,
530
                "returns the overall background overhead "
531
                "related to receiving parcels",
532
                HPX_PERFORMANCE_COUNTER_V1,
533
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
534
                    &tm,
535
                    &threads::threadmanager::get_background_receive_overhead,
536
                    &threads::thread_pool_base::
537
                        get_background_receive_overhead),
538
                &locality_pool_thread_counter_discoverer, "0.1%"},
539
#endif    // HPX_HAVE_BACKGROUND_THREAD_COUNTERS
540

541
            {"/threads/time/overall", counter_type::elapsed_time,
1,188✔
542
                "returns the overall time spent running the scheduler on a "
594✔
543
                "core",
544
                HPX_PERFORMANCE_COUNTER_V1,
545
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
1,188✔
546
                    &tm, &threads::threadmanager::get_cumulative_duration,
594✔
547
                    &threads::thread_pool_base::get_cumulative_duration),
594✔
548
                &locality_pool_thread_counter_discoverer, "ns"},
594✔
549
            {"/threads/count/instantaneous/all", counter_type::raw,
1,188✔
550
                "returns the overall current number of HPX-threads "
594✔
551
                "instantiated at the referenced locality",
552
                HPX_PERFORMANCE_COUNTER_V1,
553
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
1,188✔
554
                    &tm, &threads::threadmanager::get_thread_count_unknown,
594✔
555
                    &threads::thread_pool_base::get_thread_count_unknown),
594✔
556
                &locality_pool_thread_counter_discoverer, ""},
594✔
557
            {"/threads/count/instantaneous/active", counter_type::raw,
1,188✔
558
                "returns the current number of active HPX-threads "
594✔
559
                "at the referenced locality",
560
                HPX_PERFORMANCE_COUNTER_V1,
561
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
1,188✔
562
                    &tm, &threads::threadmanager::get_thread_count_active,
594✔
563
                    &threads::thread_pool_base::get_thread_count_active),
594✔
564
                &locality_pool_thread_counter_discoverer, ""},
594✔
565
            {"/threads/count/instantaneous/pending", counter_type::raw,
1,188✔
566
                "returns the current number of pending HPX-threads "
594✔
567
                "at the referenced locality",
568
                HPX_PERFORMANCE_COUNTER_V1,
569
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
1,188✔
570
                    &tm, &threads::threadmanager::get_thread_count_pending,
594✔
571
                    &threads::thread_pool_base::get_thread_count_pending),
594✔
572
                &locality_pool_thread_counter_discoverer, ""},
594✔
573
            {"/threads/count/instantaneous/suspended", counter_type::raw,
1,188✔
574
                "returns the current number of suspended HPX-threads "
594✔
575
                "at the referenced locality",
576
                HPX_PERFORMANCE_COUNTER_V1,
577
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
1,188✔
578
                    &tm, &threads::threadmanager::get_thread_count_suspended,
594✔
579
                    &threads::thread_pool_base::get_thread_count_suspended),
594✔
580
                &locality_pool_thread_counter_discoverer, ""},
594✔
581
            {"/threads/count/instantaneous/terminated", counter_type::raw,
1,188✔
582
                "returns the current number of terminated HPX-threads "
594✔
583
                "at the referenced locality",
584
                HPX_PERFORMANCE_COUNTER_V1,
585
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
1,188✔
586
                    &tm, &threads::threadmanager::get_thread_count_terminated,
594✔
587
                    &threads::thread_pool_base::get_thread_count_terminated),
594✔
588
                &locality_pool_thread_counter_discoverer, ""},
594✔
589
            {"/threads/count/instantaneous/staged", counter_type::raw,
1,188✔
590
                "returns the current number of staged HPX-threads (task "
594✔
591
                "descriptions) "
592
                "at the referenced locality",
593
                HPX_PERFORMANCE_COUNTER_V1,
594
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
1,188✔
595
                    &tm, &threads::threadmanager::get_thread_count_staged,
594✔
596
                    &threads::thread_pool_base::get_thread_count_staged),
594✔
597
                &locality_pool_thread_counter_discoverer, ""},
594✔
598
#if defined(HPX_HAVE_COROUTINE_COUNTERS)
599
            {"/threads/count/stack-recycles",
600
                counter_type::monotonically_increasing,
601
                "returns the total number of HPX-thread recycling operations "
602
                "performed for the referenced locality",
603
                HPX_PERFORMANCE_COUNTER_V1, counts_creator,
604
                &locality_counter_discoverer, ""},
605
#if !defined(HPX_WINDOWS) && !defined(HPX_HAVE_GENERIC_CONTEXT_COROUTINES)
606
            {"/threads/count/stack-unbinds",
607
                counter_type::monotonically_increasing,
608
                "returns the total number of HPX-thread unbind (madvise) "
609
                "operations performed for the referenced locality",
610
                HPX_PERFORMANCE_COUNTER_V1, counts_creator,
611
                &locality_counter_discoverer, ""},
612
#endif
613
#endif
614
#ifdef HPX_HAVE_THREAD_STEALING_COUNTS
615
            {"/threads/count/pending-misses",
616
                counter_type::monotonically_increasing,
617
                "returns the number of times that the referenced worker-thread "
618
                "on the referenced locality failed to find pending HPX-threads "
619
                "in its associated queue",
620
                HPX_PERFORMANCE_COUNTER_V1,
621
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
622
                    &tm, &threads::threadmanager::get_num_pending_misses,
623
                    &threads::thread_pool_base::get_num_pending_misses),
624
                &locality_pool_thread_counter_discoverer, ""},
625
            {"/threads/count/pending-accesses",
626
                counter_type::monotonically_increasing,
627
                "returns the number of times that the referenced worker-thread "
628
                "on the referenced locality looked for pending HPX-threads "
629
                "in its associated queue",
630
                HPX_PERFORMANCE_COUNTER_V1,
631
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
632
                    &tm, &threads::threadmanager::get_num_pending_accesses,
633
                    &threads::thread_pool_base::get_num_pending_accesses),
634
                &locality_pool_thread_counter_discoverer, ""},
635
            {"/threads/count/stolen-from-pending",
636
                counter_type::monotonically_increasing,
637
                "returns the overall number of pending HPX-threads stolen by "
638
                "neighboring"
639
                "schedulers from &tm scheduler for the referenced locality",
640
                HPX_PERFORMANCE_COUNTER_V1,
641
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
642
                    &tm, &threads::threadmanager::get_num_stolen_from_pending,
643
                    &threads::thread_pool_base::get_num_stolen_from_pending),
644
                &locality_pool_thread_counter_discoverer, ""},
645
            {"/threads/count/stolen-from-staged",
646
                counter_type::monotonically_increasing,
647
                "returns the overall number of task descriptions stolen by "
648
                "neighboring"
649
                "schedulers from tm scheduler for the referenced locality",
650
                HPX_PERFORMANCE_COUNTER_V1,
651
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
652
                    &tm, &threads::threadmanager::get_num_stolen_from_staged,
653
                    &threads::thread_pool_base::get_num_stolen_from_staged),
654
                &locality_pool_thread_counter_discoverer, ""},
655
            {"/threads/count/stolen-to-pending",
656
                counter_type::monotonically_increasing,
657
                "returns the overall number of pending HPX-threads stolen from "
658
                "neighboring"
659
                "schedulers for the referenced locality",
660
                HPX_PERFORMANCE_COUNTER_V1,
661
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
662
                    &tm, &threads::threadmanager::get_num_stolen_to_pending,
663
                    &threads::thread_pool_base::get_num_stolen_to_pending),
664
                &locality_pool_thread_counter_discoverer, ""},
665
            {"/threads/count/stolen-to-staged",
666
                counter_type::monotonically_increasing,
667
                "returns the overall number of task descriptions stolen from "
668
                "neighboring"
669
                "schedulers for the referenced locality",
670
                HPX_PERFORMANCE_COUNTER_V1,
671
                hpx::bind_front(&detail::locality_pool_thread_counter_creator,
672
                    &tm, &threads::threadmanager::get_num_stolen_to_staged,
673
                    &threads::thread_pool_base::get_num_stolen_to_staged),
674
                &locality_pool_thread_counter_discoverer, ""},
675
#endif
676
            // scheduler utilization
677
            {"/scheduler/utilization/instantaneous", counter_type::raw,
1,188✔
678
                "returns the current scheduler utilization",
594✔
679
                HPX_PERFORMANCE_COUNTER_V1,
680
                hpx::bind_front(
594✔
681
                    &detail::scheduler_utilization_counter_creator, &tm),
594✔
682
                &locality_pool_counter_discoverer, "%"},
594✔
683
            // idle-loop count
684
            {"/threads/idle-loop-count/instantaneous", counter_type::raw,
1,188✔
685
                "returns the current value of the scheduler idle-loop count",
594✔
686
                HPX_PERFORMANCE_COUNTER_V1,
687
                hpx::bind_front(
594✔
688
                    &detail::locality_pool_thread_no_total_counter_creator, &tm,
594✔
689
                    &threads::thread_pool_base::get_idle_loop_count),
594✔
690
                &locality_pool_thread_no_total_counter_discoverer, ""},
594✔
691
            // busy-loop count
692
            {"/threads/busy-loop-count/instantaneous", counter_type::raw,
1,188✔
693
                "returns the current value of the scheduler busy-loop count",
594✔
694
                HPX_PERFORMANCE_COUNTER_V1,
695
                hpx::bind_front(
594✔
696
                    &detail::locality_pool_thread_no_total_counter_creator, &tm,
594✔
697
                    &threads::thread_pool_base::get_busy_loop_count),
594✔
698
                &locality_pool_thread_no_total_counter_discoverer, ""}
594✔
699
        };
700

701
        install_counter_types(
594✔
702
            counter_types, sizeof(counter_types) / sizeof(counter_types[0]));
594✔
703
    }
7,722✔
704
}    // namespace hpx::performance_counters
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc