Flutter Engine
The Flutter Engine
SkDebugfTracer.cpp
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
10
11#include <inttypes.h>
12
14 const uint8_t* categoryEnabledFlag,
15 const char* name,
16 uint64_t id,
17 int numArgs,
18 const char** argNames,
19 const uint8_t* argTypes,
20 const uint64_t* argValues,
21 uint8_t flags) {
23 for (int i = 0; i < numArgs; ++i) {
24 if (i > 0) {
25 args.append(", ");
26 } else {
27 args.append(" ");
28 }
29
30 uint64_t value = argValues[i];
31 switch (argTypes[i]) {
33 args.appendf("%s=%s", argNames[i], value ? "true" : "false");
34 break;
36 args.appendf("%s=%" PRIu64, argNames[i], value);
37 break;
39 args.appendf("%s=%" PRIi64, argNames[i], static_cast<int64_t>(value));
40 break;
42 args.appendf("%s=%g", argNames[i], sk_bit_cast<double>(value));
43 break;
45 args.appendf("%s=0x%p", argNames[i], skia_private::TraceValueAsPointer(value));
46 break;
49 static constexpr size_t kMaxLen = 20;
51 size_t truncAt = string.size();
52 size_t newLineAt = SkStrFind(string.c_str(), "\n");
53 if (newLineAt > 0) {
54 truncAt = newLineAt;
55 }
56 truncAt = std::min(truncAt, kMaxLen);
57 if (truncAt < string.size()) {
58 string.resize(truncAt);
59 string.append("...");
60 }
61 args.appendf("%s=\"%s\"", argNames[i], string.c_str());
62 break;
63 }
64 default:
65 args.appendf("%s=<unknown type>", argNames[i]);
66 break;
67 }
68 }
69 bool open = (phase == TRACE_EVENT_PHASE_COMPLETE);
70 if (open) {
71 const char* category = this->getCategoryGroupName(categoryEnabledFlag);
72 SkDebugf("[% 2d]%s <%s> %s%s #%d {\n", (int)fIndent.size(), fIndent.c_str(), category, name,
73 args.c_str(), fCnt);
74 fIndent.append(" ");
75 } else {
76 SkDebugf("%s%s #%d\n", name, args.c_str(), fCnt);
77 }
78 ++fCnt;
79 return 0;
80}
81
82void SkDebugfTracer::updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
83 const char* name,
84 SkEventTracer::Handle handle) {
85 fIndent.resize(fIndent.size() - 1);
86 SkDebugf("[% 2d]%s } %s\n", (int)fIndent.size(), fIndent.c_str(), name);
87}
88
90 SkDebugf("\n\n- - - New tracing section: %s - - -\n", name);
91}
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static int SkStrFind(const char string[], const char substring[])
Definition: SkString.h:41
#define TRACE_VALUE_TYPE_STRING
#define TRACE_VALUE_TYPE_BOOL
#define TRACE_VALUE_TYPE_POINTER
#define TRACE_VALUE_TYPE_COPY_STRING
#define TRACE_VALUE_TYPE_INT
#define TRACE_VALUE_TYPE_UINT
#define TRACE_VALUE_TYPE_DOUBLE
#define TRACE_EVENT_PHASE_COMPLETE
void updateTraceEventDuration(const uint8_t *categoryEnabledFlag, const char *name, SkEventTracer::Handle handle) override
const char * getCategoryGroupName(const uint8_t *categoryEnabledFlag) override
void newTracingSection(const char *name) 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
uint64_t Handle
Definition: SkEventTracer.h:26
size_t size() const
Definition: SkString.h:131
void append(const char text[])
Definition: SkString.h:203
void resize(size_t len)
Definition: SkString.cpp:374
const char * c_str() const
Definition: SkString.h:133
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint8_t value
static float min(float r, float g, float b)
Definition: hsl.cpp:48
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
static const void * TraceValueAsPointer(uint64_t value)
Definition: SkTraceEvent.h:300
static const char * TraceValueAsString(uint64_t value)
Definition: SkTraceEvent.h:296