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.
type_traits.hpp File Reference
#include "timemory/api.hpp"
#include "timemory/environment/types.hpp"
#include "timemory/mpl/available.hpp"
#include "timemory/mpl/types.hpp"
#include "timemory/tpls/cereal/archives.hpp"
#include <type_traits>
+ Include dependency graph for type_traits.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tim::trait::base_has_accum< T >
 trait that signifies that a component has an accumulation value. In general, most components implement 'value' and 'accum' data members of 'value_type'. Where 'value' is generally used as intermediate storage between start/stop and after stop have been called, 'value' is assigned as the difference between start/stop and added to 'accum'. However, in the case where 'accum' is not a valid metric for the component, this trait can be used to save memory bc it results in the 'accum' data member to be implemented as a data-type of std::tuple<>, which only requires 1 byte of memory. More...
 
struct  tim::trait::base_has_last< T >
 trait that signifies that a component has an "last" value which may be different than the "value" value. In general, most components implement 'value' and 'accum' data members of 'value_type'. Where 'value' is generally used as intermediate storage between start/stop and after stop have been called, 'value' is assigned as the difference between start/stop and added to 'accum'. However, in the case where 'value' is valid as an individual measurement, this trait can be used to store 'value' as the individual measurement and 'last' as the difference or vice-versa. More...
 
struct  tim::trait::data< T >
 trait to specify the value type of a component before the definition of the component More...
 
struct  tim::trait::component_apis< T >
 trait to specify the APIs that the component is logically a part of More...
 
struct  tim::trait::supports_runtime_enabled< Tp >
 trait to specify that the type supports toggling availablity at runtime. Supporting runtime availability has a relatively miniscule overhead but disabling it can ensure that the implementation truly maps down to the same assembly as hand-implementations. More...
 
struct  tim::trait::runtime_enabled< void >
 
struct  tim::trait::default_runtime_enabled< T >
 trait whose compile-time constant field value designates the default runtime value of tim::trait::runtime_enabled. Standard setting is true. More...
 
struct  tim::trait::runtime_enabled< T >
 trait that signifies that an implementation is enabled at runtime. The value returned from get() is for the specific setting for the type, the global settings (type: void) and the specific settings for it's APIs More...
 
struct  tim::trait::custom_label_printing< T >
 trait that signifies that a component will handle printing the label(s) More...
 
struct  tim::trait::custom_unit_printing< T >
 trait that signifies that a component will handle printing the units(s) More...
 
struct  tim::trait::start_priority< T >
 trait that designates whether there is a priority when starting the type w.r.t. other types. Lower values indicate higher priority. More...
 
struct  tim::trait::stop_priority< T >
 trait that designates whether there is a priority when stopping the type w.r.t. other types. Lower values indicate higher priority. More...
 
struct  tim::trait::fini_priority< T >
 trait that designates whether there is a priority when finalizing the type w.r.t. other types. Recommended for component which hold instances of other components. Lower values indicate higher priority. More...
 
struct  tim::trait::is_timing_category< T >
 trait that designates the width and precision should follow formatting settings related to timing measurements More...
 
struct  tim::trait::is_memory_category< T >
 trait that designates the width and precision should follow formatting settings related to memory measurements More...
 
struct  tim::trait::uses_timing_units< T >
 trait that designates the units should follow unit settings related to timing measurements More...
 
struct  tim::trait::uses_memory_units< T >
 trait that designates the units should follow unit settings related to memory measurements More...
 
struct  tim::trait::uses_percent_units< T >
 trait that designates the units are a percentage More...
 
struct  tim::trait::requires_json< T >
 trait that designates a type should always print a JSON output More...
 
struct  tim::trait::api_components< T, Tag >
 trait that designates components in an API (tim::api) More...
 
struct  tim::trait::component_value_type< T, true >
 
struct  tim::trait::component_value_type< T, false >
 
struct  tim::trait::collects_data< T >
 trait that specifies or determines if a component collects any data. Default behavior is to check if the component is available and extract the type and value fields from tim::trait::component_value_type. When a component is available, the 'type' of this trait will return the 'value type' for a component regardless of whether it was specified within the component definition or if it was declared via a type-trait. The constexpr 'value' boolean indicates whether the 'type' is not a null type. More...
 
struct  tim::trait::supports_custom_record< T >
 trait that designates the type supports changing the record() static function per-instance More...
 
struct  tim::trait::iterable_measurement< T >
 trait that signifies that get() returns an iterable type More...
 
struct  tim::trait::secondary_data< T >
 trait that signifies that secondary data resembling the original data exists but should be another node entry in the graph. These types must provide a get_secondary() member function and that member function must return a pair-wise iterable container, e.g. std::map, of types: More...
 
struct  tim::trait::thread_scope_only< T >
 trait that signifies the component only has relevant values if it is not collapsed into the master thread More...
 
struct  tim::trait::custom_serialization< T >
 trait that signifies the component will be providing it's own split load(...) and store(...) for serialization so do not provide one in the base class More...
 
struct  tim::trait::record_statistics< T >
 trait that signifies the component will calculate min/max/stddev More...
 
struct  tim::trait::statistics< T >
 trait that specifies the data type of the statistics More...
 
struct  tim::trait::permissive_statistics< T >
 trait that will suppress compilation error in operation::add_statistics<Component> if the data type passed is implicitly convertible to the data type in statistics<Component>::type but avoids converting integers to floating points and vice-versa. More...
 
struct  tim::trait::sampler< T >
 trait that signifies the component supports sampling. More...
 
struct  tim::trait::file_sampler< T >
 trait that signifies the component samples a measurement from a file. If multiple components sample from the same file, it is recommended to create a cache type which performs a single read of the file and caches the values such that when these components are bundled together, they can just read their data from the cache structure. More...
 
struct  tim::trait::units< T >
 trait that specifies the units More...
 
struct  tim::trait::echo_enabled< T >
 trait that configures echo_measurement usage More...
 
struct  tim::trait::pretty_archive< T >
 trait that configures whether output archive uses pretty formmatting. If set to false_type then the JSON/XML/etc. will be compact (if supported) More...
 
struct  tim::trait::api_input_archive< Api >
 trait that configures the default input archive type for an entire API specification, e.g. TIMEMORY_API (which is struct tim::project::timemory). The input archive format of individual components is determined from the derived tim::trait::input_archive More...
 
struct  tim::trait::api_output_archive< Api >
 trait that configures the default output archive type for an entire API specification, e.g. TIMEMORY_API (which is struct tim::project::timemory). The output archive format of individual components is determined from the derived tim::trait::output_archive More...
 
struct  tim::trait::input_archive< T, Api >
 trait that configures output archive type More...
 
struct  tim::trait::output_archive< T, Api >
 trait that configures output archive type More...
 
struct  tim::trait::output_archive< manager, TIMEMORY_API >
 
struct  tim::trait::output_archive< manager, Api >
 
struct  tim::trait::archive_extension< T >
 Extension for the input or output archive types. It will throw an error if used on new archive types and not specialized. More...
 
struct  tim::trait::report< T >
 trait that allows runtime configuration of reporting certain types of values. Only applies to text output. This will allows modifying the value set by the specific "report_*" type-trait. More...
 
struct  tim::trait::report_count< T >
 trait that configures type to not report the number of lap count (useful if meaningless). Only applies to text output. More...
 
struct  tim::trait::report_depth< T >
 
struct  tim::trait::report_metric_name< T >
 trait that configures type to not report the "METRIC" column, useful if redundant). Only applies to text output. More...
 
struct  tim::trait::report_units< T >
 trait that configures type to not report the "UNITS" column (useful if always empty). Only applies to text output. More...
 
struct  tim::trait::report_sum< T >
 trait that configures type to not report the accumulated value (useful if meaningless). Only applies to text output. More...
 
struct  tim::trait::report_mean< T >
 trait that configures type to not report the mean value (useful if meaningless). Only applies to text output. More...
 
struct  tim::trait::report_statistics< T >
 trait that configures type to not report the "UNITS" column (useful if always empty). Only applies to text output and does NOT affect whether statistics are accumulated. For disabling statistics completely, see tim::trait::record_statistics and tim::policy::record_statistics. More...
 
struct  tim::trait::report_self< T >
 trait that configures type to not report the % self field (useful if meaningless). Only applies to text output. More...
 
struct  tim::trait::supports_flamegraph< T >
 trait that designates a type supports flamegraph output More...
 
struct  tim::trait::derivation_types< T >
 trait that designates the type supports calling assemble and derive member functions with these types. Specializations MUST be structured as a tim::type_list<...> of tim::type_list<...> where each inner type_list entry is the list of component types required to perform a derivation. More...
 
struct  tim::trait::python_args< OpT, T >
 trait that designates the type supports these arguments from python. Specializations MUST be structured as either one tim::type_list<...> or a tim::type_list<...> of tim::type_list<...>. The first argument is a TIMEMORY_OPERATION enumerated type and for each inner tim::type_list, a python member function for the stand-alone component will be generated with those arguments. E.g. to create a custom store member function accepting integer: More...
 
struct  tim::trait::cache< T >
 trait that specifies the intermediate data type that will hold the relevant data required by the component. This is useful for when multiple components read different parts of the same file (e.g. /proc/<PID>/io) or an API reports data in a larger data structure than the scope of the component (e.g. rusage) but multiple components require access to this data structure More...
 
struct  tim::trait::generates_output< T, V >
 trait used to evaluate whether a component value type produces a useable value More...
 
struct  tim::trait::generates_output< T, void >
 
struct  tim::trait::generates_output< T, null_type >
 
struct  tim::trait::generates_output< T, type_list<> >
 
struct  tim::trait::generates_output< T, data< T > >
 
struct  tim::trait::uses_storage< T >
 trait that designates that a component will instantiate tim::storage More...
 
struct  tim::trait::tree_storage< T >
 trait that configures type to always use hierarchical call-stack storage More...
 
struct  tim::trait::flat_storage< T >
 trait that configures type to always use flat call-stack storage More...
 
struct  tim::trait::timeline_storage< T >
 trait that configures type to always use timeline call-stack storage More...
 
struct  tim::trait::uses_value_storage< T, V, A >
 This trait is used to determine whether the (expensive) instantiation of the storage class happens. More...
 
struct  tim::trait::uses_value_storage< T, void, A >
 
struct  tim::trait::uses_value_storage< T, null_type, A >
 
struct  tim::trait::uses_value_storage< T, type_list<>, A >
 
struct  tim::trait::perfetto_category< ApiT >
 Provides the static category for perfetto traces. More...
 
struct  tim::trait::is_component< T >
 trait that designates the type is a timemory component More...
 
struct  tim::trait::is_gotcha< T >
 trait that designates the type is a gotcha More...
 
struct  tim::trait::is_user_bundle< T >
 trait that designates the type is a user-bundle More...
 
struct  tim::trait::record_max< T >
 trait that signifies that updating w.r.t. another instance should be a max of the two instances More...
 
struct  tim::trait::array_serialization< T >
 trait that signifies that data is an array type More...
 
struct  tim::trait::requires_prefix< T >
 trait that signifies that a component requires the prefix to be set right after construction. Types with this trait must contain a member string variable named prefix More...
 
struct  tim::trait::supports_args< T, Tuple >
 trait that designates the type supports calling a function with a certain set of argument types (passed via a tuple). More...
 

Namespaces

namespace  tim
 
namespace  tim::trait
 

Macros

#define TIMEMORY_REPORT_GET_SET(FNAME, FIELD)
 
#define TIMEMORY_REPORT_ENV_QUERY(FIELD)    get_env<bool>("TIMEMORY_PRINT_" #FIELD, get_runtime_value().at(FIELD))
 
#define TIMEMORY_DEFINE_CONCRETE_TRAIT(TRAIT, COMPONENT, VALUE)
 
#define TIMEMORY_DEFINE_TEMPLATE_TRAIT(TRAIT, COMPONENT, VALUE, TYPE)
 
#define TIMEMORY_DEFINE_VARIADIC_TRAIT(TRAIT, COMPONENT, VALUE, TYPE)
 

Typedefs

template<typename T >
using tim::trait::component_apis_t = typename component_apis< T >::type
 
template<typename T >
using tim::trait::component_value_type_t = typename component_value_type< T, is_available< T >::value >::type
 
template<int OpT, typename T >
using tim::trait::python_args_t = typename python_args< OpT, T >::type
 

Functions

template<typename TraitT >
std::string tim::trait::as_string ()
 

Detailed Description

These are the definitions of type-traits used by timemory and should be defined separately from the class so that they can be queried without including the definition of the component

Definition in file type_traits.hpp.


Class Documentation

◆ tim::trait::data

struct tim::trait::data
template<typename T>
struct tim::trait::data< T >

trait to specify the value type of a component before the definition of the component

Definition at line 104 of file type_traits.hpp.

+ Collaboration diagram for tim::trait::data< T >:
Class Members
typedef type_list<> type

◆ tim::trait::component_apis

struct tim::trait::component_apis
template<typename T>
struct tim::trait::component_apis< T >

trait to specify the APIs that the component is logically a part of

Definition at line 116 of file type_traits.hpp.

+ Collaboration diagram for tim::trait::component_apis< T >:
Class Members
typedef type_list<> type

◆ tim::trait::api_components

struct tim::trait::api_components
template<typename T, typename Tag>
struct tim::trait::api_components< T, Tag >

trait that designates components in an API (tim::api)

Definition at line 331 of file type_traits.hpp.

+ Collaboration diagram for tim::trait::api_components< T, Tag >:
Class Members
typedef type_list<> type

◆ tim::trait::component_value_type< T, true >

struct tim::trait::component_value_type< T, true >
template<typename T>
struct tim::trait::component_value_type< T, true >

Definition at line 353 of file type_traits.hpp.

+ Collaboration diagram for tim::trait::component_value_type< T, true >:
Class Members
typedef conditional_t<!is_same< type_list<>, typename type >::value, typename type, typename value_type > type

◆ tim::trait::component_value_type< T, false >

struct tim::trait::component_value_type< T, false >
template<typename T>
struct tim::trait::component_value_type< T, false >

Definition at line 360 of file type_traits.hpp.

+ Collaboration diagram for tim::trait::component_value_type< T, false >:
Class Members
typedef void type

◆ tim::trait::statistics

struct tim::trait::statistics
template<typename T>
struct tim::trait::statistics< T >

trait that specifies the data type of the statistics

Definition at line 447 of file type_traits.hpp.

+ Collaboration diagram for tim::trait::statistics< T >:
Class Members
typedef tuple<> type

◆ tim::trait::units

struct tim::trait::units
template<typename T>
struct tim::trait::units< T >

trait that specifies the units

Definition at line 490 of file type_traits.hpp.

+ Collaboration diagram for tim::trait::units< T >:
Class Members
typedef string display_type
typedef int64_t type

◆ tim::trait::api_input_archive

struct tim::trait::api_input_archive
template<typename Api>
struct tim::trait::api_input_archive< Api >

trait that configures the default input archive type for an entire API specification, e.g. TIMEMORY_API (which is struct tim::project::timemory). The input archive format of individual components is determined from the derived tim::trait::input_archive

Definition at line 520 of file type_traits.hpp.

+ Collaboration diagram for tim::trait::api_input_archive< Api >:
Class Members
typedef TIMEMORY_INPUT_ARCHIVE type

◆ tim::trait::input_archive

struct tim::trait::input_archive
template<typename T, typename Api>
struct tim::trait::input_archive< T, Api >

trait that configures output archive type

Definition at line 550 of file type_traits.hpp.

+ Collaboration diagram for tim::trait::input_archive< T, Api >:
Class Members
typedef typename type type

◆ tim::trait::python_args

struct tim::trait::python_args
template<int OpT, typename T>
struct tim::trait::python_args< OpT, T >

trait that designates the type supports these arguments from python. Specializations MUST be structured as either one tim::type_list<...> or a tim::type_list<...> of tim::type_list<...>. The first argument is a TIMEMORY_OPERATION enumerated type and for each inner tim::type_list, a python member function for the stand-alone component will be generated with those arguments. E.g. to create a custom store member function accepting integer:

foo = timemory.component.CaliperLoopMarker("example")
foo.start()
for i in range(10):
foo.store(i) # store member function accepting integer
# ...
foo.stop()

The type-trait specification would look like this:

template <>
struct python_args<TIMEMORY_STORE, component::caliper_loop_marker>
{
using type = type_list<size_t>;
};
@ TIMEMORY_STORE
Definition: enum.h:685
type_list< type_list<> > type

Definition at line 847 of file type_traits.hpp.

+ Collaboration diagram for tim::trait::python_args< OpT, T >:
Class Members
typedef type_list< type_list<> > type

◆ tim::trait::cache

struct tim::trait::cache
template<typename T>
struct tim::trait::cache< T >

trait that specifies the intermediate data type that will hold the relevant data required by the component. This is useful for when multiple components read different parts of the same file (e.g. /proc/<PID>/io) or an API reports data in a larger data structure than the scope of the component (e.g. rusage) but multiple components require access to this data structure

Definition at line 866 of file type_traits.hpp.

+ Collaboration diagram for tim::trait::cache< T >:
Class Members
typedef null_type type

Macro Definition Documentation

◆ TIMEMORY_DEFINE_CONCRETE_TRAIT

#define TIMEMORY_DEFINE_CONCRETE_TRAIT (   TRAIT,
  COMPONENT,
  VALUE 
)
Value:
namespace tim \
{ \
namespace trait \
{ \
template <> \
struct TRAIT<COMPONENT> : VALUE \
{}; \
} \
}
Definition: kokkosp.cpp:39

Definition at line 1086 of file type_traits.hpp.

◆ TIMEMORY_DEFINE_TEMPLATE_TRAIT

#define TIMEMORY_DEFINE_TEMPLATE_TRAIT (   TRAIT,
  COMPONENT,
  VALUE,
  TYPE 
)
Value:
namespace tim \
{ \
namespace trait \
{ \
template <TYPE T> \
struct TRAIT<COMPONENT<T>> : VALUE \
{}; \
} \
}

Definition at line 1101 of file type_traits.hpp.

◆ TIMEMORY_DEFINE_VARIADIC_TRAIT

#define TIMEMORY_DEFINE_VARIADIC_TRAIT (   TRAIT,
  COMPONENT,
  VALUE,
  TYPE 
)
Value:
namespace tim \
{ \
namespace trait \
{ \
template <TYPE... T> \
struct TRAIT<COMPONENT<T...>> : VALUE \
{}; \
} \
}

Definition at line 1116 of file type_traits.hpp.

◆ TIMEMORY_REPORT_ENV_QUERY

#define TIMEMORY_REPORT_ENV_QUERY (   FIELD)     get_env<bool>("TIMEMORY_PRINT_" #FIELD, get_runtime_value().at(FIELD))

Definition at line 636 of file type_traits.hpp.

◆ TIMEMORY_REPORT_GET_SET

#define TIMEMORY_REPORT_GET_SET (   FNAME,
  FIELD 
)
Value:
static bool FNAME() { return get(FIELD); } \
static void FNAME(bool val) { set(FIELD, val); }
auto get(const auto_bundle< Tag, Types... > &_obj)

Definition at line 632 of file type_traits.hpp.