ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthDevice
AthDeviceComps
src
MonitoredMemoryResource.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
//
4
#ifndef ATHDEVICECOMPS_MONITOREDMEMORYRESOURCE_H
5
#define ATHDEVICECOMPS_MONITOREDMEMORYRESOURCE_H
6
7
// AthDevice include(s).
8
#include "
AthDeviceInterfaces/IMemoryMonitorSvc.h
"
9
10
// System include(s).
11
#include <functional>
12
#include <memory_resource>
13
14
namespace
AthDevice
{
15
22
class
MonitoredMemoryResource
:
public
std::pmr::memory_resource {
23
24
public
:
26
MonitoredMemoryResource
(std::pmr::memory_resource& upstream,
27
IMemoryMonitorSvc
& svc,
const
std::string& component,
28
const
std::string& device);
30
virtual
~MonitoredMemoryResource
();
31
32
private
:
35
37
virtual
void
*
do_allocate
(std::size_t bytes, std::size_t alignment)
override
;
38
40
virtual
void
do_deallocate
(
void
* p, std::size_t bytes,
41
std::size_t alignment)
override
;
42
44
virtual
bool
do_is_equal
(
45
const
std::pmr::memory_resource& other)
const
noexcept
override
;
46
48
51
53
std::reference_wrapper<std::pmr::memory_resource>
m_upstream
;
55
std::reference_wrapper<IMemoryMonitorSvc>
m_svc
;
57
std::string
m_component
;
59
std::string
m_device
;
60
62
63
};
// class MonitoredMemoryResource
64
65
}
// namespace AthDevice
66
67
#endif
// ATHDEVICECOMPS_MONITOREDMEMORYRESOURCE_H
IMemoryMonitorSvc.h
AthDevice::IMemoryMonitorSvc
Interface to a service that provides "device memory monitoring".
Definition
IMemoryMonitorSvc.h:20
AthDevice::MonitoredMemoryResource::~MonitoredMemoryResource
virtual ~MonitoredMemoryResource()
Destructor.
AthDevice::MonitoredMemoryResource::do_allocate
virtual void * do_allocate(std::size_t bytes, std::size_t alignment) override
Allocate memory from the resource.
Definition
MonitoredMemoryResource.cxx:20
AthDevice::MonitoredMemoryResource::m_upstream
std::reference_wrapper< std::pmr::memory_resource > m_upstream
The upstream memory resource to which the allocations are forwarded.
Definition
MonitoredMemoryResource.h:53
AthDevice::MonitoredMemoryResource::m_device
std::string m_device
The name of the device for which the memory resource is provided.
Definition
MonitoredMemoryResource.h:59
AthDevice::MonitoredMemoryResource::do_is_equal
virtual bool do_is_equal(const std::pmr::memory_resource &other) const noexcept override
Check if the resource is equal to another resource.
Definition
MonitoredMemoryResource.cxx:43
AthDevice::MonitoredMemoryResource::m_svc
std::reference_wrapper< IMemoryMonitorSvc > m_svc
The service used to monitor the memory allocations/deallocations.
Definition
MonitoredMemoryResource.h:55
AthDevice::MonitoredMemoryResource::m_component
std::string m_component
The name of the component that is using this memory resource.
Definition
MonitoredMemoryResource.h:57
AthDevice::MonitoredMemoryResource::do_deallocate
virtual void do_deallocate(void *p, std::size_t bytes, std::size_t alignment) override
Deallocate memory from the resource.
Definition
MonitoredMemoryResource.cxx:33
AthDevice::MonitoredMemoryResource::MonitoredMemoryResource
MonitoredMemoryResource(std::pmr::memory_resource &upstream, IMemoryMonitorSvc &svc, const std::string &component, const std::string &device)
Constructor.
Definition
MonitoredMemoryResource.cxx:10
AthDevice
Definition
BinaryPageMemoryResourceSvc.cxx:15
Generated on
for ATLAS Offline Software by
1.17.0