Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkATrace.h
Go to the documentation of this file.
1/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkATrace_DEFINED
9#define SkATrace_DEFINED
10
12
13#include <cstdint>
14
15/**
16 * This class is used to support ATrace in android apps. It hooks into the SkEventTracer system. It
17 * currently supports the macros TRACE_EVENT*, TRACE_EVENT_INSTANT*, and TRACE_EVENT_BEGIN/END*.
18 * For versions of these calls that take additoinal args and value pairs we currently just drop them
19 * and report only the name. Since ATrace is a simple push and pop system (all traces are fully
20 * nested), if using BEGIN and END you should also make sure your calls are properly nested (i.e. if
21 * startA is before startB, then endB is before endA).
22 */
23class SkATrace : public SkEventTracer {
24public:
25 SkATrace();
26
28 const uint8_t* categoryEnabledFlag,
29 const char* name,
30 uint64_t id,
31 int numArgs,
32 const char** argNames,
33 const uint8_t* argTypes,
34 const uint64_t* argValues,
35 uint8_t flags) override;
36
37
38 void updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
39 const char* name,
40 SkEventTracer::Handle handle) override;
41
42 const uint8_t* getCategoryGroupEnabled(const char* name) override;
43
44 const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) override {
45 static const char* category = "skiaATrace";
46 return category;
47 }
48
49 // Atrace does not yet support splitting up trace output into sections.
50 void newTracingSection(const char* name) override {}
51
52private:
53 SkATrace(const SkATrace&) = delete;
54 SkATrace& operator=(const SkATrace&) = delete;
55
56 void (*fBeginSection)(const char*);
57 void (*fEndSection)(void);
58 bool (*fIsEnabled)(void);
59};
60
61#endif
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
Definition SkATrace.cpp:39
const uint8_t * getCategoryGroupEnabled(const char *name) override
Definition SkATrace.cpp:70
const char * getCategoryGroupName(const uint8_t *categoryEnabledFlag) override
Definition SkATrace.h:44
void updateTraceEventDuration(const uint8_t *categoryEnabledFlag, const char *name, SkEventTracer::Handle handle) override
Definition SkATrace.cpp:61
void newTracingSection(const char *name) override
Definition SkATrace.h:50
uint64_t Handle
FlutterSemanticsFlag flags
const char * name
Definition fuchsia.cc:50