[tracing] Fix perfetto tests

I accidentally broke this with the last CL because the FYI bot does not
block landing.

Add initialization of perfetto when building with perfetto enabled.

Cq-Include-Trybots: luci.v8.try:v8_linux64_perfetto_dbg_ng
Bug: v8:8339
Change-Id: I10378b72bff731fac6caa75df37a355df4b804dc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1627345
Auto-Submit: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61783}
This commit is contained in:
Peter Marshall 2019-05-23 13:52:20 +02:00 committed by Commit Bot
parent 302a49c6b3
commit 4861df10b8

View File

@ -144,6 +144,10 @@ void PopulateJSONWriter(TraceWriter* writer) {
TraceBuffer* ring_buffer = TraceBuffer* ring_buffer =
TraceBuffer::CreateTraceBufferRingBuffer(1, writer); TraceBuffer::CreateTraceBufferRingBuffer(1, writer);
tracing_controller->Initialize(ring_buffer); tracing_controller->Initialize(ring_buffer);
#ifdef V8_USE_PERFETTO
std::ostringstream sstream;
tracing_controller->InitializeForPerfetto(&sstream);
#endif
TraceConfig* trace_config = new TraceConfig(); TraceConfig* trace_config = new TraceConfig();
trace_config->AddIncludedCategory("v8-cat"); trace_config->AddIncludedCategory("v8-cat");
tracing_controller->StartTracing(trace_config); tracing_controller->StartTracing(trace_config);
@ -211,6 +215,10 @@ TEST(TestTracingController) {
TraceBuffer* ring_buffer = TraceBuffer* ring_buffer =
TraceBuffer::CreateTraceBufferRingBuffer(1, writer); TraceBuffer::CreateTraceBufferRingBuffer(1, writer);
tracing_controller->Initialize(ring_buffer); tracing_controller->Initialize(ring_buffer);
#ifdef V8_USE_PERFETTO
std::ostringstream sstream;
tracing_controller->InitializeForPerfetto(&sstream);
#endif
TraceConfig* trace_config = new TraceConfig(); TraceConfig* trace_config = new TraceConfig();
trace_config->AddIncludedCategory("v8"); trace_config->AddIncludedCategory("v8");
tracing_controller->StartTracing(trace_config); tracing_controller->StartTracing(trace_config);
@ -243,7 +251,7 @@ void GetJSONStrings(std::vector<std::string>& ret, std::string str,
} }
TEST(TestTracingControllerMultipleArgsAndCopy) { TEST(TestTracingControllerMultipleArgsAndCopy) {
std::ostringstream stream; std::ostringstream stream, perfetto_stream;
uint64_t aa = 11; uint64_t aa = 11;
unsigned int bb = 22; unsigned int bb = 22;
uint16_t cc = 33; uint16_t cc = 33;
@ -282,6 +290,9 @@ TEST(TestTracingControllerMultipleArgsAndCopy) {
TraceBuffer* ring_buffer = TraceBuffer* ring_buffer =
TraceBuffer::CreateTraceBufferRingBuffer(1, writer); TraceBuffer::CreateTraceBufferRingBuffer(1, writer);
tracing_controller->Initialize(ring_buffer); tracing_controller->Initialize(ring_buffer);
#ifdef V8_USE_PERFETTO
tracing_controller->InitializeForPerfetto(&perfetto_stream);
#endif
TraceConfig* trace_config = new TraceConfig(); TraceConfig* trace_config = new TraceConfig();
trace_config->AddIncludedCategory("v8"); trace_config->AddIncludedCategory("v8");
tracing_controller->StartTracing(trace_config); tracing_controller->StartTracing(trace_config);
@ -399,6 +410,10 @@ TEST(TracingObservers) {
v8::platform::tracing::TraceBuffer::CreateTraceBufferRingBuffer(1, v8::platform::tracing::TraceBuffer::CreateTraceBufferRingBuffer(1,
writer); writer);
tracing_controller->Initialize(ring_buffer); tracing_controller->Initialize(ring_buffer);
#ifdef V8_USE_PERFETTO
std::ostringstream sstream;
tracing_controller->InitializeForPerfetto(&sstream);
#endif
v8::platform::tracing::TraceConfig* trace_config = v8::platform::tracing::TraceConfig* trace_config =
new v8::platform::tracing::TraceConfig(); new v8::platform::tracing::TraceConfig();
trace_config->AddIncludedCategory("v8"); trace_config->AddIncludedCategory("v8");
@ -488,6 +503,10 @@ TEST(AddTraceEventMultiThreaded) {
TraceBuffer* ring_buffer = TraceBuffer* ring_buffer =
TraceBuffer::CreateTraceBufferRingBuffer(1, writer); TraceBuffer::CreateTraceBufferRingBuffer(1, writer);
tracing_controller->Initialize(ring_buffer); tracing_controller->Initialize(ring_buffer);
#ifdef V8_USE_PERFETTO
std::ostringstream sstream;
tracing_controller->InitializeForPerfetto(&sstream);
#endif
TraceConfig* trace_config = new TraceConfig(); TraceConfig* trace_config = new TraceConfig();
trace_config->AddIncludedCategory("v8"); trace_config->AddIncludedCategory("v8");
tracing_controller->StartTracing(trace_config); tracing_controller->StartTracing(trace_config);