v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
trace-writer.h
Go to the documentation of this file.
1// Copyright 2016 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_TRACE_WRITER_H_
6#define V8_LIBPLATFORM_TRACING_TRACE_WRITER_H_
7
9
10namespace v8 {
11namespace platform {
12namespace tracing {
13
14class Recorder;
15
17 public:
18 explicit JSONTraceWriter(std::ostream& stream);
19 JSONTraceWriter(std::ostream& stream, const std::string& tag);
20 ~JSONTraceWriter() override;
21 void AppendTraceEvent(TraceObject* trace_event) override;
22 void Flush() override;
23
24 private:
25 void AppendArgValue(uint8_t type, TraceObject::ArgValue value);
27
28 std::ostream& stream_;
29 bool append_comma_ = false;
30};
31
32#if defined(V8_ENABLE_SYSTEM_INSTRUMENTATION)
33class SystemInstrumentationTraceWriter : public TraceWriter {
34 public:
35 SystemInstrumentationTraceWriter();
36 ~SystemInstrumentationTraceWriter() override;
37 void AppendTraceEvent(TraceObject* trace_event) override;
38 void Flush() override;
39
40 private:
41 std::unique_ptr<Recorder> recorder_;
42};
43#endif
44
45} // namespace tracing
46} // namespace platform
47} // namespace v8
48
49#endif // V8_LIBPLATFORM_TRACING_TRACE_WRITER_H_
void AppendTraceEvent(TraceObject *trace_event) override
void AppendArgValue(uint8_t type, TraceObject::ArgValue value)