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

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

Issue 1395803002: Stop holding onto TimelineEvents (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 | « runtime/vm/timeline.cc ('k') | 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 19 matching lines...) Expand all
30 TimelineEventRecorder* recorder_; 30 TimelineEventRecorder* recorder_;
31 }; 31 };
32 32
33 33
34 class TimelineTestHelper : public AllStatic { 34 class TimelineTestHelper : public AllStatic {
35 public: 35 public:
36 static void SetStream(TimelineEvent* event, TimelineStream* stream) { 36 static void SetStream(TimelineEvent* event, TimelineStream* stream) {
37 event->StreamInit(stream); 37 event->StreamInit(stream);
38 } 38 }
39 39
40 static TimelineEvent* FakeThreadEvent( 40 static void FakeThreadEvent(
41 TimelineEventBlock* block, 41 TimelineEventBlock* block,
42 intptr_t ftid, 42 intptr_t ftid,
43 const char* label = "fake", 43 const char* label = "fake",
44 TimelineStream* stream = NULL) { 44 TimelineStream* stream = NULL) {
45 TimelineEvent* event = block->StartEvent(); 45 TimelineEvent* event = block->StartEvent();
46 ASSERT(event != NULL); 46 ASSERT(event != NULL);
47 event->DurationBegin(label); 47 event->DurationBegin(label);
48 event->thread_ = OSThread::ThreadIdFromIntPtr(ftid); 48 event->thread_ = OSThread::ThreadIdFromIntPtr(ftid);
49 if (stream != NULL) { 49 if (stream != NULL) {
50 event->StreamInit(stream); 50 event->StreamInit(stream);
51 } 51 }
52 return event;
53 } 52 }
54 53
55 static void FakeDuration( 54 static void FakeDuration(
56 TimelineEventRecorder* recorder, 55 TimelineEventRecorder* recorder,
57 const char* label, 56 const char* label,
58 int64_t start, 57 int64_t start,
59 int64_t end) { 58 int64_t end) {
60 ASSERT(recorder != NULL); 59 ASSERT(recorder != NULL);
61 ASSERT(start < end); 60 ASSERT(start < end);
62 ASSERT(label != NULL); 61 ASSERT(label != NULL);
63 TimelineEvent* event = recorder->StartEvent(); 62 TimelineEvent* event = recorder->StartEvent();
64 ASSERT(event != NULL); 63 ASSERT(event != NULL);
65 event->Duration(label, start, end); 64 event->Duration(label, start, end);
65 event->Complete();
66 } 66 }
67 67
68 static void FakeBegin( 68 static void FakeBegin(
69 TimelineEventRecorder* recorder, 69 TimelineEventRecorder* recorder,
70 const char* label, 70 const char* label,
71 int64_t start) { 71 int64_t start) {
72 ASSERT(recorder != NULL); 72 ASSERT(recorder != NULL);
73 ASSERT(label != NULL); 73 ASSERT(label != NULL);
74 ASSERT(start >= 0); 74 ASSERT(start >= 0);
75 TimelineEvent* event = recorder->StartEvent(); 75 TimelineEvent* event = recorder->StartEvent();
76 ASSERT(event != NULL); 76 ASSERT(event != NULL);
77 event->Begin(label, start); 77 event->Begin(label, start);
78 event->Complete();
78 } 79 }
79 80
80 static void FakeEnd( 81 static void FakeEnd(
81 TimelineEventRecorder* recorder, 82 TimelineEventRecorder* recorder,
82 const char* label, 83 const char* label,
83 int64_t end) { 84 int64_t end) {
84 ASSERT(recorder != NULL); 85 ASSERT(recorder != NULL);
85 ASSERT(label != NULL); 86 ASSERT(label != NULL);
86 ASSERT(end >= 0); 87 ASSERT(end >= 0);
87 TimelineEvent* event = recorder->StartEvent(); 88 TimelineEvent* event = recorder->StartEvent();
88 ASSERT(event != NULL); 89 ASSERT(event != NULL);
89 event->End(label, end); 90 event->End(label, end);
91 event->Complete();
90 } 92 }
91 93
92 static void Clear(TimelineEventEndlessRecorder* recorder) { 94 static void Clear(TimelineEventEndlessRecorder* recorder) {
93 ASSERT(recorder != NULL); 95 ASSERT(recorder != NULL);
94 recorder->Clear(); 96 recorder->Clear();
95 } 97 }
96 98
97 static void FinishBlock(TimelineEventBlock* block) { 99 static void FinishBlock(TimelineEventBlock* block) {
98 block->Finish(); 100 block->Finish();
99 } 101 }
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 { 837 {
836 TimelinePauses pauses(zone, isolate, recorder); 838 TimelinePauses pauses(zone, isolate, recorder);
837 pauses.Setup(); 839 pauses.Setup();
838 pauses.CalculatePauseTimesForThread(tid); 840 pauses.CalculatePauseTimesForThread(tid);
839 EXPECT(pauses.has_error()); 841 EXPECT(pauses.has_error());
840 } 842 }
841 TimelineTestHelper::Clear(recorder); 843 TimelineTestHelper::Clear(recorder);
842 } 844 }
843 845
844 } // namespace dart 846 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/timeline.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698