ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthAllocators
src
ArenaAllocatorBase.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// $Id: ArenaAllocatorBase.cxx 470529 2011-11-24 23:54:22Z ssnyder $
13
14
#include "
AthAllocators/ArenaAllocatorBase.h
"
15
#include <ostream>
16
#include <iomanip>
17
18
19
namespace
SG
{
20
21
25
ArenaAllocatorBase::Stats::Stat::Stat
()
26
:
inuse
(0),
27
free
(0),
28
total
(0)
29
{
30
}
31
32
36
void
ArenaAllocatorBase::Stats::Stat::clear
()
37
{
38
inuse
=
free
=
total
= 0;
39
}
40
41
46
ArenaAllocatorBase::Stats::Stat
&
47
ArenaAllocatorBase::Stats::Stat::operator+=
(
const
Stat
& other)
48
{
49
inuse
+= other.inuse;
50
free
+= other.free;
51
total
+= other.total;
52
return
*
this
;
53
}
54
55
56
/* (hide from doxygen)
57
* @brief Format a statistic structure.
58
* @param os The stream to which to write.
59
* @param stat The statistic structure to write.
60
*/
61
std::ostream&
operator<<
(std::ostream& os,
62
const
ArenaAllocatorBase::Stats::Stat
& stat)
63
{
64
os << std::setw(7) << stat.inuse <<
"/"
65
<< std::setw(7) << stat.free <<
"/"
66
<< std::setw(7) << stat.total;
67
return
os;
68
}
69
70
71
//===========================================================================
72
73
77
void
ArenaAllocatorBase::Stats::clear
()
78
{
79
elts
.clear();
80
bytes
.clear();
81
blocks
.clear();
82
}
83
84
89
ArenaAllocatorBase::Stats
&
90
ArenaAllocatorBase::Stats::operator+=
(
const
Stats
& other)
91
{
92
elts
+= other.elts;
93
bytes
+= other.bytes;
94
blocks
+= other.blocks;
95
return
*
this
;
96
}
97
98
99
/* (hide from doxygen)
100
* @brief Format a complete statistics structure.
101
* @param os The stream to which to write.
102
* @param stats The statistics structure to write.
103
*/
104
std::ostream&
operator<<
(std::ostream& os,
105
const
ArenaAllocatorBase::Stats
&
stats
)
106
{
107
os <<
stats
.
elts
<<
" "
<<
stats
.
bytes
<<
" "
<<
stats
.
blocks
;
108
return
os;
109
}
110
111
116
void
ArenaAllocatorBase::Stats::header
(std::ostream& os)
117
{
118
os <<
"Elts InUse/Free/Total"
119
<<
" Bytes InUse/Free/Total Blocks InUse/Free/Total"
;
120
}
121
122
123
//===========================================================================
124
125
130
void
ArenaAllocatorBase::report
(std::ostream& os)
const
131
{
132
os <<
" "
<<
stats
() <<
" "
<<
name
() << std::endl;
133
}
134
135
136
}
// namespace SG
ArenaAllocatorBase.h
Common base class for arena allocator classes. See Arena.h for an overview of the arena-based memory ...
SG::ArenaAllocatorBase::name
virtual const std::string & name() const =0
Return the name of this allocator.
SG::ArenaAllocatorBase::report
virtual void report(std::ostream &os) const
Generate a report on the memory usage of this allocator.
Definition
ArenaAllocatorBase.cxx:130
SG::ArenaAllocatorBase::stats
virtual Stats stats() const =0
Return the statistics block for this allocator.
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
SG::operator<<
std::ostream & operator<<(std::ostream &os, const ArenaAllocatorBase::Stats::Stat &stat)
Format a statistic structure.
Definition
ArenaAllocatorBase.cxx:61
SG::ArenaAllocatorBase::Stats::Stat
A single statistic.
Definition
ArenaAllocatorBase.h:193
SG::ArenaAllocatorBase::Stats::Stat::operator+=
Stat & operator+=(const Stat &other)
Accumulate.
Definition
ArenaAllocatorBase.cxx:47
SG::ArenaAllocatorBase::Stats::Stat::clear
void clear()
Reset to zero.
Definition
ArenaAllocatorBase.cxx:36
SG::ArenaAllocatorBase::Stats::Stat::free
size_t free
Number of items currently not allocated by the application but cached by the allocator.
Definition
ArenaAllocatorBase.h:205
SG::ArenaAllocatorBase::Stats::Stat::Stat
Stat()
Default constructor.
Definition
ArenaAllocatorBase.cxx:25
SG::ArenaAllocatorBase::Stats::Stat::inuse
size_t inuse
Number of items currently allocated by the application.
Definition
ArenaAllocatorBase.h:202
SG::ArenaAllocatorBase::Stats::Stat::total
size_t total
Total number of items held by the allocator.
Definition
ArenaAllocatorBase.h:207
SG::ArenaAllocatorBase::Stats
Statistics for an allocator.
Definition
ArenaAllocatorBase.h:188
SG::ArenaAllocatorBase::Stats::blocks
Stat blocks
Counts of blocks.
Definition
ArenaAllocatorBase.h:217
SG::ArenaAllocatorBase::Stats::Stats
Stats()=default
SG::ArenaAllocatorBase::Stats::clear
void clear()
Reset to zero.
Definition
ArenaAllocatorBase.cxx:77
SG::ArenaAllocatorBase::Stats::elts
Stat elts
Counts of elements.
Definition
ArenaAllocatorBase.h:219
SG::ArenaAllocatorBase::Stats::header
static void header(std::ostream &os)
Print report header.
Definition
ArenaAllocatorBase.cxx:116
SG::ArenaAllocatorBase::Stats::operator+=
Stats & operator+=(const Stats &other)
Accumulate.
Definition
ArenaAllocatorBase.cxx:90
SG::ArenaAllocatorBase::Stats::bytes
Stat bytes
Counts of bytes.
Definition
ArenaAllocatorBase.h:221
Generated on
for ATLAS Offline Software by
1.17.0