ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthDevice
AthDeviceComps
src
MonitoredMemoryResourceTool.cxx
Go to the documentation of this file.
1
//
2
// Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
//
4
5
// Local include(s).
6
#include "
MonitoredMemoryResourceTool.h
"
7
8
#include "
MonitoredMemoryResource.h
"
9
10
namespace
AthDevice
{
11
12
StatusCode
MonitoredMemoryResourceTool::initialize
() {
13
14
// Retrieve the upstream tool.
15
ATH_CHECK
(
m_mrTool
.retrieve());
16
17
// Retrieve the monitoring service.
18
ATH_CHECK
(
m_monitorSvc
.retrieve());
19
20
// Get the name of the tool's parent.
21
std::string component;
22
const
INamedInterface* parent =
23
dynamic_cast<
const
INamedInterface*
>
(this->parent());
24
if
(parent) {
25
component = parent->name();
26
}
else
{
27
ATH_MSG_WARNING
(
"Could not retrieve the name of the parent component"
);
28
component =
"Unknown"
;
29
}
30
31
// Construct the monitored resource.
32
m_mr
= std::make_unique<MonitoredMemoryResource>(
33
m_mrTool
->mr(), *
m_monitorSvc
, component, std::string{deviceName()});
34
35
// Return gracefully.
36
return
StatusCode::SUCCESS;
37
}
38
39
std::pmr::memory_resource&
MonitoredMemoryResourceTool::mr
()
const
{
40
41
assert(
m_mr
);
42
return
*
m_mr
;
43
}
44
45
std::string_view
MonitoredMemoryResourceTool::deviceName
()
const
{
46
47
assert(
m_mrTool
.isValid());
48
return
m_mrTool
->deviceName();
49
}
50
51
}
// namespace AthDevice
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
MonitoredMemoryResourceTool.h
MonitoredMemoryResource.h
AthDevice::MonitoredMemoryResourceTool::m_monitorSvc
ServiceHandle< IMemoryMonitorSvc > m_monitorSvc
Service collecting the memory monitoring information.
Definition
MonitoredMemoryResourceTool.h:60
AthDevice::MonitoredMemoryResourceTool::initialize
virtual StatusCode initialize() override
Initialize the tool.
Definition
MonitoredMemoryResourceTool.cxx:12
AthDevice::MonitoredMemoryResourceTool::m_mr
std::unique_ptr< std::pmr::memory_resource > m_mr
The memory resource that this tool uses.
Definition
MonitoredMemoryResourceTool.h:50
AthDevice::MonitoredMemoryResourceTool::m_mrTool
ToolHandle< IMemoryResourceTool > m_mrTool
Underlying memory resource to use for allocations.
Definition
MonitoredMemoryResourceTool.h:56
AthDevice::MonitoredMemoryResourceTool::mr
virtual std::pmr::memory_resource & mr() const override
Get the provided std::pmr::memory_resource object.
Definition
MonitoredMemoryResourceTool.cxx:39
AthDevice::MonitoredMemoryResourceTool::deviceName
virtual std::string_view deviceName() const override
The name of the device for which the memory resource is provided.
Definition
MonitoredMemoryResourceTool.cxx:45
AthDevice
Definition
BinaryPageMemoryResourceSvc.cxx:15
Generated on
for ATLAS Offline Software by
1.17.0