Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: src/libplatform/tracing/trace-writer.cc

Issue 2183943002: Revert of [Tracing] V8 Tracing Controller (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/libplatform/tracing/trace-writer.h ('k') | src/libplatform/tracing/tracing-controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 #include "src/libplatform/tracing/trace-writer.h"
6
7 #include "src/base/platform/platform.h"
8
9 namespace v8 {
10 namespace platform {
11 namespace tracing {
12
13 JSONTraceWriter::JSONTraceWriter(std::ostream& stream) : stream_(stream) {
14 stream_ << "{\"traceEvents\":[";
15 }
16
17 JSONTraceWriter::~JSONTraceWriter() { stream_ << "]}"; }
18
19 void JSONTraceWriter::AppendTraceEvent(TraceObject* trace_event) {
20 if (append_comma_) stream_ << ",";
21 append_comma_ = true;
22 if (trace_event->scope() == NULL) {
23 stream_ << "{\"pid\":" << trace_event->pid()
24 << ",\"tid\":" << trace_event->tid()
25 << ",\"ts\":" << trace_event->ts()
26 << ",\"tts\":" << trace_event->tts() << ",\"ph\":\""
27 << trace_event->phase() << "\",\"cat\":\""
28 << TracingController::GetCategoryGroupName(
29 trace_event->category_enabled_flag())
30 << "\",\"name\":\"" << trace_event->name()
31 << "\",\"args\":{},\"dur\":" << trace_event->duration()
32 << ",\"tdur\":" << trace_event->cpu_duration() << "}";
33 } else {
34 stream_ << "{\"pid\":" << trace_event->pid()
35 << ",\"tid\":" << trace_event->tid()
36 << ",\"ts\":" << trace_event->ts()
37 << ",\"tts\":" << trace_event->tts() << ",\"ph\":\""
38 << trace_event->phase() << "\",\"cat\":\""
39 << TracingController::GetCategoryGroupName(
40 trace_event->category_enabled_flag())
41 << "\",\"name\":\"" << trace_event->name() << "\",\"scope\":\""
42 << trace_event->scope()
43 << "\",\"args\":{},\"dur\":" << trace_event->duration()
44 << ",\"tdur\":" << trace_event->cpu_duration() << "}";
45 }
46 // TODO(fmeawad): Add support for Flow Events.
47 }
48
49 void JSONTraceWriter::Flush() {}
50
51 TraceWriter* TraceWriter::CreateJSONTraceWriter(std::ostream& stream) {
52 return new JSONTraceWriter(stream);
53 }
54
55 } // namespace tracing
56 } // namespace platform
57 } // namespace v8
OLDNEW
« no previous file with comments | « src/libplatform/tracing/trace-writer.h ('k') | src/libplatform/tracing/tracing-controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698