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

STEllAR-GROUP / hpx / #882

31 Aug 2023 07:44PM UTC coverage: 41.798% (-44.7%) from 86.546%
#882

push

19442 of 46514 relevant lines covered (41.8%)

126375.38 hits per line

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

85.0
/libs/full/performance_counters/src/parcelhandler_counter_types.cpp
1
//  Copyright (c) 2021-2024 Hartmut Kaiser
2
//
3
//  SPDX-License-Identifier: BSL-1.0
4
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
5
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6

7
#include <hpx/config.hpp>
8

9
#if defined(HPX_HAVE_NETWORKING)
10
#include <hpx/modules/format.hpp>
11
#include <hpx/modules/functional.hpp>
12
#include <hpx/parcelset/parcelhandler.hpp>
13
#include <hpx/performance_counters/counter_creators.hpp>
14
#include <hpx/performance_counters/counters.hpp>
15
#include <hpx/performance_counters/manage_counter_type.hpp>
16
#include <hpx/performance_counters/parcelhandler_counter_types.hpp>
17

18
#include <cstdint>
19
#include <string>
20

21
namespace hpx::performance_counters {
22

23
#if defined(HPX_HAVE_PARCELPORT_COUNTERS)
24
    ///////////////////////////////////////////////////////////////////////////
×
25
    static void register_parcelhandler_counter_types(
26
        parcelset::parcelhandler& ph, std::string const& pp_type)
27
    {
28
        using placeholders::_1;
29
        using placeholders::_2;
30

31
        using parcelset::parcelhandler;
32
#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS)
33
        hpx::function<std::int64_t(std::string const&, bool)> num_parcel_sends(
34
            hpx::bind_front(
35
                &parcelhandler::get_action_parcel_send_count, &ph, pp_type));
36
        hpx::function<std::int64_t(std::string const&, bool)>
37
            num_parcel_receives(hpx::bind_front(
38
                &parcelhandler::get_action_parcel_receive_count, &ph, pp_type));
39
#else
40
        hpx::function<std::int64_t(bool)> num_parcel_sends(hpx::bind_front(
41
            &parcelhandler::get_parcel_send_count, &ph, pp_type));
42
        hpx::function<std::int64_t(bool)> num_parcel_receives(hpx::bind_front(
43
            &parcelhandler::get_parcel_receive_count, &ph, pp_type));
44
#endif
45

46
        hpx::function<std::int64_t(bool)> num_message_sends(hpx::bind_front(
47
            &parcelhandler::get_message_send_count, &ph, pp_type));
48
        hpx::function<std::int64_t(bool)> num_message_receives(hpx::bind_front(
49
            &parcelhandler::get_message_receive_count, &ph, pp_type));
50

51
        hpx::function<std::int64_t(bool)> sending_time(
52
            hpx::bind_front(&parcelhandler::get_sending_time, &ph, pp_type));
53
        hpx::function<std::int64_t(bool)> receiving_time(
54
            hpx::bind_front(&parcelhandler::get_receiving_time, &ph, pp_type));
55

56
#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS)
57
        hpx::function<std::int64_t(std::string const&, bool)>
58
            sending_serialization_time(hpx::bind_front(
59
                &parcelhandler::get_action_sending_serialization_time, &ph,
60
                pp_type));
61
        hpx::function<std::int64_t(std::string const&, bool)>
62
            receiving_serialization_time(hpx::bind_front(
63
                &parcelhandler::get_action_receiving_serialization_time, &ph,
64
                pp_type));
65
#else
66
        hpx::function<std::int64_t(bool)> sending_serialization_time(
67
            hpx::bind_front(
68
                &parcelhandler::get_sending_serialization_time, &ph, pp_type));
69
        hpx::function<std::int64_t(bool)> receiving_serialization_time(
70
            hpx::bind_front(&parcelhandler::get_receiving_serialization_time,
71
                &ph, pp_type));
72
#endif
73

74
#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS)
75
        hpx::function<std::int64_t(std::string const&, bool)> data_sent(
76
            hpx::bind_front(
77
                &parcelhandler::get_action_data_sent, &ph, pp_type));
78
        hpx::function<std::int64_t(std::string const&, bool)> data_received(
79
            hpx::bind_front(
80
                &parcelhandler::get_action_data_received, &ph, pp_type));
81
#else
82
        hpx::function<std::int64_t(bool)> data_sent(
83
            hpx::bind_front(&parcelhandler::get_data_sent, &ph, pp_type));
84
        hpx::function<std::int64_t(bool)> data_received(
85
            hpx::bind_front(&parcelhandler::get_data_received, &ph, pp_type));
86
#endif
87

88
        hpx::function<std::int64_t(bool)> data_raw_sent(
89
            hpx::bind_front(&parcelhandler::get_raw_data_sent, &ph, pp_type));
90
        hpx::function<std::int64_t(bool)> data_raw_received(hpx::bind_front(
91
            &parcelhandler::get_raw_data_received, &ph, pp_type));
92

93
        hpx::function<std::int64_t(bool)> buffer_allocate_time_sent(
94
            hpx::bind_front(
95
                &parcelhandler::get_buffer_allocate_time_sent, &ph, pp_type));
96
        hpx::function<std::int64_t(bool)> buffer_allocate_time_received(
97
            hpx::bind_front(&parcelhandler::get_buffer_allocate_time_received,
98
                &ph, pp_type));
99

100
        hpx::function<std::int64_t(bool)> num_zchunks_send(hpx::bind_front(
101
            &parcelhandler::get_zchunks_send_count, &ph, pp_type));
102
        hpx::function<std::int64_t(bool)> num_zchunks_recv(hpx::bind_front(
103
            &parcelhandler::get_zchunks_recv_count, &ph, pp_type));
104

105
        hpx::function<std::int64_t(bool)> num_zchunks_send_per_msg_max(
106
            hpx::bind_front(&parcelhandler::get_zchunks_send_per_msg_count_max,
107
                &ph, pp_type));
108
        hpx::function<std::int64_t(bool)> num_zchunks_recv_per_msg_max(
109
            hpx::bind_front(&parcelhandler::get_zchunks_recv_per_msg_count_max,
110
                &ph, pp_type));
111

112
        hpx::function<std::int64_t(bool)> size_zchunks_send(hpx::bind_front(
113
            &parcelhandler::get_zchunks_send_size, &ph, pp_type));
114
        hpx::function<std::int64_t(bool)> size_zchunks_recv(hpx::bind_front(
115
            &parcelhandler::get_zchunks_recv_size, &ph, pp_type));
116

117
        hpx::function<std::int64_t(bool)> size_zchunks_send_per_msg_max(
118
            hpx::bind_front(
119
                &parcelhandler::get_zchunks_send_size_max, &ph, pp_type));
120
        hpx::function<std::int64_t(bool)> size_zchunks_recv_per_msg_max(
121
            hpx::bind_front(
122
                &parcelhandler::get_zchunks_recv_size_max, &ph, pp_type));
123

124
        performance_counters::generic_counter_type_data const counter_types[] =
125
            {
126
                {hpx::util::format("/parcels/count/{}/sent", pp_type),
127
                    performance_counters::counter_type::
128
                        monotonically_increasing,
129
                    hpx::util::format(
130
                        "returns the number of parcels sent using the {} "
131
                        "connection type for the referenced locality",
132
                        pp_type),
133
                    HPX_PERFORMANCE_COUNTER_V1,
134
#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS)
135
                    hpx::bind(
136
                        &performance_counters::per_action_data_counter_creator,
137
                        _1, HPX_MOVE(num_parcel_sends), _2),
138
                    &performance_counters::per_action_data_counter_discoverer,
139
#else
140
                    hpx::bind(
141
                        &performance_counters::locality_raw_counter_creator, _1,
142
                        HPX_MOVE(num_parcel_sends), _2),
143
                    &performance_counters::locality_counter_discoverer,
144
#endif
145
                    ""},
146
                {hpx::util::format("/parcels/count/{}/received", pp_type),
147
                    performance_counters::counter_type::
148
                        monotonically_increasing,
149
                    hpx::util::format(
150
                        "returns the number of parcels received using the {} "
151
                        "connection type for the referenced locality",
152
                        pp_type),
153
                    HPX_PERFORMANCE_COUNTER_V1,
154
#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS)
155
                    hpx::bind(
156
                        &performance_counters::per_action_data_counter_creator,
157
                        _1, HPX_MOVE(num_parcel_receives), _2),
158
                    &performance_counters::per_action_data_counter_discoverer,
159
#else
160
                    hpx::bind(
161
                        &performance_counters::locality_raw_counter_creator, _1,
162
                        HPX_MOVE(num_parcel_receives), _2),
163
                    &performance_counters::locality_counter_discoverer,
164
#endif
165
                    ""},
166
                {hpx::util::format("/messages/count/{}/sent", pp_type),
167
                    performance_counters::counter_type::
168
                        monotonically_increasing,
169
                    hpx::util::format(
170
                        "returns the number of messages sent using the {} "
171
                        "connection type for the referenced locality",
172
                        pp_type),
173
                    HPX_PERFORMANCE_COUNTER_V1,
174
                    hpx::bind(
175
                        &performance_counters::locality_raw_counter_creator, _1,
176
                        HPX_MOVE(num_message_sends), _2),
177
                    &performance_counters::locality_counter_discoverer, ""},
178
                {hpx::util::format("/messages/count/{}/received", pp_type),
179
                    performance_counters::counter_type::
180
                        monotonically_increasing,
181
                    hpx::util::format(
182
                        "returns the number of messages received using the {} "
183
                        "connection type for the referenced locality",
184
                        pp_type),
185
                    HPX_PERFORMANCE_COUNTER_V1,
186
                    hpx::bind(
187
                        &performance_counters::locality_raw_counter_creator, _1,
188
                        HPX_MOVE(num_message_receives), _2),
189
                    &performance_counters::locality_counter_discoverer, ""},
190

191
                {hpx::util::format("/data/time/{}/sent", pp_type),
192
                    performance_counters::counter_type::elapsed_time,
193
                    hpx::util::format(
194
                        "returns the total time between the start of each "
195
                        "asynchronous write and the invocation of the write "
196
                        "callback using the {} connection type for the "
197
                        "referenced locality",
198
                        pp_type),
199
                    HPX_PERFORMANCE_COUNTER_V1,
200
                    hpx::bind(
201
                        &performance_counters::locality_raw_counter_creator, _1,
202
                        HPX_MOVE(sending_time), _2),
203
                    &performance_counters::locality_counter_discoverer, "ns"},
204
                {hpx::util::format("/data/time/{}/received", pp_type),
205
                    performance_counters::counter_type::elapsed_time,
206
                    hpx::util::format(
207
                        "returns the total time between the start of each "
208
                        "asynchronous read and the invocation of the read "
209
                        "callback using the {} connection type for the "
210
                        "referenced locality",
211
                        pp_type),
212
                    HPX_PERFORMANCE_COUNTER_V1,
213
                    hpx::bind(
214
                        &performance_counters::locality_raw_counter_creator, _1,
215
                        HPX_MOVE(receiving_time), _2),
216
                    &performance_counters::locality_counter_discoverer, "ns"},
217
                {hpx::util::format("/serialize/time/{}/sent", pp_type),
218
                    performance_counters::counter_type::elapsed_time,
219
                    hpx::util::format(
220
                        "returns the total time required to serialize all sent "
221
                        "parcels using the {} connection type for the "
222
                        "referenced locality",
223
                        pp_type),
224
                    HPX_PERFORMANCE_COUNTER_V1,
225
#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS)
226
                    hpx::bind(
227
                        &performance_counters::per_action_data_counter_creator,
228
                        _1, HPX_MOVE(sending_serialization_time), _2),
229
                    &performance_counters::per_action_data_counter_discoverer,
230
#else
231
                    hpx::bind(
232
                        &performance_counters::locality_raw_counter_creator, _1,
233
                        HPX_MOVE(sending_serialization_time), _2),
234
                    &performance_counters::locality_counter_discoverer,
235
#endif
236
                    "ns"},
237
                {hpx::util::format("/serialize/time/{}/received", pp_type),
238
                    performance_counters::counter_type::elapsed_time,
239
                    hpx::util::format(
240
                        "returns the total time required to de-serialize all "
241
                        "received parcels using the {} connection type for the "
242
                        "referenced locality",
243
                        pp_type),
244
                    HPX_PERFORMANCE_COUNTER_V1,
245
#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS)
246
                    hpx::bind(
247
                        &performance_counters::per_action_data_counter_creator,
248
                        _1, HPX_MOVE(receiving_serialization_time), _2),
249
                    &performance_counters::per_action_data_counter_discoverer,
250
#else
251
                    hpx::bind(
252
                        &performance_counters::locality_raw_counter_creator, _1,
253
                        HPX_MOVE(receiving_serialization_time), _2),
254
                    &performance_counters::locality_counter_discoverer,
255
#endif
256
                    "ns"},
257

258
                {hpx::util::format("/data/count/{}/sent", pp_type),
259
                    performance_counters::counter_type::
260
                        monotonically_increasing,
261
                    hpx::util::format(
262
                        "returns the amount of (uncompressed) parcel argument "
263
                        "data sent using the {} connection type by the "
264
                        "referenced locality",
265
                        pp_type),
266
                    HPX_PERFORMANCE_COUNTER_V1,
267
                    hpx::bind(
268
                        &performance_counters::locality_raw_counter_creator, _1,
269
                        HPX_MOVE(data_raw_sent), _2),
270
                    &performance_counters::locality_counter_discoverer,
271
                    "bytes"},
272
                {hpx::util::format("/data/count/{}/received", pp_type),
273
                    performance_counters::counter_type::
274
                        monotonically_increasing,
275
                    hpx::util::format(
276
                        "returns the amount of (uncompressed) parcel argument "
277
                        "data received using the {} connection type by the "
278
                        "referenced locality",
279
                        pp_type),
280
                    HPX_PERFORMANCE_COUNTER_V1,
281
                    hpx::bind(
282
                        &performance_counters::locality_raw_counter_creator, _1,
283
                        HPX_MOVE(data_raw_received), _2),
284
                    &performance_counters::locality_counter_discoverer,
285
                    "bytes"},
286
                {hpx::util::format("/serialize/count/{}/sent", pp_type),
287
                    performance_counters::counter_type::
288
                        monotonically_increasing,
289
                    hpx::util::format(
290
                        "returns the amount of parcel data (including headers, "
291
                        "possibly compressed) sent using the {} connection "
292
                        "type by the referenced locality",
293
                        pp_type),
294
                    HPX_PERFORMANCE_COUNTER_V1,
295
#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS)
296
                    hpx::bind(
297
                        &performance_counters::per_action_data_counter_creator,
298
                        _1, HPX_MOVE(data_sent), _2),
299
                    &performance_counters::per_action_data_counter_discoverer,
300
#else
301
                    hpx::bind(
302
                        &performance_counters::locality_raw_counter_creator, _1,
303
                        HPX_MOVE(data_sent), _2),
304
                    &performance_counters::locality_counter_discoverer,
305
#endif
306
                    "bytes"},
307
                {hpx::util::format("/serialize/count/{}/received", pp_type),
308
                    performance_counters::counter_type::
309
                        monotonically_increasing,
310
                    hpx::util::format(
311
                        "returns the amount of parcel data (including headers, "
312
                        "possibly compressed) received using the {} connection "
313
                        "type by the referenced locality",
314
                        pp_type),
315
                    HPX_PERFORMANCE_COUNTER_V1,
316
#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS)
317
                    hpx::bind(
318
                        &performance_counters::per_action_data_counter_creator,
319
                        _1, HPX_MOVE(data_received), _2),
320
                    &performance_counters::per_action_data_counter_discoverer,
321
#else
322
                    hpx::bind(
323
                        &performance_counters::locality_raw_counter_creator, _1,
324
                        HPX_MOVE(data_received), _2),
325
                    &performance_counters::locality_counter_discoverer,
326
#endif
327
                    "bytes"},
328
                {hpx::util::format(
329
                     "/parcels/time/{}/buffer_allocate/received", pp_type),
330
                    performance_counters::counter_type::elapsed_time,
331
                    hpx::util::format(
332
                        "returns the time needed to allocate the buffers for "
333
                        "serializing using the {} connection type",
334
                        pp_type),
335
                    HPX_PERFORMANCE_COUNTER_V1,
336
                    hpx::bind(
337
                        &performance_counters::locality_raw_counter_creator, _1,
338
                        HPX_MOVE(buffer_allocate_time_received), _2),
339
                    &performance_counters::locality_counter_discoverer, "ns"},
340
                {hpx::util::format(
341
                     "/parcels/time/{}/buffer_allocate/sent", pp_type),
342
                    performance_counters::counter_type::elapsed_time,
343
                    hpx::util::format(
344
                        "returns the time needed to allocate the buffers for "
345
                        "serializing using the {} connection type",
346
                        pp_type),
347
                    HPX_PERFORMANCE_COUNTER_V1,
348
                    hpx::bind(
349
                        &performance_counters::locality_raw_counter_creator, _1,
350
                        HPX_MOVE(buffer_allocate_time_sent), _2),
351
                    &performance_counters::locality_counter_discoverer, "ns"},
352
                {hpx::util::format(
353
                     "/parcelport/count/{}/zero_copy_chunks/sent", pp_type),
354
                    performance_counters::counter_type::
355
                        monotonically_increasing,
356
                    hpx::util::format(
357
                        "returns the total number of zero-copy chunks sent "
358
                        "using the {} connection type for the referenced "
359
                        "locality",
360
                        pp_type),
361
                    HPX_PERFORMANCE_COUNTER_V1,
362
                    hpx::bind(
363
                        &performance_counters::locality_raw_counter_creator, _1,
364
                        HPX_MOVE(num_zchunks_send), _2),
365
                    &performance_counters::locality_counter_discoverer, ""},
366
                {hpx::util::format(
367
                     "/parcelport/count/{}/zero_copy_chunks/received", pp_type),
368
                    performance_counters::counter_type::
369
                        monotonically_increasing,
370
                    hpx::util::format(
371
                        "returns the total number of zero-copy chunks received "
372
                        "using the {} connection type for the referenced "
373
                        "locality",
374
                        pp_type),
375
                    HPX_PERFORMANCE_COUNTER_V1,
376
                    hpx::bind(
377
                        &performance_counters::locality_raw_counter_creator, _1,
378
                        HPX_MOVE(num_zchunks_recv), _2),
379
                    &performance_counters::locality_counter_discoverer, ""},
380
                {hpx::util::format(
381
                     "/parcelport/count-max/{}/zero_copy_chunks/sent", pp_type),
382
                    performance_counters::counter_type::
383
                        monotonically_increasing,
384
                    hpx::util::format(
385
                        "returns the maximum number of zero-copy chunks per "
386
                        "message sent using the {} connection type for the "
387
                        "referenced locality",
388
                        pp_type),
389
                    HPX_PERFORMANCE_COUNTER_V1,
390
                    hpx::bind(
391
                        &performance_counters::locality_raw_counter_creator, _1,
392
                        HPX_MOVE(num_zchunks_send_per_msg_max), _2),
393
                    &performance_counters::locality_counter_discoverer, ""},
394
                {hpx::util::format(
395
                     "/parcelport/count-max/{}/zero_copy_chunks/received",
396
                     pp_type),
397
                    performance_counters::counter_type::
398
                        monotonically_increasing,
399
                    hpx::util::format(
400
                        "returns the maximum number of zero-copy chunks per "
401
                        "message received using the {} connection type for the "
402
                        "referenced locality",
403
                        pp_type),
404
                    HPX_PERFORMANCE_COUNTER_V1,
405
                    hpx::bind(
406
                        &performance_counters::locality_raw_counter_creator, _1,
407
                        HPX_MOVE(num_zchunks_recv_per_msg_max), _2),
408
                    &performance_counters::locality_counter_discoverer, ""},
409
                {hpx::util::format(
410
                     "/parcelport/size/{}/zero_copy_chunks/sent", pp_type),
411
                    performance_counters::counter_type::
412
                        monotonically_increasing,
413
                    hpx::util::format(
414
                        "returns the total size of zero-copy chunks sent using "
415
                        "the {} connection type for the referenced locality",
416
                        pp_type),
417
                    HPX_PERFORMANCE_COUNTER_V1,
418
                    hpx::bind(
419
                        &performance_counters::locality_raw_counter_creator, _1,
420
                        HPX_MOVE(size_zchunks_send), _2),
421
                    &performance_counters::locality_counter_discoverer, ""},
422
                {hpx::util::format(
423
                     "/parcelport/size/{}/zero_copy_chunks/received", pp_type),
424
                    performance_counters::counter_type::
425
                        monotonically_increasing,
426
                    hpx::util::format(
427
                        "returns the total size of zero-copy chunks received "
428
                        "using the {} connection type for the referenced "
429
                        "locality",
430
                        pp_type),
431
                    HPX_PERFORMANCE_COUNTER_V1,
432
                    hpx::bind(
433
                        &performance_counters::locality_raw_counter_creator, _1,
434
                        HPX_MOVE(size_zchunks_recv), _2),
435
                    &performance_counters::locality_counter_discoverer, ""},
436
                {hpx::util::format(
437
                     "/parcelport/size-max/{}/zero_copy_chunks/sent", pp_type),
438
                    performance_counters::counter_type::
439
                        monotonically_increasing,
440
                    hpx::util::format(
441
                        "returns the maximum size of zero-copy chunks sent "
442
                        "using the {} connection type for the referenced "
443
                        "locality",
444
                        pp_type),
445
                    HPX_PERFORMANCE_COUNTER_V1,
446
                    hpx::bind(
447
                        &performance_counters::locality_raw_counter_creator, _1,
448
                        HPX_MOVE(size_zchunks_send_per_msg_max), _2),
449
                    &performance_counters::locality_counter_discoverer, ""},
450
                {hpx::util::format(
451
                     "/parcelport/size-max/{}/zero_copy_chunks/received",
452
                     pp_type),
453
                    performance_counters::counter_type::
454
                        monotonically_increasing,
455
                    hpx::util::format(
456
                        "returns the maximum size of zero-copy chunks received "
457
                        "using the {} connection type for the referenced "
458
                        "locality",
459
                        pp_type),
460
                    HPX_PERFORMANCE_COUNTER_V1,
461
                    hpx::bind(
462
                        &performance_counters::locality_raw_counter_creator, _1,
463
                        HPX_MOVE(size_zchunks_recv_per_msg_max), _2),
464
                    &performance_counters::locality_counter_discoverer, ""},
465
            };
466

467
        performance_counters::install_counter_types(
468
            counter_types, std::size(counter_types));
469
    }
470

471
    ///////////////////////////////////////////////////////////////////////////
472
    // register connection specific performance counters related to connection
473
    // caches
474
    static void register_connection_cache_counter_types(
475
        parcelset::parcelhandler& ph, std::string const& pp_type)
476
    {
477
        using hpx::placeholders::_1;
478
        using hpx::placeholders::_2;
479

480
        using parcelset::parcelhandler;
481
        using parcelset::parcelport;
482

483
        hpx::function<std::int64_t(bool)> cache_insertions(
484
            hpx::bind_front(&parcelhandler::get_connection_cache_statistics,
485
                &ph, pp_type, parcelport::connection_cache_insertions));
486
        hpx::function<std::int64_t(bool)> cache_evictions(
487
            hpx::bind_front(&parcelhandler::get_connection_cache_statistics,
×
488
                &ph, pp_type, parcelport::connection_cache_evictions));
489
        hpx::function<std::int64_t(bool)> cache_hits(
490
            hpx::bind_front(&parcelhandler::get_connection_cache_statistics,
491
                &ph, pp_type, parcelport::connection_cache_hits));
492
        hpx::function<std::int64_t(bool)> cache_misses(
10✔
493
            hpx::bind_front(&parcelhandler::get_connection_cache_statistics,
494
                &ph, pp_type, parcelport::connection_cache_misses));
495
        hpx::function<std::int64_t(bool)> cache_reclaims(
10✔
496
            hpx::bind_front(&parcelhandler::get_connection_cache_statistics,
497
                &ph, pp_type, parcelport::connection_cache_reclaims));
×
498

499
        performance_counters::generic_counter_type_data const
500
            connection_cache_types[] = {
501
                {hpx::util::format(
502
                     "/parcelport/count/{}/cache-insertions", pp_type),
503
                    performance_counters::counter_type::raw,
504
                    hpx::util::format(
505
                        "returns the number of cache insertions while "
506
                        "accessing the connection cache for the {} connection "
507
                        "type on the referenced locality",
10✔
508
                        pp_type),
10✔
509
                    HPX_PERFORMANCE_COUNTER_V1,
510
                    hpx::bind(
10✔
511
                        &performance_counters::locality_raw_counter_creator, _1,
10✔
512
                        HPX_MOVE(cache_insertions), _2),
513
                    &performance_counters::locality_counter_discoverer, ""},
10✔
514
                {hpx::util::format(
10✔
515
                     "/parcelport/count/{}/cache-evictions", pp_type),
516
                    performance_counters::counter_type::raw,
10✔
517
                    hpx::util::format(
10✔
518
                        "returns the number of cache evictions while accessing "
519
                        "the connection cache for the {} connection type on "
×
520
                        "the referenced locality",
10✔
521
                        pp_type),
522
                    HPX_PERFORMANCE_COUNTER_V1,
523
                    hpx::bind(
524
                        &performance_counters::locality_raw_counter_creator, _1,
525
                        HPX_MOVE(cache_evictions), _2),
526
                    &performance_counters::locality_counter_discoverer, ""},
527
                {hpx::util::format("/parcelport/count/{}/cache-hits", pp_type),
528
                    performance_counters::counter_type::raw,
529
                    hpx::util::format(
530
                        "returns the number of cache hits while accessing the "
531
                        "connection cache for the {} connection type on the "
532
                        "referenced locality",
533
                        pp_type),
10✔
534
                    HPX_PERFORMANCE_COUNTER_V1,
535
                    hpx::bind(
536
                        &performance_counters::locality_raw_counter_creator, _1,
10✔
537
                        HPX_MOVE(cache_hits), _2),
538
                    &performance_counters::locality_counter_discoverer, ""},
539
                {hpx::util::format(
540
                     "/parcelport/count/{}/cache-misses", pp_type),
541
                    performance_counters::counter_type::raw,
542
                    hpx::util::format(
543
                        "returns the number of cache misses while accessing "
544
                        "the connection cache for the {} connection type on "
545
                        "the referenced locality",
546
                        pp_type),
10✔
547
                    HPX_PERFORMANCE_COUNTER_V1,
548
                    hpx::bind(
549
                        &performance_counters::locality_raw_counter_creator, _1,
10✔
550
                        HPX_MOVE(cache_misses), _2),
551
                    &performance_counters::locality_counter_discoverer, ""},
552
                {hpx::util::format(
553
                     "/parcelport/count/{}/cache-reclaims", pp_type),
554
                    performance_counters::counter_type::raw,
555
                    hpx::util::format(
556
                        "returns the number of cache reclaims while accessing "
557
                        "the connection cache for the {} connection type on "
558
                        "the referenced locality",
10✔
559
                        pp_type),
560
                    HPX_PERFORMANCE_COUNTER_V1,
561
                    hpx::bind(
10✔
562
                        &performance_counters::locality_raw_counter_creator, _1,
563
                        HPX_MOVE(cache_reclaims), _2),
564
                    &performance_counters::locality_counter_discoverer, ""}};
565

566
        performance_counters::install_counter_types(
567
            connection_cache_types, std::size(connection_cache_types));
568
    }
569
#endif
570

571
    ///////////////////////////////////////////////////////////////////////////
10✔
572
    void register_parcelhandler_counter_types(
573
        [[maybe_unused]] parcelset::parcelhandler& ph)
574
    {
10✔
575
#if defined(HPX_HAVE_PARCELPORT_COUNTERS)
576
        if (!ph.is_networking_enabled())
577
        {
578
            return;
579
        }
580

581
        // register connection specific counters
582
        ph.enum_parcelports([&](std::string const& type) -> bool {
583
            register_parcelhandler_counter_types(ph, type);
584
            register_connection_cache_counter_types(ph, type);
×
585
            return true;
586
        });
587

110✔
588
        using placeholders::_1;
589
        using placeholders::_2;
10✔
590

591
        using parcelset::parcelhandler;
160✔
592

593
        // register common counters
594
        hpx::function<std::int64_t(bool)> incoming_queue_length(
32✔
595
            hpx::bind_front(&parcelhandler::get_incoming_queue_length, &ph));
596
        hpx::function<std::int64_t(bool)> outgoing_queue_length(
597
            hpx::bind_front(&parcelhandler::get_outgoing_queue_length, &ph));
64✔
598
        hpx::function<std::int64_t(bool)> outgoing_routed_count(
10✔
599
            hpx::bind_front(&parcelhandler::get_parcel_routed_count, &ph));
10✔
600

10✔
601
        performance_counters::generic_counter_type_data const counter_types[] =
602
            {{"/parcelqueue/length/receive",
603
                 performance_counters::counter_type::raw,
604
                 "returns the number current length of the queue of incoming "
605
                 "parcels",
606
                 HPX_PERFORMANCE_COUNTER_V1,
607
                 hpx::bind(&performance_counters::locality_raw_counter_creator,
608
                     _1, incoming_queue_length, _2),
609
                 &performance_counters::locality_counter_discoverer, ""},
610
                {"/parcelqueue/length/send",
611
                    performance_counters::counter_type::raw,
612
                    "returns the number current length of the queue of "
613
                    "outgoing parcels",
614
                    HPX_PERFORMANCE_COUNTER_V1,
615
                    hpx::bind(
616
                        &performance_counters::locality_raw_counter_creator, _1,
617
                        outgoing_queue_length, _2),
618
                    &performance_counters::locality_counter_discoverer, ""},
619
                {"/parcels/count/routed",
620
                    performance_counters::counter_type::
621
                        monotonically_increasing,
622
                    "returns the number of (outbound) parcel routed through "
32✔
623
                    "the responsible AGAS service",
624
                    HPX_PERFORMANCE_COUNTER_V1,
32✔
625
                    hpx::bind(
626
                        &performance_counters::locality_raw_counter_creator, _1,
627
                        outgoing_routed_count, _2),
628
                    &performance_counters::locality_counter_discoverer, ""}};
629

630
        performance_counters::install_counter_types(
32✔
631
            counter_types, std::size(counter_types));
632
#endif
633
    }
32✔
634
}    // namespace hpx::performance_counters
635

636
#endif
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