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_cpu_profiler Struct Reference

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

+ Collaboration diagram for tim::component::gperftools_cpu_profiler:

Public Types

using value_type = void
 
using this_type = gperftools_cpu_profiler
 
using base_type = base< this_type, value_type >
 

Public Member Functions

void start ()
 
void stop ()
 

Static Public Member Functions

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

Detailed Description

Definition at line 51 of file components.hpp.

Member Typedef Documentation

◆ base_type

◆ this_type

◆ value_type

Definition at line 53 of file components.hpp.

Member Function Documentation

◆ description()

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

Definition at line 58 of file components.hpp.

59  {
60  return "Control switch for gperftools CPU profiler";
61  }

◆ global_finalize()

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

Definition at line 66 of file components.hpp.

67  {
68  if(gperf::cpu::is_running())
69  {
70  gperf::cpu::profiler_flush();
71  gperf::cpu::profiler_stop();
72  }
73  }

◆ label()

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

Definition at line 57 of file components.hpp.

57 { return "gperftools_cpu_profiler"; }

Referenced by start().

◆ record()

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

Definition at line 62 of file components.hpp.

62 {}

◆ start()

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

Definition at line 75 of file components.hpp.

76  {
77  if(!gperf::cpu::is_running())
78  {
79  index = this_type::get_index()++;
80  const auto& _dmp_info = get_dmp_info();
81  bool _dmp_init = std::get<0>(_dmp_info);
82  int32_t _dmp_rank = std::get<1>(_dmp_info);
84  label() + "_" + std::to_string(index), ".dat", _dmp_init, _dmp_rank);
85  auto ret = gperf::cpu::profiler_start(fname);
86  if(ret == 0)
87  {
88  fprintf(stderr, "[gperftools_cpu_profiler]> Error starting %s...",
89  fname.c_str());
90  }
91  }
92  }
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(), and label().

◆ stop()

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

Definition at line 94 of file components.hpp.

95  {
96  if(index >= 0)
97  {
98  gperf::cpu::profiler_flush();
99  gperf::cpu::profiler_stop();
100  }
101  }

◆ thread_init()

static void tim::component::gperftools_cpu_profiler::thread_init ( )
inlinestatic

Definition at line 64 of file components.hpp.

64 { gperf::cpu::register_thread(); }

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