• 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

0.0
/libs/full/performance_counters/src/agas_namespace_action_code.cpp
1
//  Copyright (c) 2012-2021 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/modules/errors.hpp>
8
#include <hpx/performance_counters/agas_namespace_action_code.hpp>
9
#include <hpx/performance_counters/counters.hpp>
10

11
#include <cstddef>
12
#include <string>
13

14
namespace hpx::agas::detail {
15

16
    // get action code from counter type
17
    namespace_action_code retrieve_action_code(
×
18
        std::string const& name, error_code& ec)
19
    {
20
        performance_counters::counter_path_elements p;
21
        performance_counters::get_counter_path_elements(name, p, ec);
×
22
        if (ec)
×
23
            return invalid_request;
24

25
        if (p.objectname_ != "agas")
×
26
        {
27
            HPX_THROWS_IF(ec, hpx::error::bad_parameter, "retrieve_action_code",
×
28
                "unknown performance counter (unrelated to AGAS)");
29
            return invalid_request;
×
30
        }
31

32
        // component_ns
33
        for (auto const& component_namespace_service :
×
34
            component_namespace_services)
×
35
        {
36
            if (p.countername_ == component_namespace_service.name_)
×
37
                return component_namespace_service.code_;
×
38
        }
39

40
        // locality_ns
41
        for (auto const& locality_namespace_service :
×
42
            locality_namespace_services)
×
43
        {
44
            if (p.countername_ == locality_namespace_service.name_)
×
45
                return locality_namespace_service.code_;
×
46
        }
47

48
        // primary_ns
49
        for (auto const& primary_namespace_service : primary_namespace_services)
×
50
        {
51
            if (p.countername_ == primary_namespace_service.name_)
×
52
                return primary_namespace_service.code_;
×
53
        }
54

55
        // symbol_ns
56
        for (auto const& symbol_namespace_service : symbol_namespace_services)
×
57
        {
58
            if (p.countername_ == symbol_namespace_service.name_)
×
59
                return symbol_namespace_service.code_;
×
60
        }
61

62
        HPX_THROWS_IF(ec, hpx::error::bad_parameter, "retrieve_action_code",
×
63
            "unknown performance counter (unrelated to AGAS)");
64
        return invalid_request;
×
65
    }
×
66

67
    // get service action code from counter type
68
    namespace_action_code retrieve_action_service_code(
×
69
        std::string const& name, error_code& ec)
70
    {
71
        performance_counters::counter_path_elements p;
72
        performance_counters::get_counter_path_elements(name, p, ec);
×
73
        if (ec)
×
74
            return invalid_request;
75

76
        if (p.objectname_ != "agas")
×
77
        {
78
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
79
                "retrieve_action_service_code",
80
                "unknown performance counter (unrelated to AGAS)");
81
            return invalid_request;
×
82
        }
83

84
        // component_ns
85
        for (auto const& component_namespace_service :
×
86
            component_namespace_services)
×
87
        {
88
            if (p.countername_ == component_namespace_service.name_)
×
89
                return component_namespace_service.service_code_;
×
90
        }
91

92
        // locality_ns
93
        for (auto const& locality_namespace_service :
×
94
            locality_namespace_services)
×
95
        {
96
            if (p.countername_ == locality_namespace_service.name_)
×
97
                return locality_namespace_service.service_code_;
×
98
        }
99

100
        // primary_ns
101
        for (auto const& primary_namespace_service : primary_namespace_services)
×
102
        {
103
            if (p.countername_ == primary_namespace_service.name_)
×
104
                return primary_namespace_service.service_code_;
×
105
        }
106

107
        // symbol_ns
108
        for (auto const& symbol_namespace_service : symbol_namespace_services)
×
109
        {
110
            if (p.countername_ == symbol_namespace_service.name_)
×
111
                return symbol_namespace_service.service_code_;
×
112
        }
113

114
        HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
115
            "retrieve_action_service_code",
116
            "unknown performance counter (unrelated to AGAS)");
117
        return invalid_request;
×
118
    }
×
119
}    // namespace hpx::agas::detail
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