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_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 >
 
using storage_type = empty_storage
 

Public Member Functions

void start ()
 
void stop ()
 
void get () const
 

Static Public Member Functions

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

Detailed Description

Definition at line 50 of file components.hpp.

Member Typedef Documentation

◆ base_type

◆ storage_type

Definition at line 66 of file declaration.hpp.

◆ this_type

◆ value_type

Definition at line 52 of file components.hpp.

Member Function Documentation

◆ description()

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

Definition at line 57 of file components.hpp.

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

◆ 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_cpu_profiler::global_finalize ( )
inlinestatic

Definition at line 65 of file components.hpp.

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

◆ label()

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

Definition at line 56 of file components.hpp.

56{ return "gperftools_cpu_profiler"; }

Referenced by start().

◆ record()

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

Definition at line 61 of file components.hpp.

61{}

◆ start()

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

Definition at line 74 of file components.hpp.

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

◆ stop()

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

Definition at line 93 of file components.hpp.

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

◆ thread_init()

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

Definition at line 63 of file components.hpp.

63{ gperftools::cpu::register_thread(); }

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