OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 #include <stdlib.h> | 4 #include <stdlib.h> |
5 #include <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/list.h" | 9 #include "src/list.h" |
10 #include "src/list-inl.h" | 10 #include "src/list-inl.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 TRACE_EVENT_ASYNC_END0("v8-cat", "a1", event_id); | 249 TRACE_EVENT_ASYNC_END0("v8-cat", "a1", event_id); |
250 | 250 |
251 CHECK_EQ(2, GET_TRACE_OBJECTS_LIST->length()); | 251 CHECK_EQ(2, GET_TRACE_OBJECTS_LIST->length()); |
252 CHECK_EQ(TRACE_EVENT_PHASE_ASYNC_BEGIN, GET_TRACE_OBJECT(0)->phase); | 252 CHECK_EQ(TRACE_EVENT_PHASE_ASYNC_BEGIN, GET_TRACE_OBJECT(0)->phase); |
253 CHECK_EQ(event_id, GET_TRACE_OBJECT(0)->id); | 253 CHECK_EQ(event_id, GET_TRACE_OBJECT(0)->id); |
254 CHECK_EQ(TRACE_EVENT_PHASE_ASYNC_END, GET_TRACE_OBJECT(1)->phase); | 254 CHECK_EQ(TRACE_EVENT_PHASE_ASYNC_END, GET_TRACE_OBJECT(1)->phase); |
255 CHECK_EQ(event_id, GET_TRACE_OBJECT(1)->id); | 255 CHECK_EQ(event_id, GET_TRACE_OBJECT(1)->id); |
256 | 256 |
257 i::V8::SetPlatformForTesting(old_platform); | 257 i::V8::SetPlatformForTesting(old_platform); |
258 } | 258 } |
259 | |
260 TEST(TestEventInContext) { | |
261 v8::Platform* old_platform = i::V8::GetCurrentPlatform(); | |
262 MockTracingPlatform platform(old_platform); | |
263 i::V8::SetPlatformForTesting(&platform); | |
264 | |
265 static uint64_t isolate_id = 0x20151021; | |
266 { | |
267 TRACE_EVENT_SCOPED_CONTEXT("v8-cat", "Isolate", isolate_id); | |
268 TRACE_EVENT0("v8-cat", "e"); | |
269 } | |
270 | |
271 CHECK_EQ(3, GET_TRACE_OBJECTS_LIST->length()); | |
272 CHECK_EQ(TRACE_EVENT_PHASE_ENTER_CONTEXT, GET_TRACE_OBJECT(0)->phase); | |
273 CHECK_EQ("Isolate", GET_TRACE_OBJECT(0)->name); | |
274 CHECK_EQ(isolate_id, GET_TRACE_OBJECT(0)->id); | |
275 CHECK_EQ(TRACE_EVENT_PHASE_COMPLETE, GET_TRACE_OBJECT(1)->phase); | |
276 CHECK_EQ("e", GET_TRACE_OBJECT(1)->name); | |
277 CHECK_EQ(TRACE_EVENT_PHASE_LEAVE_CONTEXT, GET_TRACE_OBJECT(2)->phase); | |
278 CHECK_EQ("Isolate", GET_TRACE_OBJECT(2)->name); | |
279 CHECK_EQ(isolate_id, GET_TRACE_OBJECT(2)->id); | |
280 | |
281 i::V8::SetPlatformForTesting(old_platform); | |
282 } | |
OLD | NEW |