v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
recorder-mac.cc
Go to the documentation of this file.
1// Copyright 2020 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_LIBPLATFORM_TRACING_RECORDER_MAC_H_
6#define V8_LIBPLATFORM_TRACING_RECORDER_MAC_H_
7
9
10#pragma clang diagnostic push
11#pragma clang diagnostic ignored "-Wunguarded-availability"
12
13namespace v8 {
14namespace platform {
15namespace tracing {
16
17Recorder::Recorder() { v8Provider = os_log_create("v8", ""); }
19
21 return os_log_type_enabled(v8Provider, OS_LOG_TYPE_DEFAULT);
22}
23bool Recorder::IsEnabled(const uint8_t level) {
24 if (level == OS_LOG_TYPE_DEFAULT || level == OS_LOG_TYPE_INFO ||
25 level == OS_LOG_TYPE_DEBUG || level == OS_LOG_TYPE_ERROR ||
26 level == OS_LOG_TYPE_FAULT) {
27 return os_log_type_enabled(v8Provider, static_cast<os_log_type_t>(level));
28 }
29 return false;
30}
31
32void Recorder::AddEvent(TraceObject* trace_event) {
33 os_signpost_event_emit(v8Provider, OS_SIGNPOST_ID_EXCLUSIVE, "",
34 "%s, cpu_duration: %d", trace_event->name(),
35 static_cast<int>(trace_event->cpu_duration()));
36}
37
38} // namespace tracing
39} // namespace platform
40} // namespace v8
41
42#pragma clang diagnostic pop
43
44#endif // V8_LIBPLATFORM_TRACING_RECORDER_MAC_H_
void AddEvent(TraceObject *trace_event)