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

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

Issue 1411783004: More timeline cleanups (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') | runtime/vm/timeline_test.cc » ('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 "vm/timeline_analysis.h" 5 #include "vm/timeline_analysis.h"
6 6
7 #include "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/log.h" 8 #include "vm/log.h"
9 #include "vm/os_thread.h" 9 #include "vm/os_thread.h"
10 10
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 void TimelineAnalysis::DiscoverThreads() { 156 void TimelineAnalysis::DiscoverThreads() {
157 TimelineEventBlockIterator it(recorder_); 157 TimelineEventBlockIterator it(recorder_);
158 while (it.HasNext()) { 158 while (it.HasNext()) {
159 TimelineEventBlock* block = it.Next(); 159 TimelineEventBlock* block = it.Next();
160 ASSERT(block != NULL); 160 ASSERT(block != NULL);
161 if (block->IsEmpty()) { 161 if (block->IsEmpty()) {
162 // Skip empty blocks. 162 // Skip empty blocks.
163 continue; 163 continue;
164 } 164 }
165 if (block->isolate() != isolate_) {
166 // Skip blocks for other isolates.
167 continue;
168 }
169 if (!block->CheckBlock()) { 165 if (!block->CheckBlock()) {
170 if (FLAG_trace_timeline_analysis) { 166 if (FLAG_trace_timeline_analysis) {
171 THR_Print("DiscoverThreads block %" Pd " " 167 THR_Print("DiscoverThreads block %" Pd " "
172 "violates invariants.\n", block->block_index()); 168 "violates invariants.\n", block->block_index());
173 } 169 }
174 SetError("Block %" Pd " violates invariants. See " 170 SetError("Block %" Pd " violates invariants. See "
175 "TimelineEventBlock::CheckBlock", block->block_index()); 171 "TimelineEventBlock::CheckBlock", block->block_index());
176 return; 172 return;
177 } 173 }
178 TimelineAnalysisThread* thread = GetOrAddThread(block->thread()); 174 TimelineAnalysisThread* thread = GetOrAddThread(block->thread_id());
179 ASSERT(thread != NULL); 175 ASSERT(thread != NULL);
180 thread->AddBlock(block); 176 thread->AddBlock(block);
181 } 177 }
182 } 178 }
183 179
184 180
185 void TimelineAnalysis::FinalizeThreads() { 181 void TimelineAnalysis::FinalizeThreads() {
186 for (intptr_t i = 0; i < threads_.length(); i++) { 182 for (intptr_t i = 0; i < threads_.length(); i++) {
187 TimelineAnalysisThread* thread = threads_.At(i); 183 TimelineAnalysisThread* thread = threads_.At(i);
188 ASSERT(thread != NULL); 184 ASSERT(thread != NULL);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 labels_.Clear(); 336 labels_.Clear();
341 337
342 TimelineAnalysisThreadEventIterator it(thread); 338 TimelineAnalysisThreadEventIterator it(thread);
343 if (FLAG_trace_timeline_analysis) { 339 if (FLAG_trace_timeline_analysis) {
344 THR_Print(">>> TimelinePauses::ProcessThread %" Px "\n", 340 THR_Print(">>> TimelinePauses::ProcessThread %" Px "\n",
345 OSThread::ThreadIdToIntPtr(thread->id())); 341 OSThread::ThreadIdToIntPtr(thread->id()));
346 } 342 }
347 intptr_t event_count = 0; 343 intptr_t event_count = 0;
348 while (!has_error() && it.HasNext()) { 344 while (!has_error() && it.HasNext()) {
349 TimelineEvent* event = it.Next(); 345 TimelineEvent* event = it.Next();
346 if (event->isolate_id() != isolate_->main_port()) {
347 // Skip events that do not belong to the isolate.
348 continue;
349 }
350 if (event->IsFinishedDuration()) { 350 if (event->IsFinishedDuration()) {
351 int64_t start = event->TimeOrigin(); 351 int64_t start = event->TimeOrigin();
352 PopFinishedDurations(start); 352 PopFinishedDurations(start);
353 if (!CheckStack(event)) { 353 if (!CheckStack(event)) {
354 SetError("Duration check fail."); 354 SetError("Duration check fail.");
355 return; 355 return;
356 } 356 }
357 event_count++; 357 event_count++;
358 Push(event); 358 Push(event);
359 } else if (event->IsBeginOrEnd()) { 359 } else if (event->IsBeginOrEnd()) {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 MicrosecondsToMilliseconds(pause_info->inclusive_micros())); 623 MicrosecondsToMilliseconds(pause_info->inclusive_micros()));
624 THR_Print("%.3f ms total executing; ", 624 THR_Print("%.3f ms total executing; ",
625 MicrosecondsToMilliseconds(pause_info->exclusive_micros())); 625 MicrosecondsToMilliseconds(pause_info->exclusive_micros()));
626 THR_Print("%.3f ms max on stack; ", 626 THR_Print("%.3f ms max on stack; ",
627 MicrosecondsToMilliseconds(pause_info->max_inclusive_micros())); 627 MicrosecondsToMilliseconds(pause_info->max_inclusive_micros()));
628 THR_Print("%.3f ms max executing.\n", 628 THR_Print("%.3f ms max executing.\n",
629 MicrosecondsToMilliseconds(pause_info->max_exclusive_micros())); 629 MicrosecondsToMilliseconds(pause_info->max_exclusive_micros()));
630 } 630 }
631 631
632 } // namespace dart 632 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/timeline.cc ('k') | runtime/vm/timeline_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698