• 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

90.0
/components/performance_counters/memory_counters/src/memory.cpp
1
//  Copyright (c) 2012 Vinay C Amatya
2
//  Copyright (c) 2007-2017 Hartmut Kaiser
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/components_base/component_startup_shutdown.hpp>
10
#include <hpx/modules/functional.hpp>
11
#include <hpx/modules/runtime_configuration.hpp>
12
#include <hpx/modules/runtime_local.hpp>
13
#include <hpx/performance_counters/manage_counter_type.hpp>
14

15
#include <hpx/components/performance_counters/memory_counters/mem_counter.hpp>
16

17
///////////////////////////////////////////////////////////////////////////////
18
// Add factory registration functionality, We register the module dynamically
19
// as no executable links against it.
20
HPX_REGISTER_COMPONENT_MODULE_DYNAMIC()
×
21

22
///////////////////////////////////////////////////////////////////////////////
23
namespace hpx { namespace performance_counters { namespace memory {
24
    void register_counter_types()
32✔
25
    {
26
        namespace pc = hpx::performance_counters;
27
        pc::install_counter_type("/runtime/memory/virtual", &read_psm_virtual,
64✔
28
            "returns the amount of virtual memory currently allocated by the "
29
            "referenced locality",
30
            "bytes", pc::counter_type::raw);
31
        pc::install_counter_type("/runtime/memory/resident", &read_psm_resident,
64✔
32
            "returns the amount of resident memory currently allocated by the "
33
            "referenced locality",
34
            "bytes", pc::counter_type::raw);
35
#if defined(__linux) || defined(linux) || defined(linux__) ||                  \
36
    defined(__linux__) || defined(HPX_WINDOWS)
37
        // this counter is currently supported on Linux only
38
        pc::install_counter_type("/runtime/memory/total", &read_total_mem_avail,
64✔
39
            "returns the total available memory on the node", "kB",
40
            pc::counter_type::raw);
41
#endif
42
    }
32✔
43

44
    ///////////////////////////////////////////////////////////////////////////
45
    bool get_startup(
32✔
46
        hpx::startup_function_type& startup_func, bool& pre_startup)
47
    {
48
        // return our startup-function
49
        startup_func =
50
            register_counter_types;    // function to run during startup
51
        pre_startup =
32✔
52
            true;    // run 'register_counter_types' as pre-startup function
53
        return true;
32✔
54
    }
55
}}}    // namespace hpx::performance_counters::memory
56

57
///////////////////////////////////////////////////////////////////////////////
58
// Register a startup function which will be called as a HPX-thread during
59
// runtime startup. We use this function to register our performance counter
60
// type and performance counter instances.
61
//
62
// Note that this macro can be used not more than once in one module.
63
HPX_REGISTER_STARTUP_MODULE_DYNAMIC(
64✔
64
    hpx::performance_counters::memory::get_startup)
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