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::operation::decode< ApiT > Struct Template Reference

This class post-processes strings for a given API. More...

#include "timemory/operations/types/decode.hpp"

+ Collaboration diagram for tim::operation::decode< ApiT >:

Public Member Functions

auto operator() (const char *inp)
 
auto operator() (const std::string &inp)
 
auto operator() (const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id)
 
auto operator() (hash_value_t _hash_id)
 

Static Public Member Functions

static auto tokenized_demangle (std::string inp)
 

Detailed Description

template<typename ApiT>
struct tim::operation::decode< ApiT >

This class post-processes strings for a given API.

Template Parameters
ApiTTimemory project API, e.g. tim::project::timemory

Definition at line 48 of file decode.hpp.

Member Function Documentation

◆ operator()() [1/4]

template<typename ApiT >
auto tim::operation::decode< ApiT >::operator() ( const char *  inp)
inline

Definition at line 63 of file decode.hpp.

64 {
65 return tokenized_demangle(demangle_backtrace(demangle_hash_identifier(inp)));
66 }
std::string demangle_hash_identifier(std::string, char bdelim='[', char edelim=']')
static auto tokenized_demangle(std::string inp)
Definition: decode.hpp:52

References tim::operation::decode< ApiT >::tokenized_demangle().

◆ operator()() [2/4]

template<typename ApiT >
auto tim::operation::decode< ApiT >::operator() ( const hash_map_ptr_t _hash_map,
const hash_alias_ptr_t _hash_alias,
hash_value_t  _hash_id 
)
inline

Definition at line 73 of file decode.hpp.

75 {
76 auto _resolvers = *get_hash_resolvers();
77 std::string _resolved{};
78 for(auto& itr : _resolvers)
79 {
80 if(itr(_hash_id, _resolved))
82 return _resolved;
83 }
84
87 }
hash_value_t _hash_id
Definition: definition.hpp:114
std::shared_ptr< hash_resolver_vec_t > & get_hash_resolvers()
bool get_hash_identifier(const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id, std::string *&_ret)
const hash_alias_ptr_t & _hash_alias
Definition: definition.hpp:124
tim::mpl::apply< std::string > string
Definition: macros.hpp:53

References tim::operation::decode< ApiT >::tokenized_demangle().

◆ operator()() [3/4]

template<typename ApiT >
auto tim::operation::decode< ApiT >::operator() ( const std::string &  inp)
inline

Definition at line 68 of file decode.hpp.

69 {
70 return tokenized_demangle(demangle_backtrace(demangle_hash_identifier(inp)));
71 }

References tim::operation::decode< ApiT >::tokenized_demangle().

◆ operator()() [4/4]

template<typename ApiT >
auto tim::operation::decode< ApiT >::operator() ( hash_value_t  _hash_id)
inline

Definition at line 89 of file decode.hpp.

90 {
91 auto _resolvers = *get_hash_resolvers();
92 std::string _resolved{};
93 for(auto& itr : _resolvers)
94 {
95 if(itr(_hash_id, _resolved))
97 return _resolved;
98 }
99
100 return tokenized_demangle(
102 }

References tim::operation::decode< ApiT >::tokenized_demangle().

◆ tokenized_demangle()

template<typename ApiT >
static auto tim::operation::decode< ApiT >::tokenized_demangle ( std::string  inp)
inlinestatic

Definition at line 52 of file decode.hpp.

53 {
54 using pair_t = std::pair<std::string, std::string>;
55 for(auto&& itr : { pair_t{ "_Z", " " }, pair_t{ "_Z", "]" }, pair_t{ " ", " " } })
56 {
57 inp = str_transform(inp, itr.first, itr.second,
58 [](const std::string& _s) { return demangle(_s); });
59 }
60 return inp;
61 }
std::string str_transform(const std::string &input, const std::string &_begin, const std::string &_end, PredicateT &&predicate)
apply a string transformation to substring inbetween a common delimiter. e.g.
Definition: delimit.hpp:111

References tim::str_transform().

Referenced by tim::operation::decode< ApiT >::operator()().


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