timemory  3.2.1
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 >
 

Public Member Functions

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

Static Public Member Functions

static std::string label ()
 
static std::string description ()
 
static value_type record ()
 
static void global_finalize ()
 

Protected Attributes

std::string prefix
 
int32_t index = -1
 

Detailed Description

Definition at line 125 of file components.hpp.

Member Typedef Documentation

◆ base_type

◆ this_type

◆ value_type

Member Function Documentation

◆ description()

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

Definition at line 132 of file components.hpp.

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

◆ global_finalize()

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

Definition at line 138 of file components.hpp.

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

◆ label()

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

Definition at line 131 of file components.hpp.

131 { return "gperftools_heap_profiler"; }

Referenced by start().

◆ record()

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

Definition at line 136 of file components.hpp.

136 {}

◆ set_prefix()

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

Definition at line 171 of file components.hpp.

171 { prefix = _prefix; }
char const std::string & _prefix
Definition: definition.hpp:59

References tim::_prefix, and prefix.

◆ start()

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

Definition at line 147 of file components.hpp.

148  {
149  if(!gperf::heap::is_running())
150  {
151  index = this_type::get_index()++;
152  auto fname = settings::compose_output_filename(label(), ".dat");
153  auto ret = gperf::heap::profiler_start(fname);
154  if(ret > 0)
155  {
156  fprintf(stderr, "[gperftools_heap_profiler]> Error starting %s...",
157  prefix.c_str());
158  }
159  }
160  }
static string_t compose_output_filename(const string_t &_tag, string_t _ext, bool _mpi_init=false, int32_t _mpi_rank=-1, bool fake=false, std::string _explicit="")
Definition: settings.cpp:234

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

◆ stop()

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

Definition at line 162 of file components.hpp.

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

References index, and prefix.

Member Data Documentation

◆ index

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

Definition at line 175 of file components.hpp.

Referenced by start(), and stop().

◆ prefix

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

Definition at line 174 of file components.hpp.

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


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