placeholder for the stats
More...
#include <MemStatsHooks.h>
placeholder for the stats
Definition at line 32 of file MemStatsHooks.h.
◆ enable()
static bool PerfMon::MemStats::enable |
( |
const bool |
flag | ) |
|
|
inlinestatic |
switch to enable or disable the global malloc hooks
- Returns
- the old value of the flag
Definition at line 48 of file MemStatsHooks.h.
◆ enabled()
static bool PerfMon::MemStats::enabled |
( |
| ) |
|
|
inlinestatic |
◆ installHooks()
void PerfMon::MemStats::installHooks |
( |
| ) |
|
|
static |
install our hooks
Definition at line 100 of file MemStatsHooks.cxx.
102 #if HAVE_MALLOC_HOOKS
103 __free_hook = pmon_mem_free;
104 __realloc_hook = pmon_mem_realloc;
105 __malloc_hook = pmon_mem_malloc;
107 pthread_mutex_unlock(&pmon_mem_lock);
◆ nbytes()
static unsigned long long PerfMon::MemStats::nbytes |
( |
| ) |
|
|
inlinestatic |
return the number of bytes allocated so far
Definition at line 67 of file MemStatsHooks.h.
◆ nfrees()
static unsigned long long PerfMon::MemStats::nfrees |
( |
| ) |
|
|
inlinestatic |
return the number of times free has been called so far
Definition at line 71 of file MemStatsHooks.h.
◆ nmallocs()
static unsigned long long PerfMon::MemStats::nmallocs |
( |
| ) |
|
|
inlinestatic |
return the number of times malloc has been called so far
Definition at line 69 of file MemStatsHooks.h.
69 {
return m_nmallocs; }
◆ saveHooks()
void PerfMon::MemStats::saveHooks |
( |
| ) |
|
|
static |
save current hooks
Definition at line 120 of file MemStatsHooks.cxx.
122 #if HAVE_MALLOC_HOOKS
125 if ( __malloc_hook != pmon_mem_malloc ) {
126 orig_malloc = __malloc_hook;
129 if ( __realloc_hook != pmon_mem_realloc ) {
130 orig_realloc = __realloc_hook;
133 if ( __free_hook != pmon_mem_free ) {
134 orig_free = __free_hook;
◆ start()
void PerfMon::MemStats::start |
( |
| ) |
|
|
static |
initialize library
Definition at line 70 of file MemStatsHooks.cxx.
72 if (0 != pthread_mutex_init(&pmon_mem_lock, NULL)) {
73 throw std::runtime_error(
"perfmon: could not initialize pthread mutex");
75 pthread_mutex_lock(&pmon_mem_lock);
81 pthread_mutex_unlock(&pmon_mem_lock);
◆ stop()
void PerfMon::MemStats::stop |
( |
| ) |
|
|
static |
finalize library
Definition at line 85 of file MemStatsHooks.cxx.
95 if (0 != pthread_mutex_destroy(&pmon_mem_lock)) {
96 throw std::runtime_error(
"perfmon: could not destroy pthread mutex");
◆ uninstallHooks()
void PerfMon::MemStats::uninstallHooks |
( |
| ) |
|
|
static |
uninstall our hooks
Definition at line 110 of file MemStatsHooks.cxx.
112 pthread_mutex_lock(&pmon_mem_lock);
113 #if HAVE_MALLOC_HOOKS
114 __free_hook = orig_free;
115 __realloc_hook = orig_realloc;
116 __malloc_hook = orig_malloc;
◆ ATLAS_THREAD_SAFE [1/3]
unsigned long long m_nbytes PerfMon::MemStats::ATLAS_THREAD_SAFE |
|
static |
◆ ATLAS_THREAD_SAFE [2/3]
unsigned long long m_nmallocs PerfMon::MemStats::ATLAS_THREAD_SAFE |
|
static |
number of times malloc has been called so far
Definition at line 41 of file MemStatsHooks.h.
◆ ATLAS_THREAD_SAFE [3/3]
unsigned long long m_nfrees PerfMon::MemStats::ATLAS_THREAD_SAFE |
|
static |
number of times free has been called so far
Definition at line 44 of file MemStatsHooks.h.
◆ m_enabled
std::atomic< bool > PerfMon::MemStats::m_enabled = false |
|
static |
flag disabling or enabling the global malloc hooks
Definition at line 35 of file MemStatsHooks.h.
The documentation for this struct was generated from the following files: