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::caliper_config Struct Reference

Component which provides Caliper cali::ConfigManager. More...

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

+ Collaboration diagram for tim::component::caliper_config:

Public Types

using value_type = void
 
using this_type = caliper_config
 
using base_type = base< this_type, value_type >
 
using value_type = void
 
using instance_tracker_t = policy::instance_tracker< caliper_config, false >
 
using arg_map_t = std::map< std::string, std::string >
 
using arg_vec_t = std::vector< std::string >
 

Public Member Functions

void start ()
 
void stop ()
 

Static Public Member Functions

static std::string label ()
 
static std::string description ()
 
static std::string label ()
 
static std::string description ()
 
static auto & get_manager ()
 
static void configure (const arg_vec_t &_args, const arg_map_t &_kwargs={})
 

Detailed Description

Component which provides Caliper cali::ConfigManager.

Definition at line 81 of file components.hpp.

Member Typedef Documentation

◆ arg_map_t

using tim::component::caliper_config::arg_map_t = std::map<std::string, std::string>

Definition at line 159 of file timemory.hpp.

◆ arg_vec_t

using tim::component::caliper_config::arg_vec_t = std::vector<std::string>

Definition at line 160 of file timemory.hpp.

◆ base_type

◆ instance_tracker_t

◆ this_type

◆ value_type [1/2]

Definition at line 83 of file components.hpp.

◆ value_type [2/2]

Definition at line 157 of file timemory.hpp.

Member Function Documentation

◆ configure()

static void tim::component::caliper_config::configure ( const arg_vec_t _args,
const arg_map_t _kwargs = {} 
)
inlinestatic

Definition at line 171 of file timemory.hpp.

171  {})
172  {
173  std::string cmd{};
174  {
175  std::stringstream ss;
176  for(auto& itr : _args)
177  ss << "," << itr;
178  if(!ss.str().empty())
179  cmd = ss.str().substr(1);
180  }
181  {
182  std::stringstream ss;
183  for(auto& itr : _kwargs)
184  {
185  auto _arg = itr.second;
186  if(_arg.empty())
187  {
188  ss << "," << itr.first;
189  }
190  else
191  {
192  ss << "," << itr.first << "=(" << _arg << ")";
193  }
194  }
195  if(!ss.str().empty())
196  {
197  if(!cmd.empty())
198  cmd += ",";
199  cmd += ss.str().substr(1);
200  }
201  }
202  if(!cmd.empty())
203  {
205  std::cerr << "Configuring caliper with :: " << cmd << std::endl;
206  get_manager().add(cmd.c_str());
207  if(get_manager().error())
208  {
209  std::cerr << "Caliper config error: " << get_manager().error_msg()
210  << std::endl;
211  }
212  }
213  else
214  {
216  std::cerr << "Caliper was not configured" << std::endl;
217  }
218  }
tim::mpl::apply< std::string > string
Definition: macros.hpp:52

◆ description() [1/2]

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

Definition at line 88 of file components.hpp.

88 { return "Caliper configuration manager"; }

◆ description() [2/2]

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

Definition at line 163 of file timemory.hpp.

163 { return "Caliper configuration manager"; }

◆ get_manager()

static auto& tim::component::caliper_config::get_manager ( )
inlinestatic

Definition at line 165 of file timemory.hpp.

166  {
167  static cali::ConfigManager _instance;
168  return _instance;
169  }

Referenced by start(), and stop().

◆ label() [1/2]

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

Definition at line 87 of file components.hpp.

87 { return "caliper_config"; }

◆ label() [2/2]

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

Definition at line 162 of file timemory.hpp.

162 { return "caliper_config"; }

◆ start()

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

Definition at line 273 of file timemory.hpp.

274  {
275  DEBUG_PRINT_HERE("%s", "Starting Caliper ConfigManager");
276  auto cnt = instance_tracker_t::start();
277  if(cnt == 0)
278  get_manager().start();
279  }
void start(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:298
#define DEBUG_PRINT_HERE(...)
Definition: macros.hpp:163

References DEBUG_PRINT_HERE, get_manager(), and tim::invoke::start().

◆ stop()

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

Definition at line 281 of file timemory.hpp.

282  {
283  DEBUG_PRINT_HERE("%s", "Flushing Caliper ConfigManager");
284  auto cnt = instance_tracker_t::stop();
285  if(cnt == 0)
286  get_manager().flush();
287  }
void stop(TupleT< Tp... > &obj, Args &&... args)
Definition: functional.cpp:368

References DEBUG_PRINT_HERE, get_manager(), and tim::invoke::stop().


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