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

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

Issue 1439483003: - Add an OSThread structure which is the generic TLS structure for all C++ (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review Created 5 years, 1 month 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 | « runtime/vm/timeline.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 const char* beta = strstr(js.ToCString(), "Beta"); 471 const char* beta = strstr(js.ToCString(), "Beta");
472 EXPECT(alpha < beta); 472 EXPECT(alpha < beta);
473 } 473 }
474 474
475 475
476 TEST_CASE(TimelinePauses_Basic) { 476 TEST_CASE(TimelinePauses_Basic) {
477 TimelineEventEndlessRecorder* recorder = new TimelineEventEndlessRecorder(); 477 TimelineEventEndlessRecorder* recorder = new TimelineEventEndlessRecorder();
478 ASSERT(recorder != NULL); 478 ASSERT(recorder != NULL);
479 Zone* zone = thread->zone(); 479 Zone* zone = thread->zone();
480 Isolate* isolate = thread->isolate(); 480 Isolate* isolate = thread->isolate();
481 ThreadId tid = OSThread::GetCurrentThreadTraceId(); 481 OSThread* os_thread = thread->os_thread();
482 ASSERT(os_thread != NULL);
483 ThreadId tid = os_thread->trace_id();
482 484
483 // Test case. 485 // Test case.
484 TimelineTestHelper::FakeDuration(recorder, "a", 0, 10); 486 TimelineTestHelper::FakeDuration(recorder, "a", 0, 10);
485 { 487 {
486 TimelinePauses pauses(zone, isolate, recorder); 488 TimelinePauses pauses(zone, isolate, recorder);
487 pauses.Setup(); 489 pauses.Setup();
488 pauses.CalculatePauseTimesForThread(tid); 490 pauses.CalculatePauseTimesForThread(tid);
489 EXPECT(!pauses.has_error()); 491 EXPECT(!pauses.has_error());
490 EXPECT_EQ(10, pauses.InclusiveTime("a")); 492 EXPECT_EQ(10, pauses.InclusiveTime("a"));
491 EXPECT_EQ(10, pauses.ExclusiveTime("a")); 493 EXPECT_EQ(10, pauses.ExclusiveTime("a"));
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 } 643 }
642 TimelineTestHelper::Clear(recorder); 644 TimelineTestHelper::Clear(recorder);
643 } 645 }
644 646
645 647
646 TEST_CASE(TimelinePauses_BeginEnd) { 648 TEST_CASE(TimelinePauses_BeginEnd) {
647 TimelineEventEndlessRecorder* recorder = new TimelineEventEndlessRecorder(); 649 TimelineEventEndlessRecorder* recorder = new TimelineEventEndlessRecorder();
648 ASSERT(recorder != NULL); 650 ASSERT(recorder != NULL);
649 Zone* zone = thread->zone(); 651 Zone* zone = thread->zone();
650 Isolate* isolate = thread->isolate(); 652 Isolate* isolate = thread->isolate();
651 ThreadId tid = OSThread::GetCurrentThreadTraceId(); 653 OSThread* os_thread = thread->os_thread();
654 ASSERT(os_thread != NULL);
655 ThreadId tid = os_thread->trace_id();
652 656
653 // Test case. 657 // Test case.
654 TimelineTestHelper::FakeBegin(recorder, "a", 0); 658 TimelineTestHelper::FakeBegin(recorder, "a", 0);
655 TimelineTestHelper::FakeEnd(recorder, "a", 10); 659 TimelineTestHelper::FakeEnd(recorder, "a", 10);
656 660
657 { 661 {
658 TimelinePauses pauses(zone, isolate, recorder); 662 TimelinePauses pauses(zone, isolate, recorder);
659 pauses.Setup(); 663 pauses.Setup();
660 pauses.CalculatePauseTimesForThread(tid); 664 pauses.CalculatePauseTimesForThread(tid);
661 EXPECT(!pauses.has_error()); 665 EXPECT(!pauses.has_error());
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 { 848 {
845 TimelinePauses pauses(zone, isolate, recorder); 849 TimelinePauses pauses(zone, isolate, recorder);
846 pauses.Setup(); 850 pauses.Setup();
847 pauses.CalculatePauseTimesForThread(tid); 851 pauses.CalculatePauseTimesForThread(tid);
848 EXPECT(pauses.has_error()); 852 EXPECT(pauses.has_error());
849 } 853 }
850 TimelineTestHelper::Clear(recorder); 854 TimelineTestHelper::Clear(recorder);
851 } 855 }
852 856
853 } // namespace dart 857 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/timeline.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698