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::static_properties< void, false > Struct Reference

#include "timemory/components/properties.hpp"

+ Collaboration diagram for tim::component::static_properties< void, false >:

Static Public Member Functions

static bool matches (const char *_ckey, const char *_enum_str, const idset_t &_ids)
 

Detailed Description

Definition at line 110 of file properties.hpp.

Member Function Documentation

◆ matches()

static bool tim::component::static_properties< void, false >::matches ( const char *  _ckey,
const char *  _enum_str,
const idset_t _ids 
)
inlinestatic

Definition at line 112 of file properties.hpp.

113 {
114 static bool _debug = tim::get_env<bool>("TIMEMORY_DEBUG", false);
115 static const auto regex_consts = std::regex_constants::ECMAScript |
116 std::regex_constants::icase |
117 std::regex_constants::optimize;
118 std::string _opts{ _enum_str };
119 _opts.reserve(_opts.size() + 512);
120 for(const auto& itr : _ids)
121 {
122 if(!itr.empty())
123 _opts += "|" + itr;
124 }
125 auto _option = std::string{ "\\b(" } + _opts + std::string{ ")\\b" };
126 try
127 {
128 if(std::regex_search(_ckey, std::regex{ _option, regex_consts }))
129 {
130 if(_debug)
131 {
132 auto _doption = std::string{ "\\b(" } + _opts + std::string{ ")\\b" };
133 fprintf(stderr,
134 "[component::static_properties::matches] '%s' matches (%s) "
135 "[regex: '%s']\n",
136 _ckey, _opts.c_str(), _doption.c_str());
137 fflush(stderr);
138 }
139 return true;
140 }
141 } catch(std::regex_error& err)
142 {
143 auto _doption = std::string{ "\\b(" } + _opts + std::string{ ")\\b" };
144 PRINT_HERE("regex error in regex_match(\"%s\", regex{ \"%s\", egrep | icase "
145 "| optimize }): %s [real: %s]",
146 _ckey, _doption.c_str(), err.what(), _option.c_str());
147 TIMEMORY_TESTING_EXCEPTION("regex error in: \"" << _doption << "\" for "
148 << _ckey)
149 }
150
151 return false;
152 }
tim::mpl::apply< std::string > string
Definition: macros.hpp:53
#define PRINT_HERE(...)
Definition: macros.hpp:152
#define TIMEMORY_TESTING_EXCEPTION(...)
Definition: types.hpp:156

References PRINT_HERE, and TIMEMORY_TESTING_EXCEPTION.


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