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

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

Issue 1294023009: Switch to a VM wide timeline recorder (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
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/thread_registry.h" 5 #include "vm/thread_registry.h"
6 6
7 #include "vm/isolate.h" 7 #include "vm/isolate.h"
8 #include "vm/lockers.h" 8 #include "vm/lockers.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 ThreadRegistry::~ThreadRegistry() {
13 {
14 // Each thread that is scheduled in this isolate may have a cached timeline
15 // block. Mark these timeline blocks as finished.
16 MonitorLocker ml(monitor_);
17 TimelineEventRecorder* recorder = Timeline::recorder();
18 if (recorder != NULL) {
19 MutexLocker recorder_lock(&recorder->lock_);
20 for (intptr_t i = 0; i < entries_.length(); i++) {
21 // NOTE: It is only safe to access |entry.state| here.
22 const Entry& entry = entries_.At(i);
23 if (entry.state.timeline_block != NULL) {
24 entry.state.timeline_block->Finish();
25 }
26 }
27 }
28 }
29
30 // Delete monitor.
31 delete monitor_;
32 }
33
34
12 void ThreadRegistry::SafepointThreads() { 35 void ThreadRegistry::SafepointThreads() {
13 MonitorLocker ml(monitor_); 36 MonitorLocker ml(monitor_);
14 // First wait for any older rounds that are still in progress. 37 // First wait for any older rounds that are still in progress.
15 while (in_rendezvous_) { 38 while (in_rendezvous_) {
16 // Assert we are not the organizer trying to nest calls to SafepointThreads. 39 // Assert we are not the organizer trying to nest calls to SafepointThreads.
17 ASSERT(remaining_ > 0); 40 ASSERT(remaining_ > 0);
18 CheckSafepointLocked(); 41 CheckSafepointLocked();
19 } 42 }
20 // Start a new round. 43 // Start a new round.
21 in_rendezvous_ = true; 44 in_rendezvous_ = true;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 for (int i = 0; i < entries_.length(); ++i) { 98 for (int i = 0; i < entries_.length(); ++i) {
76 const Entry& entry = entries_[i]; 99 const Entry& entry = entries_[i];
77 if (entry.scheduled) { 100 if (entry.scheduled) {
78 ++count; 101 ++count;
79 } 102 }
80 } 103 }
81 return count; 104 return count;
82 } 105 }
83 106
84 } // namespace dart 107 } // namespace dart
OLDNEW
« runtime/vm/dart.cc ('K') | « runtime/vm/thread_registry.h ('k') | runtime/vm/timeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698