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

STEllAR-GROUP / hpx / #867

15 Jan 2023 08:00PM UTC coverage: 86.487% (+0.5%) from 85.951%
#867

push

StellarBot
Merge #6135

6135: Fixing warnings reported by MSVC analysis r=hkaiser a=hkaiser

- adding MSVC specific #pragma's to suppress the benign warnings


Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

120 of 120 new or added lines in 33 files covered. (100.0%)

174599 of 201880 relevant lines covered (86.49%)

1945607.64 hits per line

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

62.65
/libs/full/performance_counters/src/counters.cpp
1
//  Copyright (c) 2007-2022 Hartmut Kaiser
2
//  Copyright (c)      2011 Bryce Lelbach
3
//
4
//  SPDX-License-Identifier: BSL-1.0
5
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
6
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7

8
#include <hpx/config.hpp>
9
#include <hpx/actions_base/basic_action.hpp>
10
#include <hpx/assert.hpp>
11
#include <hpx/async_distributed/continuation.hpp>
12
#include <hpx/async_distributed/detail/post.hpp>
13
#include <hpx/async_distributed/transfer_continuation_action.hpp>
14
#include <hpx/components_base/agas_interface.hpp>
15
#include <hpx/functional/bind_front.hpp>
16
#include <hpx/functional/function.hpp>
17
#include <hpx/futures/packaged_continuation.hpp>
18
#include <hpx/modules/execution.hpp>
19
#include <hpx/modules/format.hpp>
20
#include <hpx/performance_counters/base_performance_counter.hpp>
21
#include <hpx/performance_counters/counter_creators.hpp>
22
#include <hpx/performance_counters/counter_interface.hpp>
23
#include <hpx/performance_counters/counter_parser.hpp>
24
#include <hpx/performance_counters/counters.hpp>
25
#include <hpx/performance_counters/manage_counter_type.hpp>
26
#include <hpx/performance_counters/registry.hpp>
27
#include <hpx/runtime_local/get_num_all_localities.hpp>
28
#include <hpx/runtime_local/get_os_thread_count.hpp>
29
#include <hpx/runtime_local/runtime_local_fwd.hpp>
30
#include <hpx/runtime_local/thread_pool_helpers.hpp>
31
#include <hpx/serialization/base_object.hpp>
32
#include <hpx/serialization/serialize.hpp>
33
#include <hpx/serialization/string.hpp>
34
#include <hpx/serialization/vector.hpp>
35
#include <hpx/threading_base/thread_helpers.hpp>
36
#include <hpx/util/from_string.hpp>
37

38
#include <cstddef>
39
#include <cstdint>
40
#include <functional>
41
#include <string>
42
#include <utility>
43
#include <vector>
44

45
///////////////////////////////////////////////////////////////////////////////
46
// Initialization support for the performance counter actions
47
HPX_REGISTER_ACTION_ID(hpx::performance_counters::server ::
4,782✔
48
                           base_performance_counter::get_counter_info_action,
49
    performance_counter_get_counter_info_action,
50
    hpx::actions::performance_counter_get_counter_info_action_id)
51
HPX_REGISTER_ACTION_ID(hpx::performance_counters::server ::
4,819✔
52
                           base_performance_counter::get_counter_value_action,
53
    performance_counter_get_counter_value_action,
54
    hpx::actions::performance_counter_get_counter_value_action_id)
55
HPX_REGISTER_ACTION_ID(
4,688✔
56
    hpx::performance_counters::server ::base_performance_counter::
57
        get_counter_values_array_action,
58
    performance_counter_get_counter_values_array_action,
59
    hpx::actions::performance_counter_get_counter_values_array_action_id)
60
HPX_REGISTER_ACTION_ID(hpx::performance_counters::server ::
4,648✔
61
                           base_performance_counter::set_counter_value_action,
62
    performance_counter_set_counter_value_action,
63
    hpx::actions::performance_counter_set_counter_value_action_id)
64
HPX_REGISTER_ACTION_ID(hpx::performance_counters::server ::
4,650✔
65
                           base_performance_counter::reset_counter_value_action,
66
    performance_counter_reset_counter_value_action,
67
    hpx::actions::performance_counter_reset_counter_value_action_id)
68
HPX_REGISTER_ACTION_ID(
4,674✔
69
    hpx::performance_counters::server::base_performance_counter::start_action,
70
    performance_counter_start_action,
71
    hpx::actions::performance_counter_start_action_id)
72
HPX_REGISTER_ACTION_ID(
4,674✔
73
    hpx::performance_counters::server::base_performance_counter::stop_action,
74
    performance_counter_stop_action,
75
    hpx::actions::performance_counter_stop_action_id)
76

77
HPX_REGISTER_BASE_LCO_WITH_VALUE_ID(hpx::performance_counters::counter_info,
10,525✔
78
    hpx_counter_info, hpx::actions::base_lco_with_value_hpx_counter_info_get,
79
    hpx::actions::base_lco_with_value_hpx_counter_info_set)
80
HPX_REGISTER_BASE_LCO_WITH_VALUE_ID(hpx::performance_counters::counter_value,
10,547✔
81
    hpx_counter_value, hpx::actions::base_lco_with_value_hpx_counter_value_get,
82
    hpx::actions::base_lco_with_value_hpx_counter_value_set)
83
HPX_REGISTER_BASE_LCO_WITH_VALUE_ID(
10,478✔
84
    hpx::performance_counters::counter_values_array, hpx_counter_values_array,
85
    hpx::actions::base_lco_with_value_hpx_counter_values_array_get,
86
    hpx::actions::base_lco_with_value_hpx_counter_values_array_set)
87

88
HPX_DEFINE_GET_COMPONENT_TYPE(
13,876✔
89
    hpx::performance_counters::server::base_performance_counter)
90

91
///////////////////////////////////////////////////////////////////////////////
92
namespace hpx { namespace performance_counters {
93
    /// \brief Create a full name of a counter from the contents of the given
94
    ///        \a counter_path_elements instance.
95
    counter_status get_counter_name(
401✔
96
        counter_path_elements const& path, std::string& result, error_code& ec)
97
    {
98
        if (path.objectname_.empty())
401✔
99
        {
100
            HPX_THROWS_IF(ec, hpx::error::bad_parameter, "get_counter_name",
×
101
                "empty counter object name");
102
            return counter_status::invalid_data;
×
103
        }
104

105
        result = "/";
401✔
106
        result += path.objectname_;
401✔
107

108
        if (!path.parentinstancename_.empty() || !path.instancename_.empty() ||
401✔
109
            !path.subinstancename_.empty())
9✔
110
        {
111
            result += "{";
392✔
112
            if (!path.parentinstancename_.empty())
392✔
113
            {
114
                result += path.parentinstancename_;
392✔
115
                if (-1 != path.parentinstanceindex_)
392✔
116
                {
117
                    result += "#";
253✔
118
                    result += std::to_string(path.parentinstanceindex_);
253✔
119
                }
253✔
120
            }
392✔
121
            if (!path.instancename_.empty())
392✔
122
            {
123
                result += "/";
378✔
124
                result += path.instancename_;
378✔
125
                if (path.instanceindex_ != -1)
378✔
126
                {
127
                    if (path.instancename_ == "pool")
136✔
128
                    {
129
                        result += "#" +
78✔
130
                            hpx::resource::get_pool_name(path.instanceindex_);
78✔
131
                    }
78✔
132
                    else
133
                    {
134
                        result += "#" + std::to_string(path.instanceindex_);
58✔
135
                    }
136
                }
136✔
137
            }
378✔
138
            if (!path.subinstancename_.empty())
392✔
139
            {
140
                result += "/";
125✔
141
                result += path.subinstancename_;
125✔
142
                if (-1 != path.subinstanceindex_)
125✔
143
                {
144
                    result += "#";
56✔
145
                    result += std::to_string(path.subinstanceindex_);
56✔
146
                }
56✔
147
            }
125✔
148
            result += "}";
392✔
149
        }
392✔
150
        if (!path.countername_.empty())
401✔
151
        {
152
            result += "/";
397✔
153
            result += path.countername_;
397✔
154
        }
397✔
155

156
        if (!path.parameters_.empty())
401✔
157
        {
158
            result += "@";
66✔
159
            result += path.parameters_;
66✔
160
        }
66✔
161

162
        if (&ec != &throws)
401✔
163
            ec = make_success_code();
129✔
164
        return counter_status::valid_data;
401✔
165
    }
401✔
166

167
    /// \brief Create a full name of a counter from the contents of the given
168
    ///        \a counter_path_elements instance.
169
    counter_status get_counter_type_name(counter_type_path_elements const& path,
145,938✔
170
        std::string& result, error_code& ec)
171
    {
172
        if (path.objectname_.empty())
145,938✔
173
        {
174
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
175
                "get_counter_type_name", "empty counter object name");
176
            return counter_status::invalid_data;
×
177
        }
178

179
        result = "/";
145,938✔
180
        result += path.objectname_;
145,938✔
181

182
        if (!path.countername_.empty())
145,938✔
183
        {
184
            result += "/";
145,932✔
185
            result += path.countername_;
145,932✔
186
        }
145,932✔
187

188
        if (&ec != &throws)
145,938✔
189
            ec = make_success_code();
73,054✔
190
        return counter_status::valid_data;
145,938✔
191
    }
145,938✔
192

193
    /// \brief Create a full name of a counter from the contents of the given
194
    ///        \a counter_path_elements instance.
195
    counter_status get_full_counter_type_name(
32✔
196
        counter_type_path_elements const& path, std::string& result,
197
        error_code& ec)
198
    {
199
        if (path.objectname_.empty())
32✔
200
        {
201
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
202
                "get_full_counter_type_name", "empty counter object name");
203
            return counter_status::invalid_data;
×
204
        }
205

206
        result = "/";
32✔
207
        result += path.objectname_;
32✔
208

209
        if (!path.countername_.empty())
32✔
210
        {
211
            result += "/";
30✔
212
            result += path.countername_;
30✔
213
        }
30✔
214

215
        if (!path.parameters_.empty())
32✔
216
        {
217
            result += "@";
16✔
218
            result += path.parameters_;
16✔
219
        }
16✔
220

221
        if (&ec != &throws)
32✔
222
            ec = make_success_code();
32✔
223
        return counter_status::valid_data;
32✔
224
    }
32✔
225

226
    /// \brief Create a name of a counter instance from the contents of the
227
    ///        given \a counter_path_elements instance.
228
    counter_status get_counter_instance_name(
×
229
        counter_path_elements const& path, std::string& result, error_code& ec)
230
    {
231
        if (path.parentinstancename_.empty())
×
232
        {
233
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
234
                "get_counter_instance_name", "empty counter instance name");
235
            return counter_status::invalid_data;
×
236
        }
237

238
        if (path.parentinstance_is_basename_)
×
239
        {
240
            result = path.parentinstancename_;
×
241
        }
×
242
        else
243
        {
244
            result = "/";
×
245
            result += path.parentinstancename_;
×
246
            if (path.parentinstanceindex_ == -1)
×
247
            {
248
                result += "#*";
×
249
            }
×
250
            else
251
            {
252
                result += "#" + std::to_string(path.parentinstanceindex_);
×
253
            }
254

255
            if (!path.instancename_.empty())
×
256
            {
257
                result += "/";
×
258
                result += path.instancename_;
×
259
                if (path.instanceindex_ == -1)
×
260
                {
261
                    result += "#*";
×
262
                }
×
263
                else if (path.instancename_ == "pool")
×
264
                {
265
                    result +=
×
266
                        "#" + hpx::resource::get_pool_name(path.instanceindex_);
×
267
                }
×
268
                else
269
                {
270
                    result += "#" + std::to_string(path.instanceindex_);
×
271
                }
272
            }
×
273

274
            if (!path.subinstancename_.empty())
×
275
            {
276
                result += "/";
×
277
                result += path.subinstancename_;
×
278
                if (path.subinstanceindex_ == -1)
×
279
                {
280
                    result += "#*";
×
281
                }
×
282
                else
283
                {
284
                    result += "#" + std::to_string(path.subinstanceindex_);
×
285
                }
286
            }
×
287
        }
288

289
        if (&ec != &throws)
×
290
            ec = make_success_code();
×
291
        return counter_status::valid_data;
×
292
    }
×
293

294
    /// \brief Fill the given \a counter_path_elements instance from the given
295
    ///        full name of a counter
296
    ///
297
    ///    /objectname{parentinstancename#parentindex
298
    ///       /instancename#instanceindex}/countername
299
    ///
300
    counter_status get_counter_path_elements(
570✔
301
        std::string const& name, counter_path_elements& path, error_code& ec)
302
    {
303
        path_elements elements;
570✔
304
        if (!parse_counter_name(name, elements))
570✔
305
        {
306
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
24✔
307
                "get_counter_path_elements", "invalid counter name format: {}",
308
                name);
309
            return counter_status::invalid_data;
12✔
310
        }
311

312
        path.objectname_ = elements.object_;
546✔
313
        path.countername_ = elements.counter_;
546✔
314

315
        path.parentinstancename_ = elements.instance_.parent_.name_;
546✔
316
        path.parentinstance_is_basename_ = elements.instance_.parent_.basename_;
546✔
317
        path.parentinstanceindex_ = -1;
546✔
318

319
        path.instancename_ = elements.instance_.child_.name_;
546✔
320
        path.instanceindex_ = -1;
546✔
321

322
        path.subinstancename_ = elements.instance_.subchild_.name_;
546✔
323
        path.subinstanceindex_ = -1;
546✔
324

325
        path.parameters_ = elements.parameters_;
546✔
326

327
        if (!path.parentinstance_is_basename_)
546✔
328
        {
329
            if (elements.instance_.parent_.index_ == "#*")
538✔
330
            {
331
                path.parentinstancename_ += "#*";
7✔
332
            }
7✔
333
            else if (!elements.instance_.parent_.index_.empty())
531✔
334
            {
335
                path.parentinstanceindex_ =
326✔
336
                    hpx::util::from_string<std::int64_t>(
326✔
337
                        elements.instance_.parent_.index_);
326✔
338
            }
326✔
339

340
            if (elements.instance_.child_.index_ == "#*")
538✔
341
            {
342
                path.instancename_ += "#*";
9✔
343
            }
9✔
344
            else if (!elements.instance_.child_.index_.empty())
529✔
345
            {
346
                if (elements.instance_.child_.index_[0] == '#')
208✔
347
                    elements.instance_.child_.index_.erase(0, 1);
208✔
348

349
                if (path.instancename_ == "pool")
208✔
350
                {
351
                    path.instanceindex_ = hpx::resource::get_pool_index(
130✔
352
                        elements.instance_.child_.index_);
130✔
353
                }
130✔
354
                else
355
                {
356
                    path.instanceindex_ = hpx::util::from_string<std::int64_t>(
78✔
357
                        elements.instance_.child_.index_, std::int64_t(-2));
78✔
358
                    if (path.instanceindex_ == std::int64_t(-2))
78✔
359
                    {
360
                        HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
361
                            "get_counter_path_elements",
362
                            "invalid counter name format: {}", name);
363
                        return counter_status::invalid_data;
×
364
                    }
365
                }
366
            }
208✔
367

368
            if (elements.instance_.subchild_.index_ == "#*")
538✔
369
            {
370
                path.subinstancename_ += "#*";
5✔
371
            }
5✔
372
            else if (!elements.instance_.subchild_.index_.empty())
533✔
373
            {
374
                path.subinstanceindex_ = hpx::util::from_string<std::uint64_t>(
84✔
375
                    elements.instance_.subchild_.index_);
84✔
376
            }
84✔
377
        }
538✔
378

379
        if (&ec != &throws)
546✔
380
            ec = make_success_code();
225✔
381

382
        return counter_status::valid_data;
546✔
383
    }
582✔
384

385
    /// \brief Fill the given \a counter_type_path_elements instance from the
386
    ///        given full name of a counter
387
    ///
388
    ///    /objectname{...}/countername
389
    ///    /objectname
390
    ///
391
    counter_status get_counter_type_path_elements(std::string const& name,
218,460✔
392
        counter_type_path_elements& path, error_code& ec)
393
    {
394
        // parse the full name
395
        path_elements elements;
218,460✔
396
        if (!parse_counter_name(name, elements))
218,460✔
397
        {
398
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
399
                "get_counter_type_path_elements",
400
                "invalid counter name format: {}", name);
401
            return counter_status::invalid_data;
×
402
        }
403

404
        // but extract only counter type elements
405
        path.objectname_ = elements.object_;
218,460✔
406
        path.countername_ = elements.counter_;
218,460✔
407
        path.parameters_ = elements.parameters_;
218,460✔
408

409
        if (&ec != &throws)
218,460✔
410
            ec = make_success_code();
145,663✔
411

412
        return counter_status::valid_data;
218,460✔
413
    }
218,460✔
414

415
    /// \brief Return the counter type name from a given full instance name
416
    counter_status get_counter_type_name(
145,691✔
417
        std::string const& name, std::string& type_name, error_code& ec)
418
    {
419
        counter_type_path_elements p;
145,691✔
420

421
        counter_status status = get_counter_type_path_elements(name, p, ec);
145,691✔
422
        if (!status_is_valid(status))
145,691✔
423
            return status;
×
424

425
        return get_counter_type_name(p, type_name, ec);
145,691✔
426
    }
145,691✔
427

428
    /// \brief Return the counter type name from a given full instance name
429
    counter_status get_counter_name(
1✔
430
        std::string const& name, std::string& countername, error_code& ec)
431
    {
432
        counter_path_elements p;
1✔
433

434
        counter_status status = get_counter_path_elements(name, p, ec);
1✔
435
        if (!status_is_valid(status))
1✔
436
            return status;
×
437

438
        return get_counter_name(p, countername, ec);
1✔
439
    }
1✔
440

441
    /// \brief Complement the counter info if parent instance name is missing
442
    counter_status complement_counter_info(
63✔
443
        counter_info& info, counter_info const& type_info, error_code& ec)
444
    {
445
        info.type_ = type_info.type_;
63✔
446
        if (info.helptext_.empty())
63✔
447
            info.helptext_ = type_info.helptext_;
×
448
        return complement_counter_info(info, ec);
63✔
449
    }
450

451
    counter_status complement_counter_info(counter_info& info, error_code& ec)
151✔
452
    {
453
        counter_path_elements p;
151✔
454

455
        counter_status status =
151✔
456
            get_counter_path_elements(info.fullname_, p, ec);
151✔
457
        if (!status_is_valid(status))
151✔
458
            return status;
×
459

460
        if (p.parentinstancename_.empty())
151✔
461
        {
462
            p.parentinstancename_ = "locality";
23✔
463
            p.parentinstanceindex_ =
23✔
464
                static_cast<std::int64_t>(get_locality_id());
23✔
465
            if (p.instancename_.empty())
23✔
466
            {
467
                p.instancename_ = "total";
23✔
468
                p.instanceindex_ = -1;
23✔
469
            }
23✔
470
            if (p.subinstancename_.empty())
23✔
471
            {
472
                p.subinstanceindex_ = -1;
23✔
473
            }
23✔
474
        }
23✔
475

476
        // fill with complete counter type info
477
        std::string type_name;
151✔
478
        get_counter_type_name(p, type_name, ec);
151✔
479
        if (!status_is_valid(status))
151✔
480
            return status;
×
481

482
        get_counter_type(type_name, info, ec);
151✔
483
        if (!status_is_valid(status))
151✔
484
            return status;
×
485

486
        // last, set full counter name
487
        return get_counter_name(p, info.fullname_, ec);
151✔
488
    }
151✔
489

490
    ///////////////////////////////////////////////////////////////////////////
491
    /// \brief Get the name for a given counter type
492
    namespace strings {
493
        char const* const counter_type_names[] = {
494
            "text",
495
            "raw",
496
            "monotonically_increasing",
497
            "average_base",
498
            "average_count",
499
            "aggregating",
500
            "average_timer",
501
            "elapsed_time",
502
            "histogram",
503
            "raw_values",
504
        };
505
    }
506

507
    char const* get_counter_type_name(counter_type type)
×
508
    {
509
        if (type < counter_type::text || type > counter_type::raw_values)
×
510
            return "unknown";
×
511
        return strings::counter_type_names[static_cast<int>(type)];
×
512
    }
×
513

514
    ///////////////////////////////////////////////////////////////////////////
515
    counter_status add_counter_type(counter_info const& info,
72,705✔
516
        create_counter_func const& create_counter,
517
        discover_counters_func const& discover_counters, error_code& ec)
518
    {
519
        if (hpx::get_runtime_ptr() == nullptr)
72,705✔
520
        {
521
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
522
                "performance_counters::add_counter_type",
523
                "the runtime is not currently running");
524
            return counter_status::generic_error;
×
525
        }
526
        return registry::instance().add_counter_type(
145,410✔
527
            info, create_counter, discover_counters, ec);
72,705✔
528
    }
72,705✔
529

530
    ///////////////////////////////////////////////////////////////////////////
531
    /// \brief Call the supplied function for each registered counter type
532
    counter_status discover_counter_types(
1✔
533
        discover_counter_func const& discover_counter,
534
        discover_counters_mode mode, error_code& ec)
535
    {
536
        if (hpx::get_runtime_ptr() == nullptr)
1✔
537
        {
538
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
539
                "performance_counters::discover_counter_types",
540
                "the runtime is not currently running");
541
            return counter_status::generic_error;
×
542
        }
543
        return registry::instance().discover_counter_types(
2✔
544
            discover_counter, mode, ec);
1✔
545
    }
1✔
546

547
    ///////////////////////////////////////////////////////////////////////////
548
    /// \brief Call the supplied function for the given registered counter type.
549
    counter_status discover_counter_type(counter_info const& info,
×
550
        discover_counter_func const& discover_counter,
551
        discover_counters_mode mode, error_code& ec)
552
    {
553
        if (hpx::get_runtime_ptr() == nullptr)
×
554
        {
555
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
556
                "performance_counters::discover_counter_types",
557
                "the runtime is not currently running");
558
            return counter_status::generic_error;
×
559
        }
560
        return registry::instance().discover_counter_type(
×
561
            info, discover_counter, mode, ec);
×
562
    }
×
563

564
    counter_status discover_counter_type(std::string const& name,
5✔
565
        discover_counter_func const& discover_counter,
566
        discover_counters_mode mode, error_code& ec)
567
    {
568
        if (hpx::get_runtime_ptr() == nullptr)
5✔
569
        {
570
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
571
                "performance_counters::discover_counter_types",
572
                "the runtime is not currently running");
573
            return counter_status::generic_error;
×
574
        }
575
        return registry::instance().discover_counter_type(
10✔
576
            name, discover_counter, mode, ec);
5✔
577
    }
5✔
578

579
    ///////////////////////////////////////////////////////////////////////////
580
    namespace detail {
581
        bool discover_counters(std::vector<counter_info>& counters,
4✔
582
            counter_info const& info, error_code& /* ec */)
583
        {
584
            counters.push_back(info);
4✔
585
            return true;
4✔
586
        }
587
    }    // namespace detail
588

589
    counter_status discover_counter_types(std::vector<counter_info>& counters,
×
590
        discover_counters_mode mode, error_code& ec)
591
    {
592
        discover_counter_func func(
×
593
            hpx::bind_front(&detail::discover_counters, std::ref(counters)));
×
594

595
        return discover_counter_types(HPX_MOVE(func), mode, ec);
×
596
    }
×
597

598
    counter_status discover_counter_type(std::string const& name,
4✔
599
        std::vector<counter_info>& counters, discover_counters_mode mode,
600
        error_code& ec)
601
    {
602
        discover_counter_func func(
4✔
603
            hpx::bind_front(&detail::discover_counters, std::ref(counters)));
4✔
604

605
        return discover_counter_type(name, HPX_MOVE(func), mode, ec);
4✔
606
    }
4✔
607

608
    counter_status discover_counter_type(counter_info const& info,
×
609
        std::vector<counter_info>& counters, discover_counters_mode mode,
610
        error_code& ec)
611
    {
612
        discover_counter_func func(
×
613
            hpx::bind_front(&detail::discover_counters, std::ref(counters)));
×
614

615
        return discover_counter_type(info, HPX_MOVE(func), mode, ec);
×
616
    }
×
617

618
    ///////////////////////////////////////////////////////////////////////////
619
    counter_status remove_counter_type(counter_info const& info, error_code& ec)
145,283✔
620
    {
621
        // the runtime could be gone already
622
        if (hpx::get_runtime_ptr() == nullptr)
145,283✔
623
        {
624
            return counter_status::generic_error;
72,578✔
625
        }
626
        return registry::instance().remove_counter_type(info, ec);
72,705✔
627
    }
145,283✔
628

629
    /// \brief Retrieve the counter type for the given counter name from the
630
    ///        (local) registry
631
    counter_status get_counter_type(
151✔
632
        std::string const& name, counter_info& info, error_code& ec)
633
    {
634
        if (hpx::get_runtime_ptr() == nullptr)
151✔
635
        {
636
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
637
                "performance_counters::get_counter_type",
638
                "the runtime is not currently running");
639
            return counter_status::generic_error;
×
640
        }
641
        return registry::instance().get_counter_type(name, info, ec);
151✔
642
    }
151✔
643

644
    namespace detail {
645
        naming::gid_type create_raw_counter_value(counter_info const& info,
×
646
            std::int64_t* countervalue, error_code& ec)
647
        {
648
            HPX_ASSERT(hpx::get_runtime_ptr() != nullptr);
×
649
            naming::gid_type gid;
×
650
            registry::instance().create_raw_counter_value(
×
651
                info, countervalue, gid, ec);
×
652
            return gid;
×
653
        }
654

655
        naming::gid_type create_raw_counter(counter_info const& info,
3✔
656
            hpx::function<std::int64_t()> const& f, error_code& ec)
657
        {
658
            HPX_ASSERT(hpx::get_runtime_ptr() != nullptr);
3✔
659
            naming::gid_type gid;
3✔
660
            registry::instance().create_raw_counter(info, f, gid, ec);
3✔
661
            return gid;
3✔
662
        }
663

664
        naming::gid_type create_raw_counter(counter_info const& info,
55✔
665
            hpx::function<std::int64_t(bool)> const& f, error_code& ec)
666
        {
667
            HPX_ASSERT(hpx::get_runtime_ptr() != nullptr);
55✔
668
            naming::gid_type gid;
55✔
669
            registry::instance().create_raw_counter(info, f, gid, ec);
55✔
670
            return gid;
55✔
671
        }
672

673
        naming::gid_type create_raw_counter(counter_info const& info,
×
674
            hpx::function<std::vector<std::int64_t>()> const& f, error_code& ec)
675
        {
676
            HPX_ASSERT(hpx::get_runtime_ptr() != nullptr);
×
677
            naming::gid_type gid;
×
678
            registry::instance().create_raw_counter(info, f, gid, ec);
×
679
            return gid;
×
680
        }
681

682
        naming::gid_type create_raw_counter(counter_info const& info,
1✔
683
            hpx::function<std::vector<std::int64_t>(bool)> const& f,
684
            error_code& ec)
685
        {
686
            HPX_ASSERT(hpx::get_runtime_ptr() != nullptr);
1✔
687
            naming::gid_type gid;
1✔
688
            registry::instance().create_raw_counter(info, f, gid, ec);
1✔
689
            return gid;
1✔
690
        }
691

692
        // \brief Create a new performance counter instance based on given
693
        //        counter info
694
        naming::gid_type create_counter(
2✔
695
            counter_info const& info, error_code& ec)
696
        {
697
            HPX_ASSERT(hpx::get_runtime_ptr() != nullptr);
2✔
698
            naming::gid_type gid;
2✔
699
            registry::instance().create_counter(info, gid, ec);
2✔
700
            return gid;
2✔
701
        }
702

703
        // \brief Create a new aggregating performance counter instance based
704
        //        on given base counter name and given base time interval
705
        //        (milliseconds).
706
        naming::gid_type create_statistics_counter(counter_info const& info,
1✔
707
            std::string const& base_counter_name,
708
            std::vector<std::size_t> const& parameters, error_code& ec)
709
        {
710
            HPX_ASSERT(hpx::get_runtime_ptr() != nullptr);
1✔
711
            naming::gid_type gid;
1✔
712
            registry::instance().create_statistics_counter(
2✔
713
                info, base_counter_name, parameters, gid, ec);
1✔
714
            return gid;
1✔
715
        }
716

717
        // \brief Create a new aggregating performance counter instance based
718
        //        on given base counter name and given base time interval
719
        //        (milliseconds).
720
        naming::gid_type create_arithmetics_counter(counter_info const& info,
×
721
            std::vector<std::string> const& base_counter_names, error_code& ec)
722
        {
723
            HPX_ASSERT(hpx::get_runtime_ptr() != nullptr);
×
724
            naming::gid_type gid;
×
725
            registry::instance().create_arithmetics_counter(
×
726
                info, base_counter_names, gid, ec);
×
727
            return gid;
×
728
        }
729

730
        // \brief Create a new aggregating extended performance counter instance
731
        //        based on given base counter name and given base time interval
732
        //        (milliseconds).
733
        naming::gid_type create_arithmetics_counter_extended(
×
734
            counter_info const& info,
735
            std::vector<std::string> const& base_counter_names, error_code& ec)
736
        {
737
            HPX_ASSERT(hpx::get_runtime_ptr() != nullptr);
×
738
            naming::gid_type gid;
×
739
            registry::instance().create_arithmetics_counter_extended(
×
740
                info, base_counter_names, gid, ec);
×
741
            return gid;
×
742
        }
743

744
        ///////////////////////////////////////////////////////////////////////
745
        counter_status add_counter(
×
746
            hpx::id_type const& id, counter_info const& info, error_code& ec)
747
        {
748
            HPX_ASSERT(hpx::get_runtime_ptr() != nullptr);
×
749
            return registry::instance().add_counter(id, info, ec);
×
750
        }
751

752
        counter_status remove_counter(
×
753
            counter_info const& info, hpx::id_type const& id, error_code& ec)
754
        {
755
            HPX_ASSERT(hpx::get_runtime_ptr() != nullptr);
×
756
            return registry::instance().remove_counter(info, id, ec);
×
757
        }
758

759
        // create an arbitrary counter on this locality
760
        naming::gid_type create_counter_local(counter_info const& info)
63✔
761
        {
762
            // find create function for given counter
763
            error_code ec;
63✔
764

765
            HPX_ASSERT(hpx::get_runtime_ptr() != nullptr);
63✔
766

767
            create_counter_func f;
63✔
768
            registry::instance().get_counter_create_function(info, f, ec);
63✔
769
            if (ec)
63✔
770
            {
771
                HPX_THROW_EXCEPTION(hpx::error::bad_parameter,
×
772
                    "create_counter_local",
773
                    "no create function for performance counter found: {} ({})",
774
                    remove_counter_prefix(info.fullname_), ec.get_message());
775
                return naming::invalid_gid;
776
            }
777

778
            counter_path_elements paths;
63✔
779
            get_counter_path_elements(info.fullname_, paths, ec);
63✔
780
            if (ec)
63✔
781
                return hpx::naming::invalid_gid;
×
782

783
            if (paths.parentinstancename_ == "locality" &&
125✔
784
                paths.parentinstanceindex_ !=
62✔
785
                    static_cast<std::int64_t>(hpx::get_locality_id()))
62✔
786
            {
787
                HPX_THROW_EXCEPTION(hpx::error::bad_parameter,
×
788
                    "create_counter_local",
789
                    "attempt to create counter on wrong locality ({})",
790
                    ec.get_message());
791
                return hpx::naming::invalid_gid;
792
            }
793

794
            // attempt to create the new counter instance
795
            naming::gid_type gid = f(info, ec);
63✔
796
            if (ec)
63✔
797
            {
798
                HPX_THROW_EXCEPTION(hpx::error::bad_parameter,
×
799
                    "create_counter_local",
800
                    "couldn't create performance counter: {} ({})",
801
                    remove_counter_prefix(info.fullname_), ec.get_message());
802
                return naming::invalid_gid;
803
            }
804

805
            return gid;
63✔
806
        }
63✔
807

808
        ///////////////////////////////////////////////////////////////////////
809
        inline bool is_thread_kind(std::string const& pattern)
8✔
810
        {
811
            std::string::size_type p = pattern.find("-thread#*");
8✔
812
            return p != std::string::npos && p == pattern.size() - 9;
8✔
813
        }
814

815
        inline std::string get_thread_kind(std::string const& pattern)
2✔
816
        {
817
            HPX_ASSERT(is_thread_kind(pattern));
2✔
818
            return pattern.substr(0, pattern.find_last_of('-'));
2✔
819
        }
820

821
        ///////////////////////////////////////////////////////////////////////
822
        inline bool is_pool_kind(std::string const& pattern)
7✔
823
        {
824
            std::string::size_type p = pattern.find("pool#*");
7✔
825
            return p != std::string::npos;
7✔
826
        }
827

828
        inline std::string get_pool_kind(std::string const& pattern)
1✔
829
        {
830
            HPX_ASSERT(is_pool_kind(pattern));
1✔
831
            return pattern.substr(0, pattern.find_last_of('#'));
1✔
832
        }
833

834
        ///////////////////////////////////////////////////////////////////////
835
        inline bool is_node_kind(std::string const& pattern)
4✔
836
        {
837
            std::string::size_type p = pattern.find("-node#*");
4✔
838
            return p != std::string::npos && p == pattern.size() - 7;
4✔
839
        }
840

841
        inline std::string get_node_kind(std::string const& pattern)
×
842
        {
843
            HPX_ASSERT(is_node_kind(pattern));
×
844
            return pattern.substr(0, pattern.find_last_of('-'));
×
845
        }
846

847
        ///////////////////////////////////////////////////////////////////////
848
        /// Expand all wild-cards in a counter base name (for aggregate counters)
849
        bool expand_basecounter(counter_info const& info,
×
850
            counter_path_elements& p, discover_counter_func const& f,
851
            error_code& ec)
852
        {
853
            // discover all base names
854
            std::vector<counter_info> counter_infos;
×
855
            counter_status status = discover_counter_type(p.parentinstancename_,
×
856
                counter_infos, discover_counters_mode::full, ec);
×
857
            if (!status_is_valid(status) || ec)
×
858
                return false;
×
859

860
            counter_info i = info;
×
861
            for (counter_info& basei : counter_infos)
×
862
            {
863
                p.parentinstancename_ = basei.fullname_;
×
864
                counter_status status = get_counter_name(p, i.fullname_, ec);
×
865
                if (!status_is_valid(status) || !f(i, ec) || ec)
×
866
                    return false;
×
867
            }
868
            return true;
×
869
        }
×
870

871
        ///////////////////////////////////////////////////////////////////////
872
        // expand main counter name
873
        bool expand_counter_info_pools(bool expand_threads, counter_info& i,
1✔
874
            counter_path_elements& p, discover_counter_func const& f,
875
            error_code& ec)
876
        {
877
            std::size_t num_pools = hpx::resource::get_num_thread_pools();
1✔
878
            for (std::size_t l = 0; l != num_pools; ++l)
2✔
879
            {
880
                p.instanceindex_ = static_cast<std::int64_t>(l);
1✔
881

882
                if (expand_threads)
1✔
883
                {
884
                    std::size_t num_threads =
1✔
885
                        hpx::resource::get_num_threads(p.instanceindex_);
1✔
886
                    for (std::size_t t = 0; t != num_threads; ++t)
5✔
887
                    {
888
                        p.subinstanceindex_ = static_cast<std::int64_t>(t);
4✔
889

890
                        counter_status status =
4✔
891
                            get_counter_name(p, i.fullname_, ec);
4✔
892
                        if (!status_is_valid(status) || !f(i, ec) || ec)
4✔
893
                            return false;
×
894
                    }
4✔
895
                }
1✔
896
                else
897
                {
898
                    counter_status status =
×
899
                        get_counter_name(p, i.fullname_, ec);
×
900
                    if (!status_is_valid(status) || !f(i, ec) || ec)
×
901
                        return false;
×
902
                }
903
            }
1✔
904
            return true;
1✔
905
        }
1✔
906

907
        bool expand_counter_info_pool_threads(counter_info& i,
×
908
            counter_path_elements& p, discover_counter_func const& f,
909
            error_code& ec)
910
        {
911
            std::size_t num_threads =
×
912
                hpx::resource::get_num_threads(p.instanceindex_);
×
913
            for (std::size_t t = 0; t != num_threads; ++t)
×
914
            {
915
                p.subinstanceindex_ = static_cast<std::int64_t>(t);
×
916

917
                counter_status status = get_counter_name(p, i.fullname_, ec);
×
918
                if (!status_is_valid(status) || !f(i, ec) || ec)
×
919
                    return false;
×
920
            }
×
921
            return true;
×
922
        }
×
923

924
        bool expand_counter_info_threads(counter_info& i,
1✔
925
            counter_path_elements& p, discover_counter_func const& f,
926
            error_code& ec)
927
        {
928
            std::size_t num_threads = get_os_thread_count();
1✔
929
            for (std::size_t l = 0; l != num_threads; ++l)
5✔
930
            {
931
                p.instanceindex_ = static_cast<std::int64_t>(l);
4✔
932
                counter_status status = get_counter_name(p, i.fullname_, ec);
4✔
933
                if (!status_is_valid(status) || !f(i, ec) || ec)
4✔
934
                    return false;
×
935
            }
4✔
936
            return true;
1✔
937
        }
1✔
938

939
        bool expand_counter_info_nodes(counter_info& i,
×
940
            counter_path_elements& p, discover_counter_func const& f,
941
            error_code& ec)
942
        {
943
            std::size_t num_nodes =
×
944
                hpx::threads::get_topology().get_number_of_numa_nodes();
×
945
            for (std::size_t l = 0; l != num_nodes; ++l)
×
946
            {
947
                p.instanceindex_ = static_cast<std::int64_t>(l);
×
948
                counter_status status = get_counter_name(p, i.fullname_, ec);
×
949
                if (!status_is_valid(status) || !f(i, ec) || ec)
×
950
                    return false;
×
951
            }
×
952
            return true;
×
953
        }
×
954

955
        bool expand_counter_info_localities(counter_info& i,
2✔
956
            counter_path_elements& p, discover_counter_func const& f,
957
            error_code& ec)
958
        {
959
            bool expand_pools = false;
2✔
960
            bool expand_threads = false;
2✔
961
            bool expand_nodes = false;
2✔
962

963
            if (is_pool_kind(p.instancename_))
2✔
964
            {
965
                p.instancename_ = get_pool_kind(p.instancename_);
1✔
966
                expand_pools = true;
1✔
967

968
                if (is_thread_kind(p.subinstancename_))
1✔
969
                {
970
                    p.subinstancename_ =
1✔
971
                        get_thread_kind(p.subinstancename_) + "-thread";
1✔
972
                    expand_threads = true;
1✔
973
                }
1✔
974
            }
1✔
975
            else if (is_thread_kind(p.instancename_))
1✔
976
            {
977
                p.instancename_ = get_thread_kind(p.instancename_) + "-thread";
1✔
978
                expand_threads = true;
1✔
979
            }
1✔
980
            else if (is_node_kind(p.instancename_))
×
981
            {
982
                p.instancename_ = get_node_kind(p.instancename_) + "-node";
×
983
                expand_nodes = true;
×
984
            }
×
985

986
            std::uint32_t last_locality = get_num_localities(hpx::launch::sync);
2✔
987
            for (std::uint32_t l = 0; l != last_locality; ++l)
4✔
988
            {
989
                p.parentinstanceindex_ = static_cast<std::int32_t>(l);
2✔
990
                if (expand_pools)
2✔
991
                {
992
                    if (!detail::expand_counter_info_pools(
1✔
993
                            expand_threads, i, p, f, ec))
1✔
994
                    {
995
                        return false;
×
996
                    }
997
                }
1✔
998
                else if (expand_threads)
1✔
999
                {
1000
                    if (!detail::expand_counter_info_threads(i, p, f, ec))
1✔
1001
                        return false;
×
1002
                }
1✔
1003
                else if (expand_nodes)
×
1004
                {
1005
                    if (!detail::expand_counter_info_nodes(i, p, f, ec))
×
1006
                        return false;
×
1007
                }
×
1008
                else
1009
                {
1010
                    counter_status status =
×
1011
                        get_counter_name(p, i.fullname_, ec);
×
1012
                    if (!status_is_valid(status) || !f(i, ec) || ec)
×
1013
                        return false;
×
1014
                }
1015
            }
2✔
1016
            return true;
2✔
1017
        }
2✔
1018

1019
        ///////////////////////////////////////////////////////////////////////
1020
        bool expand_counter_info(counter_info const& info,
6✔
1021
            counter_path_elements& p, discover_counter_func const& f,
1022
            error_code& ec)
1023
        {
1024
            // A '*' wild-card as the instance name is equivalent to no instance
1025
            // name at all.
1026
            if (p.parentinstancename_ == "*")
6✔
1027
            {
1028
                HPX_ASSERT(p.parentinstanceindex_ == -1);
×
1029
                p.parentinstancename_.clear();
×
1030
            }
×
1031

1032
            // first expand "locality*"
1033
            if (p.parentinstancename_ == "locality#*")
6✔
1034
            {
1035
                counter_info i = info;
2✔
1036
                p.parentinstancename_ = "locality";
2✔
1037
                return detail::expand_counter_info_localities(i, p, f, ec);
2✔
1038
            }
2✔
1039

1040
            // now expand "pool#*"
1041
            if (detail::is_pool_kind(p.instancename_))
4✔
1042
            {
1043
                bool expand_threads =
×
1044
                    detail::is_thread_kind(p.subinstancename_);
×
1045

1046
                counter_info i = info;
×
1047
                p.instancename_ = detail::get_pool_kind(p.instancename_);
×
1048
                if (expand_threads)
×
1049
                {
1050
                    p.subinstancename_ =
×
1051
                        detail::get_thread_kind(p.subinstancename_) + "-thread";
×
1052
                }
×
1053
                return detail::expand_counter_info_pools(
×
1054
                    expand_threads, i, p, f, ec);
×
1055
            }
×
1056
            else if (p.instancename_ == "pool" && p.subinstancename_ == "*")
4✔
1057
            {
1058
                p.subinstancename_ = "worker-thread";
×
1059
                p.subinstanceindex_ = -1;
×
1060
                counter_info i = info;
×
1061
                return detail::expand_counter_info_pool_threads(i, p, f, ec);
×
1062
            }
×
1063

1064
            if (detail::is_thread_kind(p.instancename_))
4✔
1065
            {
1066
                // now expand "<...>-thread#*"
1067
                counter_info i = info;
×
1068
                p.instancename_ =
×
1069
                    detail::get_thread_kind(p.instancename_) + "-thread";
×
1070
                return detail::expand_counter_info_threads(i, p, f, ec);
×
1071
            }
×
1072

1073
            // now expand "<...>-node#*"
1074
            if (detail::is_node_kind(p.instancename_))
4✔
1075
            {
1076
                counter_info i = info;
×
1077
                p.instancename_ =
×
1078
                    detail::get_node_kind(p.instancename_) + "-node";
×
1079
                return detail::expand_counter_info_nodes(i, p, f, ec);
×
1080
            }
×
1081

1082
            // handle wild-cards in aggregate counters
1083
            if (p.parentinstance_is_basename_)
4✔
1084
            {
1085
                return detail::expand_basecounter(info, p, f, ec);
×
1086
            }
1087

1088
            // everything else is handled directly
1089
            return f(info, ec);
4✔
1090
        }
6✔
1091
    }    // namespace detail
1092

1093
    ///////////////////////////////////////////////////////////////////////////
1094
    /// \brief call the supplied function will all expanded versions of the
1095
    /// supplied counter info.
1096
    bool expand_counter_info(counter_info const& info,
6✔
1097
        discover_counter_func const& f, error_code& ec)
1098
    {
1099
        counter_path_elements p;
6✔
1100
        counter_status status =
6✔
1101
            get_counter_path_elements(info.fullname_, p, ec);
6✔
1102
        if (!status_is_valid(status))
6✔
1103
            return false;
×
1104

1105
        return detail::expand_counter_info(info, p, f, ec);
6✔
1106
    }
6✔
1107

1108
    ///////////////////////////////////////////////////////////////////////////
1109
    static hpx::id_type register_with_agas(
63✔
1110
        std::string const& fullname, hpx::future<hpx::id_type> f)
1111
    {
1112
        // register the canonical name with AGAS
1113
        hpx::id_type id = f.get();
63✔
1114
        agas::register_name(launch::sync, fullname, id);
63✔
1115
        return id;
63✔
1116
    }
63✔
1117

1118
    ///////////////////////////////////////////////////////////////////////////
1119
    hpx::future<hpx::id_type> get_counter_async(
88✔
1120
        counter_info const& info, error_code& ec)
1121
    {
1122
        typedef hpx::future<hpx::id_type> result_type;
1123

1124
        // complement counter info data
1125
        counter_info complemented_info = info;
88✔
1126
        complement_counter_info(complemented_info, ec);
88✔
1127
        if (ec)
88✔
1128
            return result_type();
×
1129

1130
        ensure_counter_prefix(complemented_info.fullname_);
88✔
1131
        // pre-pend prefix, if necessary
1132

1133
        // ask AGAS for the id of the given counter
1134
        hpx::id_type id =
1135
            agas::resolve_name(launch::sync, complemented_info.fullname_, ec);
88✔
1136
        if (id == hpx::invalid_id)
88✔
1137
        {
1138
            try
1139
            {
1140
                // figure out target locality
1141
                counter_path_elements p;
63✔
1142
                get_counter_path_elements(complemented_info.fullname_, p, ec);
63✔
1143
                if (ec)
63✔
1144
                    return result_type();
×
1145

1146
                // Take target locality from base counter if if this is an
1147
                // aggregating counter (the instance name is a base counter).
1148
                if (p.parentinstance_is_basename_)
63✔
1149
                {
1150
                    get_counter_path_elements(p.parentinstancename_, p, ec);
1✔
1151
                    if (ec)
1✔
1152
                        return result_type();
×
1153
                }
1✔
1154

1155
                if (p.parentinstancename_ == "locality" &&
125✔
1156
                    (p.parentinstanceindex_ < 0 ||
62✔
1157
                        p.parentinstanceindex_ >=
62✔
1158
                            static_cast<std::int32_t>(
62✔
1159
                                get_num_localities(hpx::launch::sync))))
62✔
1160
                {
1161
                    HPX_THROWS_IF(ec, hpx::error::bad_parameter, "get_counter",
×
1162
                        "attempt to create counter on non-existing locality");
1163
                    return result_type();
×
1164
                }
1165

1166
                // use the runtime_support component of the target locality to
1167
                // create the new performance counter
1168
                hpx::future<hpx::id_type> f;
63✔
1169
                if (p.parentinstanceindex_ >= 0)
63✔
1170
                {
1171
                    f = create_performance_counter_async(
62✔
1172
                        naming::get_id_from_locality_id(
62✔
1173
                            static_cast<std::uint32_t>(p.parentinstanceindex_)),
62✔
1174
                        complemented_info);
1175
                }
62✔
1176
                else
1177
                {
1178
                    f = create_performance_counter_async(
1✔
1179
                        naming::get_id_from_locality_id(
1✔
1180
                            agas::get_locality_id()),
1✔
1181
                        complemented_info);
1182
                }
1183

1184
                // attach the function which registers the id_type with AGAS
1185
                return f.then(hpx::launch::sync,
63✔
1186
                    hpx::bind_front(
63✔
1187
                        &register_with_agas, complemented_info.fullname_));
63✔
1188
            }
63✔
1189
            catch (hpx::exception const& e)
1190
            {
1191
                if (&ec == &throws)
×
1192
                    throw;
×
1193
                ec = make_error_code(e.get_error(), e.what());
×
1194
                LPCS_(warning).format("failed to create counter {} ({})",
×
1195
                    remove_counter_prefix(complemented_info.fullname_),
×
1196
                    e.what());
×
1197
                return hpx::future<hpx::id_type>();
×
1198
            }
×
1199
        }
×
1200
        if (ec)
25✔
1201
            return result_type();
×
1202

1203
        return hpx::make_ready_future(id);
25✔
1204
    }
88✔
1205

1206
    hpx::future<hpx::id_type> get_counter_async(
88✔
1207
        std::string name, error_code& ec)
1208
    {
1209
        ensure_counter_prefix(name);    // prepend prefix, if necessary
88✔
1210

1211
        counter_info info(name);    // set full counter name
88✔
1212
        return get_counter_async(info, ec);
88✔
1213
    }
88✔
1214

1215
    ///////////////////////////////////////////////////////////////////////////
1216
    void counter_value::serialize(
8✔
1217
        serialization::output_archive& ar, unsigned int const)
1218
    {
1219
        // clang-format off
1220
        ar & status_ & time_ & count_ & value_ & scaling_ & scale_inverse_;
8✔
1221
        // clang-format on
1222
    }
8✔
1223

1224
    void counter_value::serialize(
4✔
1225
        serialization::input_archive& ar, unsigned int const)
1226
    {
1227
        // clang-format off
1228
        ar & status_ & time_ & count_ & value_ & scaling_ & scale_inverse_;
4✔
1229
        // clang-format on
1230
    }
4✔
1231

1232
    void counter_values_array::serialize(
×
1233
        serialization::output_archive& ar, unsigned int const)
1234
    {
1235
        // clang-format off
1236
        ar & status_ & time_ & count_ & values_ & scaling_ & scale_inverse_;
×
1237
        // clang-format on
1238
    }
×
1239

1240
    void counter_values_array::serialize(
×
1241
        serialization::input_archive& ar, unsigned int const)
1242
    {
1243
        // clang-format off
1244
        ar & status_ & time_ & count_ & values_ & scaling_ & scale_inverse_;
×
1245
        // clang-format on
1246
    }
×
1247

1248
    ///////////////////////////////////////////////////////////////////////////
1249
    void counter_type_path_elements::serialize(
×
1250
        serialization::output_archive& ar, unsigned int const)
1251
    {
1252
        // clang-format off
1253
        ar & objectname_ & countername_ & parameters_;
×
1254
        // clang-format on
1255
    }
×
1256

1257
    void counter_type_path_elements::serialize(
×
1258
        serialization::input_archive& ar, unsigned int const)
1259
    {
1260
        // clang-format off
1261
        ar & objectname_ & countername_ & parameters_;
×
1262
        // clang-format on
1263
    }
×
1264

1265
    ///////////////////////////////////////////////////////////////////////////
1266
    void counter_path_elements::serialize(
×
1267
        serialization::output_archive& ar, unsigned int const)
1268
    {
1269
        typedef counter_type_path_elements base_type;
1270
        hpx::serialization::base_object_type<counter_path_elements, base_type>
1271
            base = hpx::serialization::base_object<base_type>(*this);
×
1272

1273
        // clang-format off
1274
        ar & base & parentinstancename_ & instancename_ & subinstancename_ &
×
1275
            parentinstanceindex_ & instanceindex_ & subinstanceindex_ &
×
1276
            parentinstance_is_basename_;
×
1277
        // clang-format on
1278
    }
×
1279

1280
    void counter_path_elements::serialize(
×
1281
        serialization::input_archive& ar, unsigned int const)
1282
    {
1283
        typedef counter_type_path_elements base_type;
1284
        hpx::serialization::base_object_type<counter_path_elements, base_type>
1285
            base = hpx::serialization::base_object<base_type>(*this);
×
1286

1287
        // clang-format off
1288
        ar & base & parentinstancename_ & instancename_ & subinstancename_ &
×
1289
            parentinstanceindex_ & instanceindex_ & subinstanceindex_ &
×
1290
            parentinstance_is_basename_;
×
1291
        // clang-format on
1292
    }
×
1293

1294
    ///////////////////////////////////////////////////////////////////////////
1295
    void counter_info::serialize(
2✔
1296
        serialization::output_archive& ar, unsigned int const)
1297
    {
1298
        // clang-format off
1299
        ar & type_ & version_ & status_ & fullname_ & helptext_ &
4✔
1300
            unit_of_measure_;
2✔
1301
        // clang-format on
1302
    }
2✔
1303

1304
    void counter_info::serialize(
1✔
1305
        serialization::input_archive& ar, unsigned int const)
1306
    {
1307
        // clang-format off
1308
        ar & type_ & version_ & status_ & fullname_ & helptext_ &
2✔
1309
            unit_of_measure_;
1✔
1310
        // clang-format on
1311
    }
1✔
1312
}}    // 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