101 {
102#if defined(OS_FUCHSIA)
103 static trace_site_t trace_site;
104 trace_string_ref_t category_ref;
105 trace_context_t* trace_context = trace_acquire_context_for_category_cached(
106 kSkiaTag, &trace_site, &category_ref);
107
108 if (likely(!trace_context)) {
109 return 0;
110 }
111
112 trace_ticks_t ticks = zx_ticks_get();
113
114 trace_thread_ref_t thread_ref;
115 trace_context_register_current_thread(trace_context, &thread_ref);
116 trace_string_ref_t name_ref;
117 trace_context_register_string_literal(trace_context,
name, &name_ref);
118
119 constexpr int kMaxArgs = 2;
120 trace_arg_t trace_args[kMaxArgs] = {};
122 int num_trace_args =
std::min(kMaxArgs, num_args);
123
124 for (
int i = 0;
i < num_trace_args;
i++) {
125 const char* arg_name = p_arg_names[
i];
126 const uint8_t arg_type = p_arg_types[
i];
127 const uint64_t arg_value = p_arg_values[
i];
128
129 trace_string_ref_t arg_name_string_ref =
130 trace_context_make_registered_string_literal(trace_context, arg_name);
131
132 trace_arg_value_t trace_arg_value;
133 switch (arg_type) {
135 trace_arg_value = trace_make_bool_arg_value(!!arg_value);
136 break;
137 }
139 trace_arg_value = trace_make_uint64_arg_value(arg_value);
140 break;
142 trace_arg_value =
143 trace_make_int64_arg_value(BitCast<int64_t>(arg_value));
144 break;
146 trace_arg_value =
147 trace_make_double_arg_value(BitCast<double>(arg_value));
148 break;
150 trace_arg_value =
151 trace_make_pointer_arg_value(BitCast<uintptr_t>(arg_value));
152 break;
154 trace_string_ref_t arg_value_string_ref =
155 trace_context_make_registered_string_literal(
156 trace_context, reinterpret_cast<const char*>(arg_value));
157 trace_arg_value = trace_make_string_arg_value(arg_value_string_ref);
158 break;
159 }
161 const char* arg_value_as_cstring =
162 reinterpret_cast<const char*>(arg_value);
163 trace_string_ref_t arg_value_string_ref =
164 trace_context_make_registered_string_copy(
165 trace_context, arg_value_as_cstring,
166 strlen(arg_value_as_cstring));
167 trace_arg_value = trace_make_string_arg_value(arg_value_string_ref);
168 break;
169 }
171 trace_arg_value = trace_make_null_arg_value();
172 break;
173 default:
174 trace_arg_value = trace_make_null_arg_value();
175 }
176
177 trace_args[
i] = trace_make_arg(arg_name_string_ref, trace_arg_value);
178 }
179
180 switch (phase) {
183 trace_context_write_duration_begin_event_record(
184 trace_context, ticks, &thread_ref, &category_ref, &name_ref,
185 trace_args, num_trace_args);
186 break;
188 trace_context_write_duration_end_event_record(
189 trace_context, ticks, &thread_ref, &category_ref, &name_ref,
190 trace_args, num_trace_args);
191 break;
193 trace_context_write_instant_event_record(
194 trace_context, ticks, &thread_ref, &category_ref, &name_ref,
195 TRACE_SCOPE_THREAD, trace_args, num_trace_args);
196 break;
198 trace_context_write_async_begin_event_record(
199 trace_context, ticks, &thread_ref, &category_ref, &name_ref, id,
200 trace_args, num_trace_args);
201 break;
203 trace_context_write_async_end_event_record(
204 trace_context, ticks, &thread_ref, &category_ref, &name_ref, id,
205 trace_args, num_trace_args);
206 break;
207 default:
208 break;
209 }
210
211 trace_release_context(trace_context);
212
213#else
214 const char* devtoolsTag = nullptr;
215 if (shaders_category_flag_ &&
216 category_enabled_flag == shaders_category_flag_) {
217 devtoolsTag = kShadersDevtoolsTag;
218 }
219 switch (phase) {
222 if (devtoolsTag) {
224 nullptr, kDevtoolsTagArg,
225 devtoolsTag);
226 } else {
228 nullptr);
229 }
230 break;
233 break;
235 if (devtoolsTag) {
237 0,
238 nullptr,
239 kDevtoolsTagArg, devtoolsTag);
240 } else {
242 0,
243 nullptr);
244 }
245 break;
247 if (devtoolsTag) {
249 0,
250 nullptr,
251 kDevtoolsTagArg, devtoolsTag);
252 } else {
254 0,
255 nullptr);
256 }
257 break;
259 if (devtoolsTag) {
261 devtoolsTag);
262 } else {
264 }
265 break;
266 default:
267 break;
268 }
269#endif
270 return 0;
271 }
#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_VALUE_TYPE_CONVERTABLE
#define TRACE_EVENT_PHASE_ASYNC_BEGIN
#define TRACE_EVENT_PHASE_END
#define TRACE_EVENT_PHASE_BEGIN
#define TRACE_EVENT_PHASE_INSTANT
#define TRACE_EVENT_PHASE_COMPLETE
#define TRACE_EVENT_PHASE_ASYNC_END
static constexpr const char * kSkiaTag
#define FML_DCHECK(condition)
static float min(float r, float g, float b)
DEF_SWITCHES_START aot vmservice shared library name
void TraceEventInstant0(TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids)
void TraceEventAsyncBegin0(TraceArg category_group, TraceArg name, TraceIDArg id, size_t flow_id_count, const uint64_t *flow_ids)
void TraceEventAsyncEnd0(TraceArg category_group, TraceArg name, TraceIDArg id)
void TraceEvent0(TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids)
void TraceEventInstant1(TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids, TraceArg arg1_name, TraceArg arg1_val)
void TraceEventAsyncBegin1(TraceArg category_group, TraceArg name, TraceIDArg id, size_t flow_id_count, const uint64_t *flow_ids, TraceArg arg1_name, TraceArg arg1_val)
void TraceEventAsyncEnd1(TraceArg category_group, TraceArg name, TraceIDArg id, TraceArg arg1_name, TraceArg arg1_val)
void TraceEventEnd(TraceArg name)
void TraceEvent1(TraceArg category_group, TraceArg name, size_t flow_id_count, const uint64_t *flow_ids, TraceArg arg1_name, TraceArg arg1_val)