ATLAS Offline Software
MallocStats.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // MallocStats.h
8 // Author: S.Binet<binet@cern.ch>
10 #ifndef PERFMONEVENT_PERFMONMALLOCSTATS_H
11 #define PERFMONEVENT_PERFMONMALLOCSTATS_H 1
12 
13 // the following code has been reaped off the STXXL library (boost licence)
14 // see http://stxxl.sourceforge.net/ for licence
15 
16 #include <iostream>
17 #include "PerfMonEvent/mallinfo.h"
18 #include <cstdlib>
19 #include <string>
20 
21 namespace PerfMon {
22 
24 
27 {
29 
30 public:
31 
34  MallocStats();
35 
36  typedef int return_type;
37 
40  void refresh()
41  { m_infos = PerfMon::mallinfo(); }
42 
45  {
46  refresh();
47  return m_infos.arena;
48  }
49 
52  {
53  refresh();
54  return m_infos.ordblks;
55  }
56 
59  {
60  refresh();
61  return m_infos.uordblks;
62  }
63 
66  {
67  refresh();
68  return m_infos.fordblks;
69  }
70 
73  {
74  refresh();
75  return m_infos.keepcost;
76  }
77 
80  {
81  refresh();
82  return m_infos.usmblks;
83  }
84 
87  {
88  refresh();
89  return m_infos.smblks;
90  }
91 
94  {
95  refresh();
96  return m_infos.fsmblks;
97  }
98 
101  {
102  refresh();
103  return m_infos.hblkhd;
104  }
105 
108  {
109  refresh();
110  return m_infos.hblks;
111  }
112 
117  {
118  refresh();
119  return from_system_nmmap() + from_system_mmap();
120  }
121 
124  std::string repr();
125 
128  void dump (std::ostream& out = std::cout);
129 };
130 
131 } //> end namespace PerfMon
132 
133 #endif // !PERFMONEVENT_PERFMONMALLOCSTATS_H
PerfMon::MallocStats::fastbin_free
return_type fastbin_free()
Space available in freed fastbin blocks (bytes)
Definition: MallocStats.h:93
PerfMon::MallocStats::max_allocated
return_type max_allocated()
Maximum total allocated space (bytes) (always 0 ?)
Definition: MallocStats.h:79
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::return_type
int return_type
Definition: MallocStats.h:36
PerfMon::MallocStats::dump
void dump(std::ostream &out=std::cout)
display malloc stats on std::cout
Definition: MallocStats.cxx:70
PerfMon
a simple malloc wrapper that keeps track of the amount of memory allocated on the heap.
Definition: CallGraphAuditor.cxx:24
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::mallinfo_t
struct mallinfo mallinfo_t
Definition: mallinfo.h:28
mallinfo.h
Wrappers for mallinfo.
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::MallocStats
MallocStats()
c-tor
Definition: MallocStats.cxx:26
PerfMon::MallocStats
Access to some useful malloc statistics.
Definition: MallocStats.h:27
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