• 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.57
/libs/full/performance_counters/src/server/raw_values_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_values_counter.hpp>
14
#include <hpx/runtime_components/derived_component_factory.hpp>
15

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

20
///////////////////////////////////////////////////////////////////////////////
21
using raw_values_counter_type = hpx::components::component<
22
    hpx::performance_counters::server::raw_values_counter>;
23

24
HPX_REGISTER_DERIVED_COMPONENT_FACTORY(raw_values_counter_type,
25
    raw_values_counter, "base_performance_counter",
×
26
    hpx::components::factory_state::enabled)
27
HPX_DEFINE_GET_COMPONENT_TYPE(
28
    hpx::performance_counters::server::raw_values_counter)
32✔
29

30
///////////////////////////////////////////////////////////////////////////////
31
namespace hpx::performance_counters::server {
32

33
    raw_values_counter::raw_values_counter()
34
      : reset_(false)
×
35
    {
×
36
    }
37

×
38
    raw_values_counter::raw_values_counter(counter_info const& info,
39
        hpx::function<std::vector<std::int64_t>(bool)> f)
×
40
      : base_type_holder(info)
×
41
      , f_(HPX_MOVE(f))
42
      , reset_(false)
43
    {
×
44
        if (info.type_ != counter_type::histogram &&
45
            info.type_ != counter_type::raw_values)
×
46
        {
47
            HPX_THROW_EXCEPTION(hpx::error::bad_parameter,
48
                "raw_values_counter::raw_values_counter",
×
49
                "unexpected counter type specified for raw_values_counter "
50
                "should be counter_type::histogram or "
51
                "counter_type::raw_values");
52
        }
53
    }
54

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

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

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

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