ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
PerfMon::MallocStats Class Reference

Access to some useful malloc statistics. More...

#include <MallocStats.h>

Collaboration diagram for PerfMon::MallocStats:

Public Types

typedef int return_type
 

Public Member Functions

 MallocStats ()
 c-tor More...
 
void refresh ()
 update cached informations about ,alloc statistics More...
 
return_type from_system_nmmap ()
 Returns number of bytes allocated from system not including mmapped regions. More...
 
return_type free_chunks ()
 Returns number of free chunks. More...
 
return_type used ()
 Number of bytes allocated and in use. More...
 
return_type not_used ()
 Number of bytes allocated but not in use. More...
 
return_type releasable ()
 Top-most, releasable (via malloc_trim) space (bytes) More...
 
return_type max_allocated ()
 Maximum total allocated space (bytes) (always 0 ?) More...
 
return_type fastbin_blocks ()
 Number of fastbin blocks. More...
 
return_type fastbin_free ()
 Space available in freed fastbin blocks (bytes) More...
 
return_type from_system_mmap ()
 Returns number of bytes allocated from system using mmap. More...
 
return_type mmap_chunks ()
 Number of chunks allocated via mmap() More...
 
return_type from_system_total ()
 Returns total number of bytes allocated from system including mmapped regions. More...
 
std::string repr ()
 display malloc stats More...
 
void dump (std::ostream &out=std::cout)
 display malloc stats on std::cout More...
 

Private Attributes

PerfMon::mallinfo_t m_infos
 

Detailed Description

Access to some useful malloc statistics.

malloc is default C++ allocator

Definition at line 26 of file MallocStats.h.

Member Typedef Documentation

◆ return_type

Definition at line 36 of file MallocStats.h.

Constructor & Destructor Documentation

◆ MallocStats()

PerfMon::MallocStats::MallocStats ( )

c-tor

Definition at line 26 of file MallocStats.cxx.

26  :
28 {}

Member Function Documentation

◆ dump()

void PerfMon::MallocStats::dump ( std::ostream &  out = std::cout)

display malloc stats on std::cout

Definition at line 70 of file MallocStats.cxx.

71 {
72  out << repr();
73 }

◆ fastbin_blocks()

return_type PerfMon::MallocStats::fastbin_blocks ( )
inline

Number of fastbin blocks.

Definition at line 86 of file MallocStats.h.

87  {
88  refresh();
89  return m_infos.smblks;
90  }

◆ fastbin_free()

return_type PerfMon::MallocStats::fastbin_free ( )
inline

Space available in freed fastbin blocks (bytes)

Definition at line 93 of file MallocStats.h.

94  {
95  refresh();
96  return m_infos.fsmblks;
97  }

◆ free_chunks()

return_type PerfMon::MallocStats::free_chunks ( )
inline

Returns number of free chunks.

Definition at line 51 of file MallocStats.h.

52  {
53  refresh();
54  return m_infos.ordblks;
55  }

◆ from_system_mmap()

return_type PerfMon::MallocStats::from_system_mmap ( )
inline

Returns number of bytes allocated from system using mmap.

Definition at line 100 of file MallocStats.h.

101  {
102  refresh();
103  return m_infos.hblkhd;
104  }

◆ from_system_nmmap()

return_type PerfMon::MallocStats::from_system_nmmap ( )
inline

Returns number of bytes allocated from system not including mmapped regions.

Definition at line 44 of file MallocStats.h.

45  {
46  refresh();
47  return m_infos.arena;
48  }

◆ from_system_total()

return_type PerfMon::MallocStats::from_system_total ( )
inline

Returns total number of bytes allocated from system including mmapped regions.

Definition at line 116 of file MallocStats.h.

117  {
118  refresh();
119  return from_system_nmmap() + from_system_mmap();
120  }

◆ max_allocated()

return_type PerfMon::MallocStats::max_allocated ( )
inline

Maximum total allocated space (bytes) (always 0 ?)

Definition at line 79 of file MallocStats.h.

80  {
81  refresh();
82  return m_infos.usmblks;
83  }

◆ mmap_chunks()

return_type PerfMon::MallocStats::mmap_chunks ( )
inline

Number of chunks allocated via mmap()

Definition at line 107 of file MallocStats.h.

108  {
109  refresh();
110  return m_infos.hblks;
111  }

◆ not_used()

return_type PerfMon::MallocStats::not_used ( )
inline

Number of bytes allocated but not in use.

Definition at line 65 of file MallocStats.h.

66  {
67  refresh();
68  return m_infos.fordblks;
69  }

◆ refresh()

void PerfMon::MallocStats::refresh ( )
inline

update cached informations about ,alloc statistics

Definition at line 40 of file MallocStats.h.

41  { m_infos = PerfMon::mallinfo(); }

◆ releasable()

return_type PerfMon::MallocStats::releasable ( )
inline

Top-most, releasable (via malloc_trim) space (bytes)

Definition at line 72 of file MallocStats.h.

73  {
74  refresh();
75  return m_infos.keepcost;
76  }

◆ repr()

std::string PerfMon::MallocStats::repr ( )

display malloc stats

Definition at line 37 of file MallocStats.cxx.

38 {
39  std::ostringstream s;
40  s << "MALLOC statistics\n"
41  << "=================================================================\n"
42  << "Space allocated from system not using mmap: "
43  << from_system_nmmap() << " bytes\n"
44  << " number of free chunks : " << free_chunks()
45  << "\n"
46  << " space allocated and in use : " << used()
47  << " bytes\n"
48  << " space allocated but not in use : " << not_used()
49  << " bytes\n"
50  << " top-most, releasable (via malloc_trim) space: " << releasable()
51  << " bytes\n"
52  << " maximum total allocated space (?) : " << max_allocated()
53  << " bytes\n"
54  << " FASTBIN blocks \n"
55  << " number of fastbin blocks: " << fastbin_blocks() << "\n"
56  << " space available in freed fastbin blocks: " << fastbin_free()
57  << " bytes\n"
58  << "Space allocated from system using mmap: " << from_system_mmap()
59  << " bytes\n"
60  << " number of chunks allocated via mmap(): " << mmap_chunks()
61  << "\n"
62  << "Total space allocated from system (mmap and not mmap): "
63  << from_system_total() << " bytes\n"
64  << "=================================================================\n"
65  << std::flush;
66  return s.str();
67 }

◆ used()

return_type PerfMon::MallocStats::used ( )
inline

Number of bytes allocated and in use.

Definition at line 58 of file MallocStats.h.

59  {
60  refresh();
61  return m_infos.uordblks;
62  }

Member Data Documentation

◆ m_infos

PerfMon::mallinfo_t PerfMon::MallocStats::m_infos
private

Definition at line 28 of file MallocStats.h.


The documentation for this class was generated from the following files:
PerfMon::MallocStats::fastbin_free
return_type fastbin_free()
Space available in freed fastbin blocks (bytes)
Definition: MallocStats.h:93
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
PerfMon::MallocStats::max_allocated
return_type max_allocated()
Maximum total allocated space (bytes) (always 0 ?)
Definition: MallocStats.h:79
FullCPAlgorithmsTest_eljob.flush
flush
Definition: FullCPAlgorithmsTest_eljob.py:168
PerfMon::MallocStats::releasable
return_type releasable()
Top-most, releasable (via malloc_trim) space (bytes)
Definition: MallocStats.h:72
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
PerfMon::mallinfo
mallinfo_t mallinfo()
Definition: mallinfo.h:29
PerfMon::MallocStats::not_used
return_type not_used()
Number of bytes allocated but not in use.
Definition: MallocStats.h:65
PerfMon::MallocStats::refresh
void refresh()
update cached informations about ,alloc statistics
Definition: MallocStats.h:40
PerfMon::MallocStats::free_chunks
return_type free_chunks()
Returns number of free chunks.
Definition: MallocStats.h:51
PerfMon::MallocStats::mmap_chunks
return_type mmap_chunks()
Number of chunks allocated via mmap()
Definition: MallocStats.h:107
PerfMon::MallocStats::used
return_type used()
Number of bytes allocated and in use.
Definition: MallocStats.h:58
PerfMon::MallocStats::m_infos
PerfMon::mallinfo_t m_infos
Definition: MallocStats.h:28
PerfMon::MallocStats::from_system_mmap
return_type from_system_mmap()
Returns number of bytes allocated from system using mmap.
Definition: MallocStats.h:100
PerfMon::MallocStats::from_system_nmmap
return_type from_system_nmmap()
Returns number of bytes allocated from system not including mmapped regions.
Definition: MallocStats.h:44
PerfMon::MallocStats::from_system_total
return_type from_system_total()
Returns total number of bytes allocated from system including mmapped regions.
Definition: MallocStats.h:116
PerfMon::MallocStats::fastbin_blocks
return_type fastbin_blocks()
Number of fastbin blocks.
Definition: MallocStats.h:86
PerfMon::MallocStats::repr
std::string repr()
display malloc stats
Definition: MallocStats.cxx:37