• 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

3.45
/libs/full/performance_counters/src/server/raw_counter.cpp
1
//  Copyright (c) 2007-2025 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
#include <hpx/async_distributed/continuation.hpp>
9
#include <hpx/modules/errors.hpp>
10
#include <hpx/modules/functional.hpp>
11
#include <hpx/modules/runtime_local.hpp>
12
#include <hpx/performance_counters/counters.hpp>
13
#include <hpx/performance_counters/server/raw_counter.hpp>
14
#include <hpx/runtime_components/derived_component_factory.hpp>
15

16
#include <cstdint>
17
#include <utility>
18

19
///////////////////////////////////////////////////////////////////////////////
20
using raw_counter_type =
21
    hpx::components::component<hpx::performance_counters::server::raw_counter>;
22

23
HPX_REGISTER_DERIVED_COMPONENT_FACTORY(raw_counter_type, raw_counter,
24
    "base_performance_counter", hpx::components::factory_state::enabled)
×
25
HPX_DEFINE_GET_COMPONENT_TYPE(hpx::performance_counters::server::raw_counter)
26

32✔
27
///////////////////////////////////////////////////////////////////////////////
28
namespace hpx::performance_counters::server {
29

30
    raw_counter::raw_counter()
31
      : reset_(false)
×
32
    {
×
33
    }
34

×
35
    raw_counter::raw_counter(
36
        counter_info const& info, hpx::function<std::int64_t(bool)> f)
×
37
      : base_type_holder(info)
×
38
      , f_(HPX_MOVE(f))
39
      , reset_(false)
40
    {
×
41
        if (info.type_ != counter_type::raw &&
42
            info.type_ != counter_type::elapsed_time &&
×
43
            info.type_ != counter_type::aggregating &&
×
44
            info.type_ != counter_type::monotonically_increasing &&
×
45
            info.type_ != counter_type::average_count &&
×
46
            info.type_ != counter_type::average_timer)
×
47
        {
48
            HPX_THROW_EXCEPTION(hpx::error::bad_parameter,
49
                "raw_counter::raw_counter",
×
50
                "unexpected counter type specified for raw_counter");
51
        }
52
    }
53

×
54
    hpx::performance_counters::counter_value raw_counter::get_counter_value(
55
        bool reset)
×
56
    {
57
        hpx::performance_counters::counter_value value;
58
        value.value_ = f_(reset);    // gather the current value
59
        reset_ = false;
×
60
        value.scaling_ = 1;
×
61
        value.scale_inverse_ = false;
62
        value.status_ = counter_status::new_data;
63
        value.time_ = static_cast<std::int64_t>(hpx::get_system_uptime());
64
        value.count_ = ++invocation_count_;
×
65
        return value;
×
66
    }
×
67

68
    void raw_counter::reset_counter_value()
69
    {
×
70
        [[maybe_unused]] auto _ = f_(true);
71
    }
×
72

×
73
    void raw_counter::finalize()
74
    {
×
75
        base_performance_counter::finalize();
76
        base_type::finalize();
77
    }
78

×
79
    naming::address raw_counter::get_current_address() const
80
    {
×
81
        return naming::address(
82
            naming::get_gid_from_locality_id(agas::get_locality_id()),
83
            components::get_component_type<raw_counter>(),
×
84
            const_cast<raw_counter*>(this));
85
    }
×
86
}    // namespace hpx::performance_counters::server
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