6#if defined(DART_HOST_OS_MACOS) && defined(SUPPORT_TIMELINE)
13TimelineEventMacosRecorder::TimelineEventMacosRecorder()
14 : TimelineEventPlatformRecorder() {
15 Timeline::set_recorder_discards_clock_values(
true);
18TimelineEventMacosRecorder::~TimelineEventMacosRecorder() {}
20void TimelineEventMacosRecorder::OnEvent(TimelineEvent*
event) {
21 if (
event ==
nullptr) {
25 os_log_t
log =
event->stream_->macos_log();
26 if (!os_signpost_enabled(log)) {
30 const char* label =
event->label();
31 bool is_static_label =
event->stream_->has_static_labels();
32 uint8_t _Alignas(16)
buffer[64];
36 case TimelineEvent::kInstant:
37 if (is_static_label) {
38 _os_signpost_emit_with_name_impl(&__dso_handle, log, OS_SIGNPOST_EVENT,
39 OS_SIGNPOST_ID_EXCLUSIVE, label,
"",
42 os_signpost_event_emit(log, OS_SIGNPOST_ID_EXCLUSIVE,
"Event",
"%s",
46 case TimelineEvent::kBegin:
47 case TimelineEvent::kAsyncBegin:
48 if (is_static_label) {
49 _os_signpost_emit_with_name_impl(
50 &__dso_handle, log, OS_SIGNPOST_INTERVAL_BEGIN,
event->Id(), label,
53 os_signpost_interval_begin(log,
event->Id(),
"Event",
"%s", label);
56 case TimelineEvent::kEnd:
57 case TimelineEvent::kAsyncEnd:
58 if (is_static_label) {
59 _os_signpost_emit_with_name_impl(&__dso_handle, log,
60 OS_SIGNPOST_INTERVAL_END,
event->Id(),
63 os_signpost_interval_end(log,
event->Id(),
"Event");
66 case TimelineEvent::kCounter:
67 os_signpost_event_emit(log, OS_SIGNPOST_ID_EXCLUSIVE,
"Counter",
"%s=%s",
68 label,
event->arguments()[0].value);
ax::mojom::Event event_type
static const uint8_t buffer[]