Flutter Engine
The Flutter Engine
Classes | Typedefs | Functions
fml::tracing Namespace Reference

Classes

class  ScopedInstantEnd
 
class  TraceFlow
 

Typedefs

using TraceArg = const char *
 
using TraceIDArg = int64_t
 
typedef void(* TimelineEventHandler) (const char *, int64_t, int64_t, intptr_t, const int64_t *, Dart_Timeline_Event_Type, intptr_t, const char **, const char **)
 
using TimelineMicrosSource = int64_t(*)()
 

Functions

void TraceSetAllowlist (const std::vector< std::string > &allowlist)
 
void TraceSetTimelineEventHandler (TimelineEventHandler handler)
 
bool TraceHasTimelineEventHandler ()
 
int64_t TraceGetTimelineMicros ()
 
void TraceSetTimelineMicrosSource (TimelineMicrosSource source)
 
size_t TraceNonce ()
 
void TraceTimelineEvent (TraceArg category_group, TraceArg name, int64_t timestamp_micros, TraceIDArg identifier, size_t flow_id_count, const uint64_t *flow_ids, Dart_Timeline_Event_Type type, const std::vector< const char * > &c_names, const std::vector< std::string > &values)
 
void TraceTimelineEvent (TraceArg category_group, TraceArg name, TraceIDArg identifier, size_t flow_id_count, const uint64_t *flow_ids, Dart_Timeline_Event_Type type, const std::vector< const char * > &c_names, const std::vector< std::string > &values)
 
void TraceEvent0 (TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids)
 
void TraceEvent1 (TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids, TraceArg arg1_name, TraceArg arg1_val)
 
void TraceEvent2 (TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids, TraceArg arg1_name, TraceArg arg1_val, TraceArg arg2_name, TraceArg arg2_val)
 
void TraceEventEnd (TraceArg name)
 
void TraceEventAsyncComplete (TraceArg category_group, TraceArg name, TimePoint begin, TimePoint end)
 
void TraceEventAsyncBegin0 (TraceArg category_group, TraceArg name, TraceIDArg id, size_t flow_id_count, const uint64_t *flow_ids)
 
void TraceEventAsyncEnd0 (TraceArg category_group, TraceArg name, TraceIDArg id)
 
void TraceEventAsyncBegin1 (TraceArg category_group, TraceArg name, TraceIDArg id, size_t flow_id_count, const uint64_t *flow_ids, TraceArg arg1_name, TraceArg arg1_val)
 
void TraceEventAsyncEnd1 (TraceArg category_group, TraceArg name, TraceIDArg id, TraceArg arg1_name, TraceArg arg1_val)
 
void TraceEventInstant0 (TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids)
 
void TraceEventInstant1 (TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids, TraceArg arg1_name, TraceArg arg1_val)
 
void TraceEventInstant2 (TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids, TraceArg arg1_name, TraceArg arg1_val, TraceArg arg2_name, TraceArg arg2_val)
 
void TraceEventFlowBegin0 (TraceArg category_group, TraceArg name, TraceIDArg id)
 
void TraceEventFlowStep0 (TraceArg category_group, TraceArg name, TraceIDArg id)
 
void TraceEventFlowEnd0 (TraceArg category_group, TraceArg name, TraceIDArg id)
 
std::string TraceToString (const char *string)
 
std::string TraceToString (std::string string)
 
std::string TraceToString (TimePoint point)
 
template<typename T , typename = std::enable_if_t<std::is_arithmetic<T>::value>>
std::string TraceToString (T string)
 
void SplitArgumentsCollect (std::vector< const char * > &keys, std::vector< std::string > &values)
 
template<typename Key , typename Value , typename... Args>
void SplitArgumentsCollect (std::vector< const char * > &keys, std::vector< std::string > &values, Key key, Value value, Args... args)
 
std::pair< std::vector< const char * >, std::vector< std::string > > SplitArguments ()
 
template<typename Key , typename Value , typename... Args>
std::pair< std::vector< const char * >, std::vector< std::string > > SplitArguments (Key key, Value value, Args... args)
 
template<typename... Args>
void TraceCounter (TraceArg category, TraceArg name, TraceIDArg identifier, Args... args)
 
template<typename... Args>
void TraceCounterNopHACK (TraceArg category, TraceArg name, TraceIDArg identifier, Args... args)
 
template<typename... Args>
void TraceEvent (TraceArg category, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids, Args... args)
 
template<typename... Args>
void TraceEventAsyncComplete (TraceArg category_group, TraceArg name, TimePoint begin, TimePoint end, Args... args)
 

Typedef Documentation

◆ TimelineEventHandler

typedef void(* fml::tracing::TimelineEventHandler) (const char *, int64_t, int64_t, intptr_t, const int64_t *, Dart_Timeline_Event_Type, intptr_t, const char **, const char **)

Definition at line 217 of file trace_event.h.

◆ TimelineMicrosSource

using fml::tracing::TimelineMicrosSource = typedef int64_t (*)()

Definition at line 227 of file trace_event.h.

◆ TraceArg

using fml::tracing::TraceArg = typedef const char*

Definition at line 212 of file trace_event.h.

◆ TraceIDArg

using fml::tracing::TraceIDArg = typedef int64_t

Definition at line 213 of file trace_event.h.

Function Documentation

◆ SplitArguments() [1/2]

std::pair< std::vector< const char * >, std::vector< std::string > > fml::tracing::SplitArguments ( )
inline

Definition at line 288 of file trace_event.h.

288 {
289 return {};
290}

◆ SplitArguments() [2/2]

template<typename Key , typename Value , typename... Args>
std::pair< std::vector< const char * >, std::vector< std::string > > fml::tracing::SplitArguments ( Key  key,
Value  value,
Args...  args 
)

Definition at line 294 of file trace_event.h.

294 {
295 std::vector<const char*> keys;
296 std::vector<std::string> values;
298 return std::make_pair(std::move(keys), std::move(values));
299}
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint8_t value
void SplitArgumentsCollect(std::vector< const char * > &keys, std::vector< std::string > &values, Key key, Value value, Args... args)
Definition: trace_event.h:277

◆ SplitArgumentsCollect() [1/2]

void fml::tracing::SplitArgumentsCollect ( std::vector< const char * > &  keys,
std::vector< std::string > &  values 
)
inline

Definition at line 273 of file trace_event.h.

274 {}

◆ SplitArgumentsCollect() [2/2]

template<typename Key , typename Value , typename... Args>
void fml::tracing::SplitArgumentsCollect ( std::vector< const char * > &  keys,
std::vector< std::string > &  values,
Key  key,
Value  value,
Args...  args 
)

Definition at line 277 of file trace_event.h.

281 {
282 keys.emplace_back(key);
283 values.emplace_back(TraceToString(value));
285}
std::string TraceToString(T string)
Definition: trace_event.h:269

◆ TraceCounter()

template<typename... Args>
void fml::tracing::TraceCounter ( TraceArg  category,
TraceArg  name,
TraceIDArg  identifier,
Args...  args 
)

Definition at line 304 of file trace_event.h.

307 {
308#if FLUTTER_TIMELINE_ENABLED
309 auto split = SplitArguments(args...);
310 TraceTimelineEvent(category, name, identifier, /*flow_id_count=*/0,
311 /*flow_ids=*/nullptr, Dart_Timeline_Event_Counter,
312 split.first, split.second);
313#endif // FLUTTER_TIMELINE_ENABLED
314}
static SkString identifier(const FontFamilyDesc &family, const FontDesc &font)
@ Dart_Timeline_Event_Counter
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
void TraceTimelineEvent(TraceArg category_group, TraceArg name, int64_t timestamp_micros, TraceIDArg identifier, size_t flow_id_count, const uint64_t *flow_ids, Dart_Timeline_Event_Type type, const std::vector< const char * > &c_names, const std::vector< std::string > &values)
Definition: trace_event.cc:389
std::pair< std::vector< const char * >, std::vector< std::string > > SplitArguments(Key key, Value value, Args... args)
Definition: trace_event.h:294

◆ TraceCounterNopHACK()

template<typename... Args>
void fml::tracing::TraceCounterNopHACK ( TraceArg  category,
TraceArg  name,
TraceIDArg  identifier,
Args...  args 
)

Definition at line 319 of file trace_event.h.

322 {}

◆ TraceEvent()

template<typename... Args>
void fml::tracing::TraceEvent ( TraceArg  category,
TraceArg  name,
size_t  flow_id_count,
const uint64_t *  flow_ids,
Args...  args 
)

Definition at line 325 of file trace_event.h.

329 {
330#if FLUTTER_TIMELINE_ENABLED
331 auto split = SplitArguments(args...);
332 TraceTimelineEvent(category, name, 0, flow_id_count, flow_ids,
333 Dart_Timeline_Event_Begin, split.first, split.second);
334#endif // FLUTTER_TIMELINE_ENABLED
335}
@ Dart_Timeline_Event_Begin

◆ TraceEvent0()

void fml::tracing::TraceEvent0 ( TraceArg  category_group,
TraceArg  name,
size_t  flow_id_count,
const uint64_t *  flow_ids 
)

Definition at line 408 of file trace_event.cc.

411 {}

◆ TraceEvent1()

void fml::tracing::TraceEvent1 ( TraceArg  category_group,
TraceArg  name,
size_t  flow_id_count,
const uint64_t *  flow_ids,
TraceArg  arg1_name,
TraceArg  arg1_val 
)

Definition at line 413 of file trace_event.cc.

418 {}

◆ TraceEvent2()

void fml::tracing::TraceEvent2 ( TraceArg  category_group,
TraceArg  name,
size_t  flow_id_count,
const uint64_t *  flow_ids,
TraceArg  arg1_name,
TraceArg  arg1_val,
TraceArg  arg2_name,
TraceArg  arg2_val 
)

Definition at line 420 of file trace_event.cc.

427 {}

◆ TraceEventAsyncBegin0()

void fml::tracing::TraceEventAsyncBegin0 ( TraceArg  category_group,
TraceArg  name,
TraceIDArg  id,
size_t  flow_id_count,
const uint64_t *  flow_ids 
)

Definition at line 436 of file trace_event.cc.

440 {}

◆ TraceEventAsyncBegin1()

void fml::tracing::TraceEventAsyncBegin1 ( TraceArg  category_group,
TraceArg  name,
TraceIDArg  id,
size_t  flow_id_count,
const uint64_t *  flow_ids,
TraceArg  arg1_name,
TraceArg  arg1_val 
)

Definition at line 446 of file trace_event.cc.

452 {}

◆ TraceEventAsyncComplete() [1/2]

void fml::tracing::TraceEventAsyncComplete ( TraceArg  category_group,
TraceArg  name,
TimePoint  begin,
TimePoint  end 
)

Definition at line 431 of file trace_event.cc.

434 {}

◆ TraceEventAsyncComplete() [2/2]

template<typename... Args>
void fml::tracing::TraceEventAsyncComplete ( TraceArg  category_group,
TraceArg  name,
TimePoint  begin,
TimePoint  end,
Args...  args 
)

Definition at line 361 of file trace_event.h.

365 {
366#if FLUTTER_TIMELINE_ENABLED
367 auto identifier = TraceNonce();
368 const auto split = SplitArguments(args...);
369
370 if (begin > end) {
372 }
373
374 const int64_t begin_micros = begin.ToEpochDelta().ToMicroseconds();
375 const int64_t end_micros = end.ToEpochDelta().ToMicroseconds();
376
377 TraceTimelineEvent(category_group, // group
378 name, // name
379 begin_micros, // timestamp_micros
380 identifier, // identifier
381 0, // flow_id_count
382 nullptr, // flow_ids
384 split.first, // names
385 split.second // values
386 );
387
388 TraceTimelineEvent(category_group, // group
389 name, // name
390 end_micros, // timestamp_micros
391 identifier, // identifier
392 0, // flow_id_count
393 nullptr, // flow_ids
395 split.first, // names
396 split.second // values
397 );
398#endif // FLUTTER_TIMELINE_ENABLED
399}
void swap(sk_sp< T > &a, sk_sp< T > &b)
Definition: SkRefCnt.h:341
@ Dart_Timeline_Event_Async_Begin
@ Dart_Timeline_Event_Async_End
static const char * begin(const StringSlice &s)
Definition: editor.cpp:252
glong glong end
size_t TraceNonce()
Definition: trace_event.cc:385

◆ TraceEventAsyncEnd0()

void fml::tracing::TraceEventAsyncEnd0 ( TraceArg  category_group,
TraceArg  name,
TraceIDArg  id 
)

Definition at line 442 of file trace_event.cc.

444 {}

◆ TraceEventAsyncEnd1()

void fml::tracing::TraceEventAsyncEnd1 ( TraceArg  category_group,
TraceArg  name,
TraceIDArg  id,
TraceArg  arg1_name,
TraceArg  arg1_val 
)

Definition at line 454 of file trace_event.cc.

458 {}

◆ TraceEventEnd()

void fml::tracing::TraceEventEnd ( TraceArg  name)

Definition at line 429 of file trace_event.cc.

429{}

◆ TraceEventFlowBegin0()

void fml::tracing::TraceEventFlowBegin0 ( TraceArg  category_group,
TraceArg  name,
TraceIDArg  id 
)

Definition at line 481 of file trace_event.cc.

483 {}

◆ TraceEventFlowEnd0()

void fml::tracing::TraceEventFlowEnd0 ( TraceArg  category_group,
TraceArg  name,
TraceIDArg  id 
)

Definition at line 489 of file trace_event.cc.

489 {
490}

◆ TraceEventFlowStep0()

void fml::tracing::TraceEventFlowStep0 ( TraceArg  category_group,
TraceArg  name,
TraceIDArg  id 
)

Definition at line 485 of file trace_event.cc.

487 {}

◆ TraceEventInstant0()

void fml::tracing::TraceEventInstant0 ( TraceArg  category_group,
TraceArg  name,
size_t  flow_id_count,
const uint64_t *  flow_ids 
)

Definition at line 460 of file trace_event.cc.

463 {}

◆ TraceEventInstant1()

void fml::tracing::TraceEventInstant1 ( TraceArg  category_group,
TraceArg  name,
size_t  flow_id_count,
const uint64_t *  flow_ids,
TraceArg  arg1_name,
TraceArg  arg1_val 
)

Definition at line 465 of file trace_event.cc.

470 {}

◆ TraceEventInstant2()

void fml::tracing::TraceEventInstant2 ( TraceArg  category_group,
TraceArg  name,
size_t  flow_id_count,
const uint64_t *  flow_ids,
TraceArg  arg1_name,
TraceArg  arg1_val,
TraceArg  arg2_name,
TraceArg  arg2_val 
)

Definition at line 472 of file trace_event.cc.

479 {}

◆ TraceGetTimelineMicros()

int64_t fml::tracing::TraceGetTimelineMicros ( )

Definition at line 379 of file trace_event.cc.

379 {
380 return -1;
381}

◆ TraceHasTimelineEventHandler()

bool fml::tracing::TraceHasTimelineEventHandler ( )

Definition at line 375 of file trace_event.cc.

375 {
376 return false;
377}

◆ TraceNonce()

size_t fml::tracing::TraceNonce ( )

Definition at line 385 of file trace_event.cc.

385 {
386 return 0;
387}

◆ TraceSetAllowlist()

void fml::tracing::TraceSetAllowlist ( const std::vector< std::string > &  allowlist)

Definition at line 371 of file trace_event.cc.

371{}

◆ TraceSetTimelineEventHandler()

void fml::tracing::TraceSetTimelineEventHandler ( TimelineEventHandler  handler)

Definition at line 373 of file trace_event.cc.

373{}

◆ TraceSetTimelineMicrosSource()

void fml::tracing::TraceSetTimelineMicrosSource ( TimelineMicrosSource  source)

Definition at line 383 of file trace_event.cc.

383{}

◆ TraceTimelineEvent() [1/2]

void fml::tracing::TraceTimelineEvent ( TraceArg  category_group,
TraceArg  name,
int64_t  timestamp_micros,
TraceIDArg  identifier,
size_t  flow_id_count,
const uint64_t *  flow_ids,
Dart_Timeline_Event_Type  type,
const std::vector< const char * > &  c_names,
const std::vector< std::string > &  values 
)

Definition at line 389 of file trace_event.cc.

397 {}

◆ TraceTimelineEvent() [2/2]

void fml::tracing::TraceTimelineEvent ( TraceArg  category_group,
TraceArg  name,
TraceIDArg  identifier,
size_t  flow_id_count,
const uint64_t *  flow_ids,
Dart_Timeline_Event_Type  type,
const std::vector< const char * > &  c_names,
const std::vector< std::string > &  values 
)

Definition at line 399 of file trace_event.cc.

406 {}

◆ TraceToString() [1/4]

std::string fml::tracing::TraceToString ( const char *  string)
inline

Definition at line 256 of file trace_event.h.

256 {
257 return std::string{string};
258}

◆ TraceToString() [2/4]

std::string fml::tracing::TraceToString ( std::string  string)
inline

Definition at line 260 of file trace_event.h.

260 {
261 return string;
262}

◆ TraceToString() [3/4]

template<typename T , typename = std::enable_if_t<std::is_arithmetic<T>::value>>
std::string fml::tracing::TraceToString ( T  string)

Definition at line 269 of file trace_event.h.

269 {
270 return std::to_string(string);
271}
static SkString to_string(int n)
Definition: nanobench.cpp:119

◆ TraceToString() [4/4]

std::string fml::tracing::TraceToString ( TimePoint  point)
inline

Definition at line 264 of file trace_event.h.

264 {
265 return std::to_string(point.ToEpochDelta().ToNanoseconds());
266}
constexpr int64_t ToNanoseconds() const
Definition: time_delta.h:61
TimeDelta ToEpochDelta() const
Definition: time_point.h:52