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

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

Issue 464953002: Add VMMetric and some sample metrics (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/json_stream.h » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/json.h" 9 #include "platform/json.h"
10 #include "vm/code_observers.h" 10 #include "vm/code_observers.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 stack_frame_index_(-1), 429 stack_frame_index_(-1),
430 last_allocationprofile_accumulator_reset_timestamp_(0), 430 last_allocationprofile_accumulator_reset_timestamp_(0),
431 last_allocationprofile_gc_timestamp_(0), 431 last_allocationprofile_gc_timestamp_(0),
432 cha_(NULL), 432 cha_(NULL),
433 object_id_ring_(NULL), 433 object_id_ring_(NULL),
434 trace_buffer_(NULL), 434 trace_buffer_(NULL),
435 profiler_data_(NULL), 435 profiler_data_(NULL),
436 thread_state_(NULL), 436 thread_state_(NULL),
437 tag_table_(GrowableObjectArray::null()), 437 tag_table_(GrowableObjectArray::null()),
438 current_tag_(UserTag::null()), 438 current_tag_(UserTag::null()),
439 metrics_list_head_(NULL),
439 next_(NULL), 440 next_(NULL),
440 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) 441 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS)
441 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) 442 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT)
442 reusable_handles_() { 443 reusable_handles_() {
443 set_vm_tag(VMTag::kIdleTagId); 444 set_vm_tag(VMTag::kIdleTagId);
444 set_user_tag(UserTags::kDefaultUserTag); 445 set_user_tag(UserTags::kDefaultUserTag);
445 } 446 }
446 #undef REUSABLE_HANDLE_SCOPE_INIT 447 #undef REUSABLE_HANDLE_SCOPE_INIT
447 #undef REUSABLE_HANDLE_INITIALIZERS 448 #undef REUSABLE_HANDLE_INITIALIZERS
448 449
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 create_callback_ = NULL; 504 create_callback_ = NULL;
504 isolates_list_monitor_ = new Monitor(); 505 isolates_list_monitor_ = new Monitor();
505 ASSERT(isolates_list_monitor_ != NULL); 506 ASSERT(isolates_list_monitor_ != NULL);
506 } 507 }
507 508
508 509
509 Isolate* Isolate::Init(const char* name_prefix) { 510 Isolate* Isolate::Init(const char* name_prefix) {
510 Isolate* result = new Isolate(); 511 Isolate* result = new Isolate();
511 ASSERT(result != NULL); 512 ASSERT(result != NULL);
512 513
514 // Initialize metrics.
515 #define ISOLATE_METRIC_INIT(type, variable, name, unit) \
516 result->metric_##variable##_.Init(result, name, NULL, Metric::unit);
517 ISOLATE_METRIC_LIST(ISOLATE_METRIC_INIT);
518 #undef ISOLATE_METRIC_INIT
519
520
513 // Add to isolate list. 521 // Add to isolate list.
514 AddIsolateTolist(result); 522 AddIsolateTolist(result);
515 523
524
516 // TODO(5411455): For now just set the recently created isolate as 525 // TODO(5411455): For now just set the recently created isolate as
517 // the current isolate. 526 // the current isolate.
518 SetCurrent(result); 527 SetCurrent(result);
519 528
520 // Setup the isolate specific resuable handles. 529 // Setup the isolate specific resuable handles.
521 #define REUSABLE_HANDLE_ALLOCATION(object) \ 530 #define REUSABLE_HANDLE_ALLOCATION(object) \
522 result->object##_handle_ = result->AllocateReusableHandle<object>(); 531 result->object##_handle_ = result->AllocateReusableHandle<object>();
523 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) 532 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION)
524 #undef REUSABLE_HANDLE_ALLOCATION 533 #undef REUSABLE_HANDLE_ALLOCATION
525 534
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 } 1239 }
1231 MonitorLocker ml(isolates_list_monitor_); 1240 MonitorLocker ml(isolates_list_monitor_);
1232 Isolate* current = isolates_list_head_; 1241 Isolate* current = isolates_list_head_;
1233 while (current) { 1242 while (current) {
1234 visitor->VisitIsolate(current); 1243 visitor->VisitIsolate(current);
1235 current = current->next_; 1244 current = current->next_;
1236 } 1245 }
1237 } 1246 }
1238 1247
1239 1248
1249 intptr_t Isolate::IsolateListLength() {
1250 MonitorLocker ml(isolates_list_monitor_);
1251 intptr_t count = 0;
1252 Isolate* current = isolates_list_head_;
1253 while (current != NULL) {
1254 count++;
1255 current = current->next_;
1256 }
1257 return count;
1258 }
1259
1260
1240 void Isolate::AddIsolateTolist(Isolate* isolate) { 1261 void Isolate::AddIsolateTolist(Isolate* isolate) {
1241 MonitorLocker ml(isolates_list_monitor_); 1262 MonitorLocker ml(isolates_list_monitor_);
1242 ASSERT(isolate != NULL); 1263 ASSERT(isolate != NULL);
1243 ASSERT(isolate->next_ == NULL); 1264 ASSERT(isolate->next_ == NULL);
1244 isolate->next_ = isolates_list_head_; 1265 isolate->next_ = isolates_list_head_;
1245 isolates_list_head_ = isolate; 1266 isolates_list_head_ = isolate;
1246 } 1267 }
1247 1268
1248 1269
1249 void Isolate::RemoveIsolateFromList(Isolate* isolate) { 1270 void Isolate::RemoveIsolateFromList(Isolate* isolate) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 return func.raw(); 1407 return func.raw();
1387 } 1408 }
1388 1409
1389 1410
1390 void IsolateSpawnState::Cleanup() { 1411 void IsolateSpawnState::Cleanup() {
1391 SwitchIsolateScope switch_scope(I); 1412 SwitchIsolateScope switch_scope(I);
1392 Dart::ShutdownIsolate(); 1413 Dart::ShutdownIsolate();
1393 } 1414 }
1394 1415
1395 } // namespace dart 1416 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/json_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698