Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
SkEventTracer Class Referenceabstract

#include <SkEventTracer.h>

Inheritance diagram for SkEventTracer:
ChromeTracingTracer SkATrace SkDebugfTracer SkDefaultEventTracer SkPerfettoTrace flutter::FlutterEventTracer

Public Types

enum  CategoryGroupEnabledFlags { kEnabledForRecording_CategoryGroupEnabledFlags = 1 << 0 , kEnabledForMonitoring_CategoryGroupEnabledFlags = 1 << 1 , kEnabledForEventCallback_CategoryGroupEnabledFlags = 1 << 2 }
 
typedef uint64_t Handle
 

Public Member Functions

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 *)
 

Static Public Member Functions

static bool SetInstance (SkEventTracer *, bool leakTracer=false)
 
static SkEventTracerGetInstance ()
 

Protected Member Functions

 SkEventTracer ()=default
 
 SkEventTracer (const SkEventTracer &)=delete
 
SkEventTraceroperator= (const SkEventTracer &)=delete
 

Detailed Description

Definition at line 23 of file SkEventTracer.h.

Member Typedef Documentation

◆ Handle

typedef uint64_t SkEventTracer::Handle

Definition at line 26 of file SkEventTracer.h.

Member Enumeration Documentation

◆ CategoryGroupEnabledFlags

Enumerator
kEnabledForRecording_CategoryGroupEnabledFlags 
kEnabledForMonitoring_CategoryGroupEnabledFlags 
kEnabledForEventCallback_CategoryGroupEnabledFlags 

Definition at line 53 of file SkEventTracer.h.

53 {
54 // Category group enabled for the recording mode.
56 // Category group enabled for the monitoring mode.
58 // Category group enabled by SetEventCallbackEnabled().
60 };
@ kEnabledForRecording_CategoryGroupEnabledFlags
Definition: SkEventTracer.h:55
@ kEnabledForEventCallback_CategoryGroupEnabledFlags
Definition: SkEventTracer.h:59
@ kEnabledForMonitoring_CategoryGroupEnabledFlags
Definition: SkEventTracer.h:57

Constructor & Destructor Documentation

◆ ~SkEventTracer()

virtual SkEventTracer::~SkEventTracer ( )
virtualdefault

◆ SkEventTracer() [1/2]

SkEventTracer::SkEventTracer ( )
protecteddefault

◆ SkEventTracer() [2/2]

SkEventTracer::SkEventTracer ( const SkEventTracer )
protecteddelete

Member Function Documentation

◆ addTraceEvent()

virtual SkEventTracer::Handle SkEventTracer::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 
)
pure virtual

◆ getCategoryGroupEnabled()

virtual const uint8_t * SkEventTracer::getCategoryGroupEnabled ( const char *  name)
pure virtual

◆ getCategoryGroupName()

virtual const char * SkEventTracer::getCategoryGroupName ( const uint8_t *  categoryEnabledFlag)
pure virtual

◆ GetInstance()

SkEventTracer * SkEventTracer::GetInstance ( )
static

Gets the event tracer. If this is the first call to SetInstance or GetIntance then a default event tracer is installed and returned.

Definition at line 63 of file SkEventTracer.cpp.

63 {
64 if (auto tracer = gUserTracer.load(std::memory_order_acquire)) {
65 return tracer;
66 }
67 static SkOnce once;
68 static SkDefaultEventTracer* defaultTracer;
69 once([] { defaultTracer = new SkDefaultEventTracer; });
70 return defaultTracer;
71}
static std::atomic< SkEventTracer * > gUserTracer
Definition: SkOnce.h:22

◆ newTracingSection()

virtual void SkEventTracer::newTracingSection ( const char *  )
inlinevirtual

Reimplemented in SkATrace, ChromeTracingTracer, SkDebugfTracer, and SkPerfettoTrace.

Definition at line 82 of file SkEventTracer.h.

82{}

◆ operator=()

SkEventTracer & SkEventTracer::operator= ( const SkEventTracer )
protecteddelete

◆ SetInstance()

bool SkEventTracer::SetInstance ( SkEventTracer tracer,
bool  leakTracer = false 
)
static

If this is the first call to SetInstance or GetInstance then the passed instance is installed and true is returned. Otherwise, false is returned. In either case ownership of the tracer is transferred and it will be deleted when no longer needed.

Not deleting the tracer on process exit should not cause problems as the whole heap is about to go away with the process. This can also improve performance by reducing the amount of work needed.

Parameters
leakTracerDo not delete tracer on process exit.

Definition at line 49 of file SkEventTracer.cpp.

49 {
50 SkEventTracer* expected = nullptr;
51 if (!gUserTracer.compare_exchange_strong(expected, tracer)) {
52 delete tracer;
53 return false;
54 }
55 // If leaking the tracer is accepted then there is no need to install
56 // the atexit.
57 if (!leakTracer) {
58 atexit([]() { delete gUserTracer.load(); });
59 }
60 return true;
61}

◆ updateTraceEventDuration()

virtual void SkEventTracer::updateTraceEventDuration ( const uint8_t *  categoryEnabledFlag,
const char *  name,
SkEventTracer::Handle  handle 
)
pure virtual

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