dart-sdk/runtime/vm/timeline_macos.cc
Parker Lougheed 7901612ea3 [vm] Remove macOS 10.14 and iOS 12 availability checks
macOS 10.14 has been Flutter's minimum for a while, and iOS 12 is the new minimum as of https://github.com/flutter/flutter/issues/140474.

Dart has not marked these platforms as supported for an even longer time.

Supported platforms reference: https://docs.flutter.dev/reference/supported-platforms

TEST=ci

Bug: https://github.com/flutter/flutter/issues/140474
Change-Id: I12377975d9c4d57e19d486898f0fcd89a1583f7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346920
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-01-25 08:23:51 +00:00

78 lines
2.5 KiB
C++

// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "vm/globals.h"
#if defined(DART_HOST_OS_MACOS) && defined(SUPPORT_TIMELINE)
#include "vm/log.h"
#include "vm/timeline.h"
namespace dart {
TimelineEventMacosRecorder::TimelineEventMacosRecorder()
: TimelineEventPlatformRecorder() {
Timeline::set_recorder_discards_clock_values(true);
}
TimelineEventMacosRecorder::~TimelineEventMacosRecorder() {}
void TimelineEventMacosRecorder::OnEvent(TimelineEvent* event) {
if (event == nullptr) {
return;
}
os_log_t log = event->stream_->macos_log();
if (!os_signpost_enabled(log)) {
return;
}
const char* label = event->label();
bool is_static_label = event->stream_->has_static_labels();
uint8_t _Alignas(16) buffer[64];
buffer[0] = 0;
switch (event->event_type()) {
case TimelineEvent::kInstant:
if (is_static_label) {
_os_signpost_emit_with_name_impl(&__dso_handle, log, OS_SIGNPOST_EVENT,
OS_SIGNPOST_ID_EXCLUSIVE, label, "",
buffer, sizeof(buffer));
} else {
os_signpost_event_emit(log, OS_SIGNPOST_ID_EXCLUSIVE, "Event", "%s",
label);
}
break;
case TimelineEvent::kBegin:
case TimelineEvent::kAsyncBegin:
if (is_static_label) {
_os_signpost_emit_with_name_impl(
&__dso_handle, log, OS_SIGNPOST_INTERVAL_BEGIN, event->Id(), label,
"", buffer, sizeof(buffer));
} else {
os_signpost_interval_begin(log, event->Id(), "Event", "%s", label);
}
break;
case TimelineEvent::kEnd:
case TimelineEvent::kAsyncEnd:
if (is_static_label) {
_os_signpost_emit_with_name_impl(&__dso_handle, log,
OS_SIGNPOST_INTERVAL_END, event->Id(),
label, "", buffer, sizeof(buffer));
} else {
os_signpost_interval_end(log, event->Id(), "Event");
}
break;
case TimelineEvent::kCounter:
os_signpost_event_emit(log, OS_SIGNPOST_ID_EXCLUSIVE, "Counter", "%s=%s",
label, event->arguments()[0].value);
break;
default:
break;
}
}
} // namespace dart
#endif // defined(DART_HOST_OS_MACOS) && defined(SUPPORT_TIMELINE)