ATLAS Offline Software
Loading...
Searching...
No Matches
AthDevice::MonitoredMemoryResourceTool Class Reference

Tool providing monitoring functionality for memory resources. More...

#include <MonitoredMemoryResourceTool.h>

Inheritance diagram for AthDevice::MonitoredMemoryResourceTool:
Collaboration diagram for AthDevice::MonitoredMemoryResourceTool:

Public Member Functions

Function(s) inherited from @c AthAlgTool
virtual StatusCode initialize () override
 Initialize the tool.
Function(s) inherited from @c AthDevice::IMemoryResourceTool
virtual std::pmr::memory_resource & mr () const override
 Get the provided std::pmr::memory_resource object.
virtual std::string_view deviceName () const override
 The name of the device for which the memory resource is provided.

Private Attributes

std::unique_ptr< std::pmr::memory_resource > m_mr
 The memory resource that this tool uses.
Tool properties
ToolHandle< IMemoryResourceTool > m_mrTool
 Underlying memory resource to use for allocations.
ServiceHandle< IMemoryMonitorSvc > m_monitorSvc
 Service collecting the memory monitoring information.

Detailed Description

Tool providing monitoring functionality for memory resources.

Making use of AthDevice::MonitoredMemoryResource, which would in turn provide monitoring information to AthDevice::IMemoryMonitorSvc.

Definition at line 22 of file MonitoredMemoryResourceTool.h.

Member Function Documentation

◆ deviceName()

std::string_view AthDevice::MonitoredMemoryResourceTool::deviceName ( ) const
overridevirtual

The name of the device for which the memory resource is provided.

Definition at line 45 of file MonitoredMemoryResourceTool.cxx.

45 {
46
47 assert(m_mrTool.isValid());
48 return m_mrTool->deviceName();
49}
ToolHandle< IMemoryResourceTool > m_mrTool
Underlying memory resource to use for allocations.

◆ initialize()

StatusCode AthDevice::MonitoredMemoryResourceTool::initialize ( )
overridevirtual

Initialize the tool.

Definition at line 12 of file MonitoredMemoryResourceTool.cxx.

12 {
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x,...)
ServiceHandle< IMemoryMonitorSvc > m_monitorSvc
Service collecting the memory monitoring information.
std::unique_ptr< std::pmr::memory_resource > m_mr
The memory resource that this tool uses.

◆ mr()

std::pmr::memory_resource & AthDevice::MonitoredMemoryResourceTool::mr ( ) const
overridevirtual

Get the provided std::pmr::memory_resource object.

Definition at line 39 of file MonitoredMemoryResourceTool.cxx.

39 {
40
41 assert(m_mr);
42 return *m_mr;
43}

Member Data Documentation

◆ m_monitorSvc

ServiceHandle<IMemoryMonitorSvc> AthDevice::MonitoredMemoryResourceTool::m_monitorSvc
private
Initial value:
{
this, "MonitorSvc", "AthDevice::MemoryMonitorSvc",
"Memory monitor service to collect the monitoring information"}

Service collecting the memory monitoring information.

Definition at line 60 of file MonitoredMemoryResourceTool.h.

60 {
61 this, "MonitorSvc", "AthDevice::MemoryMonitorSvc",
62 "Memory monitor service to collect the monitoring information"};

◆ m_mr

std::unique_ptr<std::pmr::memory_resource> AthDevice::MonitoredMemoryResourceTool::m_mr
private

The memory resource that this tool uses.

Definition at line 50 of file MonitoredMemoryResourceTool.h.

◆ m_mrTool

ToolHandle<IMemoryResourceTool> AthDevice::MonitoredMemoryResourceTool::m_mrTool
private
Initial value:
{
this, "MRTool", "", "Memory resource tool to use for allocations"}

Underlying memory resource to use for allocations.

Definition at line 56 of file MonitoredMemoryResourceTool.h.

56 {
57 this, "MRTool", "", "Memory resource tool to use for allocations"};

The documentation for this class was generated from the following files: