Flutter Engine
The Flutter Engine
Classes | Namespaces | Macros | Typedefs | Functions
trace_event.h File Reference
#include <functional>
#include "flutter/fml/build_config.h"
#include <cstddef>
#include <cstdint>
#include <string>
#include <type_traits>
#include <vector>
#include "flutter/fml/macros.h"
#include "flutter/fml/time/time_point.h"
#include "third_party/dart/runtime/include/dart_tools_api.h"

Go to the source code of this file.

Classes

class  fml::tracing::ScopedInstantEnd
 
class  fml::tracing::TraceFlow
 

Namespaces

namespace  fml
 
namespace  fml::tracing
 

Macros

#define FLUTTER_TIMELINE_ENABLED   1
 
#define __FML__TOKEN_CAT__(x, y)   x##y
 
#define __FML__TOKEN_CAT__2(x, y)   __FML__TOKEN_CAT__(x, y)
 
#define __FML__AUTO_TRACE_END(name)
 
#define FML_TRACE_COUNTER(category_group, name, counter_id, arg1, ...)
 
#define FML_TRACE_EVENT_WITH_FLOW_IDS(category_group, name, flow_id_count, flow_ids, ...)
 
#define FML_TRACE_EVENT(category_group, name, ...)
 
#define TRACE_EVENT0_WITH_FLOW_IDS(category_group, name, flow_id_count, flow_ids)
 
#define TRACE_EVENT0(category_group, name)
 
#define TRACE_EVENT1_WITH_FLOW_IDS(category_group, name, flow_id_count, flow_ids, arg1_name, arg1_val)
 
#define TRACE_EVENT1(category_group, name, arg1_name, arg1_val)
 
#define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, arg2_val)
 
#define TRACE_EVENT_ASYNC_BEGIN0_WITH_FLOW_IDS(category_group, name, id, flow_id_count, flow_ids)
 
#define TRACE_EVENT_ASYNC_BEGIN0(category_group, name, id)
 
#define TRACE_EVENT_ASYNC_END0(category_group, name, id)    ::fml::tracing::TraceEventAsyncEnd0(category_group, name, id);
 
#define TRACE_EVENT_ASYNC_BEGIN1(category_group, name, id, arg1_name, arg1_val)
 
#define TRACE_EVENT_ASYNC_END1(category_group, name, id, arg1_name, arg1_val)
 
#define TRACE_EVENT_INSTANT0(category_group, name)
 
#define TRACE_EVENT_INSTANT1(category_group, name, arg1_name, arg1_val)
 
#define TRACE_EVENT_INSTANT2(category_group, name, arg1_name, arg1_val, arg2_name, arg2_val)
 
#define TRACE_FLOW_BEGIN(category, name, id)    ::fml::tracing::TraceEventFlowBegin0(category, name, id);
 
#define TRACE_FLOW_STEP(category, name, id)    ::fml::tracing::TraceEventFlowStep0(category, name, id);
 
#define TRACE_FLOW_END(category, name, id)    ::fml::tracing::TraceEventFlowEnd0(category, name, id);
 
#define TRACE_EVENT2_INT(category_group, name, arg1_name, arg1_val, arg2_name, arg2_val)
 

Typedefs

using fml::tracing::TraceArg = const char *
 
using fml::tracing::TraceIDArg = int64_t
 
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 **)
 
using fml::tracing::TimelineMicrosSource = int64_t(*)()
 

Functions

void fml::tracing::TraceSetAllowlist (const std::vector< std::string > &allowlist)
 
void fml::tracing::TraceSetTimelineEventHandler (TimelineEventHandler handler)
 
bool fml::tracing::TraceHasTimelineEventHandler ()
 
void fml::tracing::TraceSetTimelineMicrosSource (TimelineMicrosSource source)
 
int64_t fml::tracing::TraceGetTimelineMicros ()
 
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)
 
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)
 
std::string fml::tracing::TraceToString (const char *string)
 
std::string fml::tracing::TraceToString (std::string string)
 
std::string fml::tracing::TraceToString (TimePoint point)
 
template<typename T , typename = std::enable_if_t<std::is_arithmetic<T>::value>>
std::string fml::tracing::TraceToString (T string)
 
void fml::tracing::SplitArgumentsCollect (std::vector< const char * > &keys, std::vector< std::string > &values)
 
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)
 
std::pair< std::vector< const char * >, std::vector< std::string > > fml::tracing::SplitArguments ()
 
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)
 
size_t fml::tracing::TraceNonce ()
 
template<typename... Args>
void fml::tracing::TraceCounter (TraceArg category, TraceArg name, TraceIDArg identifier, Args... args)
 
template<typename... Args>
void fml::tracing::TraceCounterNopHACK (TraceArg category, TraceArg name, TraceIDArg identifier, Args... args)
 
template<typename... Args>
void fml::tracing::TraceEvent (TraceArg category, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids, Args... args)
 
void fml::tracing::TraceEvent0 (TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids)
 
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)
 
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)
 
void fml::tracing::TraceEventEnd (TraceArg name)
 
template<typename... Args>
void fml::tracing::TraceEventAsyncComplete (TraceArg category_group, TraceArg name, TimePoint begin, TimePoint end, Args... args)
 
void fml::tracing::TraceEventAsyncBegin0 (TraceArg category_group, TraceArg name, TraceIDArg id, size_t flow_id_count, const uint64_t *flow_ids)
 
void fml::tracing::TraceEventAsyncEnd0 (TraceArg category_group, TraceArg name, TraceIDArg id)
 
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)
 
void fml::tracing::TraceEventAsyncEnd1 (TraceArg category_group, TraceArg name, TraceIDArg id, TraceArg arg1_name, TraceArg arg1_val)
 
void fml::tracing::TraceEventInstant0 (TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids)
 
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)
 
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)
 
void fml::tracing::TraceEventFlowBegin0 (TraceArg category_group, TraceArg name, TraceIDArg id)
 
void fml::tracing::TraceEventFlowStep0 (TraceArg category_group, TraceArg name, TraceIDArg id)
 
void fml::tracing::TraceEventFlowEnd0 (TraceArg category_group, TraceArg name, TraceIDArg id)
 

Macro Definition Documentation

◆ __FML__AUTO_TRACE_END

#define __FML__AUTO_TRACE_END (   name)
Value:
__LINE__)(name);
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
#define __FML__TOKEN_CAT__2(x, y)
Definition: trace_event.h:76

Definition at line 77 of file trace_event.h.

◆ __FML__TOKEN_CAT__

#define __FML__TOKEN_CAT__ (   x,
  y 
)    x##y

Definition at line 75 of file trace_event.h.

◆ __FML__TOKEN_CAT__2

#define __FML__TOKEN_CAT__2 (   x,
  y 
)    __FML__TOKEN_CAT__(x, y)

Definition at line 76 of file trace_event.h.

◆ FLUTTER_TIMELINE_ENABLED

#define FLUTTER_TIMELINE_ENABLED   1

Definition at line 69 of file trace_event.h.

◆ FML_TRACE_COUNTER

#define FML_TRACE_COUNTER (   category_group,
  name,
  counter_id,
  arg1,
  ... 
)
Value:
::fml::tracing::TraceCounter((category_group), (name), (counter_id), (arg1), \
__VA_ARGS__);
void TraceCounter(TraceArg category, TraceArg name, TraceIDArg identifier, Args... args)
Definition: trace_event.h:304

Definition at line 85 of file trace_event.h.

◆ FML_TRACE_EVENT

#define FML_TRACE_EVENT (   category_group,
  name,
  ... 
)
Value:
FML_TRACE_EVENT_WITH_FLOW_IDS((category_group), (name), \
/*flow_id_count=*/(0), /*flow_ids=*/(nullptr), \
__VA_ARGS__)
#define FML_TRACE_EVENT_WITH_FLOW_IDS(category_group, name, flow_id_count, flow_ids,...)
Definition: trace_event.h:102

Definition at line 121 of file trace_event.h.

◆ FML_TRACE_EVENT_WITH_FLOW_IDS

#define FML_TRACE_EVENT_WITH_FLOW_IDS (   category_group,
  name,
  flow_id_count,
  flow_ids,
  ... 
)
Value:
::fml::tracing::TraceEvent((category_group), (name), (flow_id_count), \
(flow_ids), __VA_ARGS__); \
__FML__AUTO_TRACE_END(name)
void TraceEvent(TraceArg category, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids, Args... args)
Definition: trace_event.h:325

Definition at line 102 of file trace_event.h.

◆ TRACE_EVENT0

#define TRACE_EVENT0 (   category_group,
  name 
)
Value:
TRACE_EVENT0_WITH_FLOW_IDS(category_group, name, /*flow_id_count=*/0, \
/*flow_ids=*/nullptr)
#define TRACE_EVENT0_WITH_FLOW_IDS(category_group, name, flow_id_count, flow_ids)
Definition: trace_event.h:126

Definition at line 131 of file trace_event.h.

◆ TRACE_EVENT0_WITH_FLOW_IDS

#define TRACE_EVENT0_WITH_FLOW_IDS (   category_group,
  name,
  flow_id_count,
  flow_ids 
)
Value:
::fml::tracing::TraceEvent0(category_group, name, flow_id_count, flow_ids); \
__FML__AUTO_TRACE_END(name)
void TraceEvent0(TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids)
Definition: trace_event.cc:408

Definition at line 126 of file trace_event.h.

◆ TRACE_EVENT1

#define TRACE_EVENT1 (   category_group,
  name,
  arg1_name,
  arg1_val 
)
Value:
TRACE_EVENT1_WITH_FLOW_IDS(category_group, name, /*flow_id_count=*/0, \
/*flow_ids=*/nullptr, arg1_name, arg1_val)
#define TRACE_EVENT1_WITH_FLOW_IDS(category_group, name, flow_id_count, flow_ids, arg1_name, arg1_val)
Definition: trace_event.h:135

Definition at line 141 of file trace_event.h.

◆ TRACE_EVENT1_WITH_FLOW_IDS

#define TRACE_EVENT1_WITH_FLOW_IDS (   category_group,
  name,
  flow_id_count,
  flow_ids,
  arg1_name,
  arg1_val 
)
Value:
::fml::tracing::TraceEvent1(category_group, name, flow_id_count, flow_ids, \
arg1_name, arg1_val); \
__FML__AUTO_TRACE_END(name)
void TraceEvent1(TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids, TraceArg arg1_name, TraceArg arg1_val)
Definition: trace_event.cc:413

Definition at line 135 of file trace_event.h.

◆ TRACE_EVENT2

#define TRACE_EVENT2 (   category_group,
  name,
  arg1_name,
  arg1_val,
  arg2_name,
  arg2_val 
)
Value:
::fml::tracing::TraceEvent2(category_group, name, /*flow_id_count=*/0, \
/*flow_ids=*/nullptr, arg1_name, arg1_val, \
arg2_name, arg2_val); \
__FML__AUTO_TRACE_END(name)
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)
Definition: trace_event.cc:420

Definition at line 145 of file trace_event.h.

◆ TRACE_EVENT2_INT

#define TRACE_EVENT2_INT (   category_group,
  name,
  arg1_name,
  arg1_val,
  arg2_name,
  arg2_val 
)
Value:
const auto __arg1_val_str = std::to_string(arg1_val); \
const auto __arg2_val_str = std::to_string(arg2_val); \
TRACE_EVENT2(category_group, name, arg1_name, __arg1_val_str.c_str(), \
arg2_name, __arg2_val_str.c_str());
static SkString to_string(int n)
Definition: nanobench.cpp:119

Definition at line 202 of file trace_event.h.

◆ TRACE_EVENT_ASYNC_BEGIN0

#define TRACE_EVENT_ASYNC_BEGIN0 (   category_group,
  name,
  id 
)
Value:
category_group, name, id, /*flow_id_count=*/0, /*flow_ids=*/nullptr)
#define TRACE_EVENT_ASYNC_BEGIN0_WITH_FLOW_IDS(category_group, name, id, flow_id_count, flow_ids)
Definition: trace_event.h:152

Definition at line 157 of file trace_event.h.

◆ TRACE_EVENT_ASYNC_BEGIN0_WITH_FLOW_IDS

#define TRACE_EVENT_ASYNC_BEGIN0_WITH_FLOW_IDS (   category_group,
  name,
  id,
  flow_id_count,
  flow_ids 
)
Value:
flow_id_count, flow_ids);
void TraceEventAsyncBegin0(TraceArg category_group, TraceArg name, TraceIDArg id, size_t flow_id_count, const uint64_t *flow_ids)
Definition: trace_event.cc:436

Definition at line 152 of file trace_event.h.

◆ TRACE_EVENT_ASYNC_BEGIN1

#define TRACE_EVENT_ASYNC_BEGIN1 (   category_group,
  name,
  id,
  arg1_name,
  arg1_val 
)
Value:
category_group, name, id, /*flow_id_count=*/0, /*flow_ids=*/nullptr, \
arg1_name, arg1_val);
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)
Definition: trace_event.cc:446

Definition at line 164 of file trace_event.h.

◆ TRACE_EVENT_ASYNC_END0

#define TRACE_EVENT_ASYNC_END0 (   category_group,
  name,
  id 
)     ::fml::tracing::TraceEventAsyncEnd0(category_group, name, id);

Definition at line 161 of file trace_event.h.

◆ TRACE_EVENT_ASYNC_END1

#define TRACE_EVENT_ASYNC_END1 (   category_group,
  name,
  id,
  arg1_name,
  arg1_val 
)
Value:
category_group, name, id, /*flow_id_count=*/0, /*flow_ids=*/nullptr, \
arg1_name, arg1_val);
void TraceEventAsyncEnd1(TraceArg category_group, TraceArg name, TraceIDArg id, TraceArg arg1_name, TraceArg arg1_val)
Definition: trace_event.cc:454

Definition at line 170 of file trace_event.h.

◆ TRACE_EVENT_INSTANT0

#define TRACE_EVENT_INSTANT0 (   category_group,
  name 
)
Value:
category_group, name, /*flow_id_count=*/0, /*flow_ids=*/nullptr);
void TraceEventInstant0(TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids)
Definition: trace_event.cc:460

Definition at line 175 of file trace_event.h.

◆ TRACE_EVENT_INSTANT1

#define TRACE_EVENT_INSTANT1 (   category_group,
  name,
  arg1_name,
  arg1_val 
)
Value:
category_group, name, /*flow_id_count=*/0, /*flow_ids=*/nullptr, \
arg1_name, arg1_val);
void TraceEventInstant1(TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids, TraceArg arg1_name, TraceArg arg1_val)
Definition: trace_event.cc:465

Definition at line 179 of file trace_event.h.

◆ TRACE_EVENT_INSTANT2

#define TRACE_EVENT_INSTANT2 (   category_group,
  name,
  arg1_name,
  arg1_val,
  arg2_name,
  arg2_val 
)
Value:
category_group, name, /*flow_id_count=*/0, /*flow_ids=*/nullptr, \
arg1_name, arg1_val, arg2_name, arg2_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)
Definition: trace_event.cc:472

Definition at line 184 of file trace_event.h.

◆ TRACE_FLOW_BEGIN

#define TRACE_FLOW_BEGIN (   category,
  name,
  id 
)     ::fml::tracing::TraceEventFlowBegin0(category, name, id);

Definition at line 190 of file trace_event.h.

◆ TRACE_FLOW_END

#define TRACE_FLOW_END (   category,
  name,
  id 
)     ::fml::tracing::TraceEventFlowEnd0(category, name, id);

Definition at line 196 of file trace_event.h.

◆ TRACE_FLOW_STEP

#define TRACE_FLOW_STEP (   category,
  name,
  id 
)     ::fml::tracing::TraceEventFlowStep0(category, name, id);

Definition at line 193 of file trace_event.h.