Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkPerfettoTrace Class Reference

#include <SkPerfettoTrace.h>

Inheritance diagram for SkPerfettoTrace:
SkEventTracer

Public Member Functions

 SkPerfettoTrace ()
 
 ~SkPerfettoTrace () override
 
SkEventTracer::Handle addTraceEvent (char phase, const uint8_t *categoryEnabledFlag, const char *name, uint64_t id, int numArgs, const char **argNames, const uint8_t *argTypes, const uint64_t *argValues, uint8_t flags) override
 
void updateTraceEventDuration (const uint8_t *categoryEnabledFlag, const char *name, SkEventTracer::Handle handle) override
 
const uint8_t * getCategoryGroupEnabled (const char *name) override
 
const char * getCategoryGroupName (const uint8_t *categoryEnabledFlag) override
 
void newTracingSection (const char *name) override
 
- Public Member Functions inherited from SkEventTracer
virtual ~SkEventTracer ()=default
 
virtual const uint8_t * getCategoryGroupEnabled (const char *name)=0
 
virtual const char * getCategoryGroupName (const uint8_t *categoryEnabledFlag)=0
 
virtual SkEventTracer::Handle addTraceEvent (char phase, const uint8_t *categoryEnabledFlag, const char *name, uint64_t id, int32_t numArgs, const char **argNames, const uint8_t *argTypes, const uint64_t *argValues, uint8_t flags)=0
 
virtual void updateTraceEventDuration (const uint8_t *categoryEnabledFlag, const char *name, SkEventTracer::Handle handle)=0
 
virtual void newTracingSection (const char *)
 

Additional Inherited Members

- Public Types inherited from SkEventTracer
enum  CategoryGroupEnabledFlags { kEnabledForRecording_CategoryGroupEnabledFlags = 1 << 0 , kEnabledForMonitoring_CategoryGroupEnabledFlags = 1 << 1 , kEnabledForEventCallback_CategoryGroupEnabledFlags = 1 << 2 }
 
typedef uint64_t Handle
 
- Static Public Member Functions inherited from SkEventTracer
static bool SetInstance (SkEventTracer *, bool leakTracer=false)
 
static SkEventTracerGetInstance ()
 
- Protected Member Functions inherited from SkEventTracer
 SkEventTracer ()=default
 
 SkEventTracer (const SkEventTracer &)=delete
 
SkEventTraceroperator= (const SkEventTracer &)=delete
 

Detailed Description

This class is used to support Perfetto tracing. It hooks into the SkEventTracer system.

Definition at line 20 of file SkPerfettoTrace.h.

Constructor & Destructor Documentation

◆ SkPerfettoTrace()

SkPerfettoTrace::SkPerfettoTrace ( )

Definition at line 37 of file SkPerfettoTrace.cpp.

37 {
38 fOutputPath = FLAGS_perfettoOutputDir[0];
39 fOutputFileExtension = FLAGS_perfettoOutputFileExtension[0];
40 this->openNewTracingSession(FLAGS_perfettoOutputFileName[0]);
41}

◆ ~SkPerfettoTrace()

SkPerfettoTrace::~SkPerfettoTrace ( )
override

Definition at line 43 of file SkPerfettoTrace.cpp.

43 {
44 this->closeTracingSession();
45}

Member Function Documentation

◆ addTraceEvent()

SkEventTracer::Handle SkPerfettoTrace::addTraceEvent ( char  phase,
const uint8_t *  categoryEnabledFlag,
const char *  name,
uint64_t  id,
int  numArgs,
const char **  argNames,
const uint8_t *  argTypes,
const uint64_t *  argValues,
uint8_t  flags 
)
override

Definition at line 114 of file SkPerfettoTrace.cpp.

122 {
123 perfetto::DynamicCategory category{ this->getCategoryGroupName(categoryEnabledFlag) };
124 if (TRACE_EVENT_PHASE_COMPLETE == phase ||
125 TRACE_EVENT_PHASE_INSTANT == phase) {
126 switch (numArgs) {
127 case 0: {
128 this->triggerTraceEvent(categoryEnabledFlag, name);
129 break;
130 }
131 case 1: {
132 this->triggerTraceEvent(categoryEnabledFlag, name, argNames[0], argTypes[0],
133 argValues[0]);
134 break;
135 }
136 case 2: {
137 this->triggerTraceEvent(categoryEnabledFlag, name, argNames[0], argTypes[0],
138 argValues[0], argNames[1], argTypes[1], argValues[1]);
139 break;
140 }
141 }
142 } else if (TRACE_EVENT_PHASE_END == phase) {
143 TRACE_EVENT_END(category);
144 }
145
146 if (TRACE_EVENT_PHASE_INSTANT == phase) {
147 TRACE_EVENT_END(category);
148 }
149 return 0;
150}
#define TRACE_EVENT_PHASE_END
#define TRACE_EVENT_PHASE_INSTANT
#define TRACE_EVENT_PHASE_COMPLETE
const char * getCategoryGroupName(const uint8_t *categoryEnabledFlag) override
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ getCategoryGroupEnabled()

const uint8_t * SkPerfettoTrace::getCategoryGroupEnabled ( const char *  name)
overridevirtual

Implements SkEventTracer.

Definition at line 160 of file SkPerfettoTrace.cpp.

160 {
161 return fCategories.getCategoryGroupEnabled(name);
162}
uint8_t * getCategoryGroupEnabled(const char *name)

◆ getCategoryGroupName()

const char * SkPerfettoTrace::getCategoryGroupName ( const uint8_t *  categoryEnabledFlag)
overridevirtual

Implements SkEventTracer.

Definition at line 164 of file SkPerfettoTrace.cpp.

164 {
165 return fCategories.getCategoryGroupName(categoryEnabledFlag);
166}
const char * getCategoryGroupName(const uint8_t *categoryEnabledFlag)

◆ newTracingSection()

void SkPerfettoTrace::newTracingSection ( const char *  name)
overridevirtual

Reimplemented from SkEventTracer.

Definition at line 336 of file SkPerfettoTrace.cpp.

336 {
337 if (perfetto::Tracing::IsInitialized()) {
338 this->closeTracingSession();
339 }
340 this->openNewTracingSession(name);
341}

◆ updateTraceEventDuration()

void SkPerfettoTrace::updateTraceEventDuration ( const uint8_t *  categoryEnabledFlag,
const char *  name,
SkEventTracer::Handle  handle 
)
overridevirtual

Implements SkEventTracer.

Definition at line 152 of file SkPerfettoTrace.cpp.

154 {
155 // This is only ever called from a scoped trace event, so we will just end the event.
156 perfetto::DynamicCategory category{ this->getCategoryGroupName(categoryEnabledFlag) };
157 TRACE_EVENT_END(category);
158}

The documentation for this class was generated from the following files: