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

Side by Side Diff: runtime/vm/timeline_test.cc

Issue 1687043003: Sleep for more than 1 millisecond in timeline tests (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698