OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include <cstring> | 5 #include <cstring> |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 | 8 |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_api_state.h" | 10 #include "vm/dart_api_state.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 // Blocks owned by thread "3". | 338 // Blocks owned by thread "3". |
339 TimelineEventBlock* block_3_0 = recorder->GetNewBlock(); | 339 TimelineEventBlock* block_3_0 = recorder->GetNewBlock(); |
340 TimelineTestHelper::SetBlockThread(block_3_0, 3); | 340 TimelineTestHelper::SetBlockThread(block_3_0, 3); |
341 USE(block_3_0); | 341 USE(block_3_0); |
342 | 342 |
343 // Add events to each block for thread 1. | 343 // Add events to each block for thread 1. |
344 TimelineTestHelper::FakeThreadEvent(block_1_2, 1, "B1"); | 344 TimelineTestHelper::FakeThreadEvent(block_1_2, 1, "B1"); |
345 TimelineTestHelper::FakeThreadEvent(block_1_2, 1, "B2"); | 345 TimelineTestHelper::FakeThreadEvent(block_1_2, 1, "B2"); |
346 TimelineTestHelper::FakeThreadEvent(block_1_2, 1, "B3"); | 346 TimelineTestHelper::FakeThreadEvent(block_1_2, 1, "B3"); |
347 // Sleep to ensure timestamps differ. | 347 // Sleep to ensure timestamps differ. |
348 OS::Sleep(1); | 348 OS::Sleep(32); |
349 TimelineTestHelper::FakeThreadEvent(block_1_0, 1, "A1"); | 349 TimelineTestHelper::FakeThreadEvent(block_1_0, 1, "A1"); |
350 OS::Sleep(1); | 350 OS::Sleep(32); |
351 TimelineTestHelper::FakeThreadEvent(block_1_1, 1, "C1"); | 351 TimelineTestHelper::FakeThreadEvent(block_1_1, 1, "C1"); |
352 TimelineTestHelper::FakeThreadEvent(block_1_1, 1, "C2"); | 352 TimelineTestHelper::FakeThreadEvent(block_1_1, 1, "C2"); |
353 OS::Sleep(1); | 353 OS::Sleep(32); |
354 | 354 |
355 // Add events to each block for thread 2. | 355 // Add events to each block for thread 2. |
356 TimelineTestHelper::FakeThreadEvent(block_2_0, 2, "A"); | 356 TimelineTestHelper::FakeThreadEvent(block_2_0, 2, "A"); |
357 TimelineTestHelper::FakeThreadEvent(block_2_0, 2, "B"); | 357 TimelineTestHelper::FakeThreadEvent(block_2_0, 2, "B"); |
358 TimelineTestHelper::FakeThreadEvent(block_2_0, 2, "C"); | 358 TimelineTestHelper::FakeThreadEvent(block_2_0, 2, "C"); |
359 TimelineTestHelper::FakeThreadEvent(block_2_0, 2, "D"); | 359 TimelineTestHelper::FakeThreadEvent(block_2_0, 2, "D"); |
360 TimelineTestHelper::FakeThreadEvent(block_2_0, 2, "E"); | 360 TimelineTestHelper::FakeThreadEvent(block_2_0, 2, "E"); |
361 TimelineTestHelper::FakeThreadEvent(block_2_0, 2, "F"); | 361 TimelineTestHelper::FakeThreadEvent(block_2_0, 2, "F"); |
362 | 362 |
363 Zone* zone = thread->zone(); | 363 Zone* zone = thread->zone(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 448 |
449 TimelineEventBlock* block_0 = recorder->GetNewBlock(); | 449 TimelineEventBlock* block_0 = recorder->GetNewBlock(); |
450 EXPECT(block_0 != NULL); | 450 EXPECT(block_0 != NULL); |
451 TimelineEventBlock* block_1 = recorder->GetNewBlock(); | 451 TimelineEventBlock* block_1 = recorder->GetNewBlock(); |
452 EXPECT(block_1 != NULL); | 452 EXPECT(block_1 != NULL); |
453 // Test that we wrapped. | 453 // Test that we wrapped. |
454 EXPECT(block_0 == recorder->GetNewBlock()); | 454 EXPECT(block_0 == recorder->GetNewBlock()); |
455 | 455 |
456 // Emit the earlier event into block_1. | 456 // Emit the earlier event into block_1. |
457 TimelineTestHelper::FakeThreadEvent(block_1, 2, "Alpha", &stream); | 457 TimelineTestHelper::FakeThreadEvent(block_1, 2, "Alpha", &stream); |
458 OS::Sleep(1); | 458 OS::Sleep(32); |
459 // Emit the later event into block_0. | 459 // Emit the later event into block_0. |
460 TimelineTestHelper::FakeThreadEvent(block_0, 2, "Beta", &stream); | 460 TimelineTestHelper::FakeThreadEvent(block_0, 2, "Beta", &stream); |
461 | 461 |
462 TimelineTestHelper::FinishBlock(block_0); | 462 TimelineTestHelper::FinishBlock(block_0); |
463 TimelineTestHelper::FinishBlock(block_1); | 463 TimelineTestHelper::FinishBlock(block_1); |
464 | 464 |
465 JSONStream js; | 465 JSONStream js; |
466 TimelineEventFilter filter; | 466 TimelineEventFilter filter; |
467 recorder->PrintJSON(&js, &filter); | 467 recorder->PrintJSON(&js, &filter); |
468 // trace-event has a requirement that events for a thread must have | 468 // trace-event has a requirement that events for a thread must have |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 pauses.Setup(); | 852 pauses.Setup(); |
853 pauses.CalculatePauseTimesForThread(tid); | 853 pauses.CalculatePauseTimesForThread(tid); |
854 EXPECT(pauses.has_error()); | 854 EXPECT(pauses.has_error()); |
855 } | 855 } |
856 TimelineTestHelper::Clear(recorder); | 856 TimelineTestHelper::Clear(recorder); |
857 } | 857 } |
858 | 858 |
859 #endif // !PRODUCT | 859 #endif // !PRODUCT |
860 | 860 |
861 } // namespace dart | 861 } // namespace dart |
OLD | NEW |