Component providing perfetto implementation.
More...
#include "timemory/components/perfetto/perfetto.hpp"
Component providing perfetto implementation.
Definition at line 51 of file perfetto.hpp.
◆ base_type
◆ storage_type
◆ strset_iterator
◆ strset_t
◆ TracingInitArgs
◆ TracingSession
◆ value_type
◆ perfetto_trace()
constexpr tim::component::perfetto_trace::perfetto_trace |
( |
| ) |
|
|
constexprdefault |
◆ description()
std::string tim::component::perfetto_trace::description |
( |
| ) |
|
|
static |
Definition at line 59 of file perfetto.cpp.
61 return "Provides Perfetto Tracing SDK: system profiling, app tracing and trace "
◆ get()
void tim::component::empty_base::get |
( |
| ) |
const |
|
inlineinherited |
◆ get_config()
◆ get_opaque()
template<typename... Args>
static opaque tim::component::empty_base::get_opaque |
( |
Args && |
... | ) |
|
|
inlinestaticinherited |
◆ global_finalize()
void tim::component::perfetto_trace::global_finalize |
( |
| ) |
|
|
static |
Definition at line 136 of file perfetto.cpp.
138#if defined(TIMEMORY_USE_PERFETTO)
143 ::perfetto::TrackEvent::Flush();
150 _session->StopBlocking();
151 std::vector<char> trace_data(_session->ReadTraceBlocking());
153 auto _rank = dmp::rank();
157 TIMEMORY_JOIN(
'_', _label, _category),
"pftrace", dmp::is_initialized(), _rank);
159 printf(
"[%s]|%i> Outputting '%s'...\n", _label.c_str(), (
int) _rank, _fname.c_str());
165 std::ofstream output{};
166 output.open(_fname.c_str(), std::ios::out | std::ios::binary);
167 output.write(&trace_data[0], trace_data.size());
static pointer_t instance()
Get a shared pointer to the instance for the current thread.
tim::mpl::apply< std::string > string
static config & get_config()
static std::string label()
static string_t compose_output_filename(string_t _tag, string_t _ext, bool _use_suffix=use_output_suffix(), int32_t _suffix=default_process_suffix(), bool _make_dir=false, std::string _explicit={})
Provides the static category for perfetto traces.
#define DEBUG_PRINT_HERE(...)
#define TIMEMORY_JOIN(delim,...)
References tim::settings::compose_output_filename(), DEBUG_PRINT_HERE, get_config(), tim::manager::instance(), label(), and TIMEMORY_JOIN.
◆ global_init()
void tim::component::perfetto_trace::global_init |
( |
| ) |
|
|
static |
Definition at line 75 of file perfetto.cpp.
77#if defined(TIMEMORY_USE_PERFETTO)
82 auto& args = get_tracing_init_args();
84 auto shmem_size_hint =
85 tim::get_env<size_t>(
"TIMEMORY_PERFETTO_SHMEM_SIZE_HINT_KB", 40960);
86 auto buffer_size = tim::get_env<size_t>(
"TIMEMORY_PERFETTO_BUFFER_SIZE_KB", 1024000);
88 ::perfetto::TraceConfig cfg{};
89 ::perfetto::protos::gen::TrackEventConfig track_event_cfg{};
91 cfg.add_buffers()->set_size_kb(buffer_size);
92 auto* ds_cfg = cfg.add_data_sources()->mutable_config();
93 ds_cfg->set_name(
"track_event");
94 ds_cfg->set_track_event_config_raw(track_event_cfg.SerializeAsString());
96 args.shmem_size_hint_kb = shmem_size_hint;
99 args.backends |= ::perfetto::kInProcessBackend;
102 args.backends |= ::perfetto::kSystemBackend;
104 ::perfetto::Tracing::Initialize(args);
105 ::perfetto::TrackEvent::Register();
107 _session = ::perfetto::Tracing::NewTrace();
108 _session->Setup(cfg);
109 _session->StartBlocking();
References DEBUG_PRINT_HERE, get_config(), and label().
◆ label()
std::string tim::component::perfetto_trace::label |
( |
| ) |
|
|
static |
◆ set_prefix()
void tim::component::perfetto_trace::set_prefix |
( |
const char * |
_prefix | ) |
|
◆ start() [1/2]
void tim::component::perfetto_trace::start |
( |
| ) |
|
Definition at line 186 of file perfetto.cpp.
189 backend::perfetto::trace_event_start<TIMEMORY_PERFETTO_API>(m_prefix);
◆ start() [2/2]
void tim::component::perfetto_trace::start |
( |
const char * |
_label | ) |
|
Definition at line 194 of file perfetto.cpp.
196 backend::perfetto::trace_event_start<TIMEMORY_PERFETTO_API>(_label);
◆ stop()
void tim::component::perfetto_trace::stop |
( |
| ) |
|
Definition at line 201 of file perfetto.cpp.
203 backend::perfetto::trace_event_stop<TIMEMORY_PERFETTO_API>();
◆ store() [1/2]
void tim::component::perfetto_trace::store |
( |
const char * |
_label, |
|
|
Tp |
_val, |
|
|
enable_if_t< std::is_integral< Tp >::value, int > |
= 0 |
|
) |
| |
Definition at line 120 of file perfetto.hpp.
123 backend::perfetto::trace_counter<TIMEMORY_PERFETTO_API>(_label, _val);
◆ store() [2/2]
void tim::component::perfetto_trace::store |
( |
Tp |
_val, |
|
|
enable_if_t< std::is_integral< Tp >::value, int > |
= 0 |
|
) |
| |
Definition at line 111 of file perfetto.hpp.
115 backend::perfetto::trace_counter(m_prefix, _val);
The documentation for this struct was generated from the following files: