29#include "timemory/tpls/cereal/archives.hpp"
46template <
typename CompT,
typename Tp>
60template <
typename CompT>
68 template <
typename... ArgsT>
75template <
typename CompT>
76struct record_statistics<CompT,
std::tuple<>>
78 using type = std::tuple<>;
79 using this_type = record_statistics<CompT, type>;
83 template <
typename... ArgsT>
90template <
typename Archive,
typename Api>
96 static pointer get(std::istream& is) {
return std::make_shared<type>(is); }
101template <
typename Api>
104 using type = cereal::JSONInputArchive;
107 static pointer get(std::istream& is) {
return std::make_shared<type>(is); }
112template <
typename Api>
115 using type = cereal::JSONInputArchive;
118 static pointer get(std::istream& is) {
return std::make_shared<type>(is); }
123template <
typename Api>
126 using type = cereal::JSONInputArchive;
129 static pointer get(std::istream& is) {
return std::make_shared<type>(is); }
134template <
typename Archive,
typename Api>
145template <
typename Api>
148 using type = cereal::PrettyJSONOutputArchive;
155 static unsigned int value = 16;
161 static unsigned int value = 1;
175 return std::make_shared<type>(
os, opts);
183template <
typename Api>
186 using type = cereal::MinimalJSONOutputArchive;
193 static unsigned int value = 16;
198 static unsigned int value = 0;
212 return std::make_shared<type>(
os, opts);
217#if defined(TIMEMORY_USE_XML)
221template <
typename Api>
222struct output_archive<cereal::XMLOutputArchive, Api>
224 using type = cereal::XMLOutputArchive;
225 using pointer = std::shared_ptr<type>;
226 using option_type =
typename type::Options;
227 using indent_type = bool;
228 using output_type = bool;
232 static unsigned int value = 16;
237 static indent_type& indent()
239 static indent_type value =
240 trait::pretty_archive<Api>::value || trait::pretty_archive<void>::value;
245 static output_type& type_attribute()
247 static output_type value =
false;
252 static output_type& size_attribute()
254 static output_type value =
false;
262 option_type opts(
precision(), indent(), type_attribute(), size_attribute());
263 return std::make_shared<type>(
os, opts);
269template <
typename Tp>
276 static constexpr bool thread_support =
true;
300 static std::atomic<int_type> _instance(0);
308 static thread_local int_type _instance = 0;
316 m_tot = get_started()++;
317 m_thr = get_thread_started()++;
323 m_tot = --get_started();
324 m_thr = --get_thread_started();
330 template <
size_t Idx>
333 m_tot = get_started()++;
334 m_thr = get_thread_started()++;
338 template <
size_t Idx>
341 m_tot = --get_started();
342 m_thr = --get_thread_started();
348 template <
size_t Idx>
351 m_tot = get_started()++;
352 m_thr = get_thread_started()++;
356 template <
size_t Idx>
359 m_tot = --get_started();
360 m_thr = --get_thread_started();
379template <
typename Tp>
385 static constexpr bool thread_support =
false;
397 static
int_type get_started_count() {
return get_started().load(); }
404 static std::atomic<int_type> _instance(0);
412 m_tot = get_started()++;
420 m_tot = --get_started();
void stop(TupleT< Tp... > &obj, Args &&... args)
void start(TupleT< Tp... > &obj, Args &&... args)
Inherit from this policy to add reference counting support. Useful if you want to turn a global setti...
typename std::enable_if< B, T >::type enable_if_t
Alias template for enable_if.
const std::string std::ostream * os
instance_tracker()=default
auto global_tracker_start()
auto global_tracker_stop()
~instance_tracker()=default
instance_tracker(const instance_tracker &)=default
static std::atomic< int_type > & get_started()
instance_tracker(instance_tracker &&) noexcept=default
static int_type get_thread_started_count()
static int_type & get_thread_started()
static std::atomic< int_type > & get_started()
auto thread_tracker_stop()
auto global_tracker_start()
auto global_tracker_stop()
enable_if_t< Idx==thread_count, int_type > start()
enable_if_t< Idx==thread_count, int_type > stop()
static int_type get_started_count()
auto thread_tracker_start()
std::pair< int_type, int_type > pair_type
enable_if_t< Idx==global_count, int_type > start()
enable_if_t< Idx==global_count, int_type > stop()
static indent_type & indent_char()
std::shared_ptr< type > pointer
typename option_type::IndentChar indent_type
static unsigned int & precision()
typename type::Options option_type
static unsigned int & indent_length()
cereal::MinimalJSONOutputArchive type
static pointer get(std::ostream &os)
static unsigned int & indent_length()
typename type::Options option_type
static indent_type & indent_char()
typename option_type::IndentChar indent_type
static unsigned int & precision()
static pointer get(std::ostream &os)
cereal::PrettyJSONOutputArchive type
std::shared_ptr< type > pointer
Provides a static get() function which return a shared pointer to an instance of the given archive fo...
std::shared_ptr< type > pointer
static pointer get(std::ostream &os)
void operator()(ArgsT &&...)
Specification of how to accumulate statistics. This will not be used unless tim::trait::statistics ha...
void operator()(statistics< type > &, const CompT &, bool _accum=true)
statistics< type > statistics_type
void operator()(type &, const CompT &)
record_statistics< CompT, type > this_type
A generic class for statistical accumulation. It uses the timemory math overloads to enable statistic...