timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
tim::component::gperftools_heap_profiler Struct Reference

#include "timemory/components/gperftools/components.hpp"

+ Collaboration diagram for tim::component::gperftools_heap_profiler:

Public Types

using value_type = void
 
using this_type = gperftools_heap_profiler
 
using base_type = base< this_type, value_type >
 
using storage_type = empty_storage
 

Public Member Functions

void start ()
 
void stop ()
 
void set_prefix (const std::string &_prefix)
 
void get () const
 

Static Public Member Functions

static std::string label ()
 
static std::string description ()
 
static value_type record ()
 
static void global_finalize ()
 
template<typename... Args>
static opaque get_opaque (Args &&...)
 

Protected Attributes

std::string prefix
 
int32_t index = -1
 

Detailed Description

Definition at line 124 of file components.hpp.

Member Typedef Documentation

◆ base_type

◆ storage_type

Definition at line 66 of file declaration.hpp.

◆ this_type

◆ value_type

Member Function Documentation

◆ description()

static std::string tim::component::gperftools_heap_profiler::description ( )
inlinestatic

Definition at line 131 of file components.hpp.

132 {
133 return "Control switch for the gperftools heap profiler";
134 }

◆ get()

void tim::component::empty_base::get ( ) const
inlineinherited

Definition at line 69 of file declaration.hpp.

69{}

◆ get_opaque()

template<typename... Args>
static opaque tim::component::empty_base::get_opaque ( Args &&  ...)
inlinestaticinherited

Definition at line 72 of file declaration.hpp.

73 {
74 return opaque{};
75 }

◆ global_finalize()

static void tim::component::gperftools_heap_profiler::global_finalize ( )
inlinestatic

Definition at line 137 of file components.hpp.

138 {
139 if(gperftools::heap::is_running())
140 {
141 gperftools::heap::profiler_flush("global_finalize");
142 gperftools::heap::profiler_stop();
143 }
144 }

◆ label()

static std::string tim::component::gperftools_heap_profiler::label ( )
inlinestatic

Definition at line 130 of file components.hpp.

130{ return "gperftools_heap_profiler"; }

Referenced by start().

◆ record()

static value_type tim::component::gperftools_heap_profiler::record ( )
inlinestatic

Definition at line 135 of file components.hpp.

135{}

◆ set_prefix()

void tim::component::gperftools_heap_profiler::set_prefix ( const std::string &  _prefix)
inline

Definition at line 170 of file components.hpp.

170{ prefix = _prefix; }
char const std::string & _prefix
Definition: config.cpp:55

References tim::_prefix, and prefix.

◆ start()

void tim::component::gperftools_heap_profiler::start ( )
inline

Definition at line 146 of file components.hpp.

147 {
148 if(!gperftools::heap::is_running())
149 {
150 index = this_type::get_index()++;
151 auto fname = settings::compose_output_filename(label(), ".dat");
152 auto ret = gperftools::heap::profiler_start(fname);
153 if(ret > 0)
154 {
155 fprintf(stderr, "[gperftools_heap_profiler]> Error starting %s...",
156 prefix.c_str());
157 }
158 }
159 }
static string_t compose_output_filename(string_t _tag, string_t _ext, bool _use_suffix=use_output_suffix(), int32_t _suffix=default_process_suffix(), bool _make_dir=false, std::string _explicit={})
Definition: settings.cpp:322

References tim::settings::compose_output_filename(), index, label(), and prefix.

◆ stop()

void tim::component::gperftools_heap_profiler::stop ( )
inline

Definition at line 161 of file components.hpp.

162 {
163 if(index >= 0)
164 {
165 gperftools::heap::profiler_flush(prefix);
166 gperftools::heap::profiler_stop();
167 }
168 }

References index, and prefix.

Member Data Documentation

◆ index

int32_t tim::component::gperftools_heap_profiler::index = -1
protected

Definition at line 174 of file components.hpp.

Referenced by start(), and stop().

◆ prefix

std::string tim::component::gperftools_heap_profiler::prefix
protected

Definition at line 173 of file components.hpp.

Referenced by set_prefix(), start(), and stop().


The documentation for this struct was generated from the following file: