Flutter Engine
The Flutter Engine
ChromeTracingTracer.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 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 ChromeTracingTracer_DEFINED
9#define ChromeTracingTracer_DEFINED
10
13#include "src/base/SkSpinlock.h"
14#include "src/core/SkTHash.h"
16
17class SkJSONWriter;
18
19/**
20 * A SkEventTracer implementation that logs events to JSON for viewing with chrome://tracing.
21 */
23public:
24 ChromeTracingTracer(const char* filename);
25 ~ChromeTracingTracer() override;
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 void updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
38 const char* name,
39 SkEventTracer::Handle handle) override;
40
41 const uint8_t* getCategoryGroupEnabled(const char* name) override {
42 return fCategories.getCategoryGroupEnabled(name);
43 }
44
45 const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) override {
46 return fCategories.getCategoryGroupName(categoryEnabledFlag);
47 }
48
49 // The Chrome tracer does not yet support splitting up trace output into sections.
50 void newTracingSection(const char* name) override {}
51
52private:
53 void flush();
54
55 enum {
56 // Events are variable size, but most commonly 48 bytes, assuming 64-bit pointers and
57 // reasonable packing. This is a first guess at a number that balances memory usage vs.
58 // time overhead of allocating blocks.
59 kBlockSize = 512 * 1024,
60 };
61
62 typedef std::unique_ptr<uint8_t[]> BlockPtr;
63 struct TraceEventBlock {
64 BlockPtr fBlock;
65 int fEventsInBlock;
66 };
67
68 void createBlock();
69
70 Handle appendEvent(const void* data, size_t size);
71
72 SkString fFilename;
73 SkSpinlock fMutex;
74 SkEventTracingCategories fCategories;
75
76 TraceEventBlock fCurBlock;
77 size_t fCurBlockUsed;
78
80};
81
82#endif
ChromeTracingTracer(const char *filename)
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
const char * getCategoryGroupName(const uint8_t *categoryEnabledFlag) override
const uint8_t * getCategoryGroupEnabled(const char *name) override
void updateTraceEventDuration(const uint8_t *categoryEnabledFlag, const char *name, SkEventTracer::Handle handle) override
void newTracingSection(const char *name) override
uint64_t Handle
Definition: SkEventTracer.h:26
const char * getCategoryGroupName(const uint8_t *categoryEnabledFlag)
uint8_t * getCategoryGroupEnabled(const char *name)
FlutterSemanticsFlag flags
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63