| OLD | NEW |
| 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 "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/text_buffer.h" | 10 #include "platform/text_buffer.h" |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 if (event != NULL) { | 1161 if (event != NULL) { |
| 1162 event->Instant("Runnable"); | 1162 event->Instant("Runnable"); |
| 1163 event->Complete(); | 1163 event->Complete(); |
| 1164 } | 1164 } |
| 1165 } | 1165 } |
| 1166 if (FLAG_support_service && Service::isolate_stream.enabled()) { | 1166 if (FLAG_support_service && Service::isolate_stream.enabled()) { |
| 1167 ServiceEvent runnableEvent(this, ServiceEvent::kIsolateRunnable); | 1167 ServiceEvent runnableEvent(this, ServiceEvent::kIsolateRunnable); |
| 1168 Service::HandleEvent(&runnableEvent); | 1168 Service::HandleEvent(&runnableEvent); |
| 1169 } | 1169 } |
| 1170 #endif // !PRODUCT | 1170 #endif // !PRODUCT |
| 1171 GetRunnableLatencyMetric()->set_value(UptimeMicros()); |
| 1172 if (FLAG_print_benchmarking_metrics) { |
| 1173 { |
| 1174 StartIsolateScope scope(this); |
| 1175 heap()->CollectAllGarbage(); |
| 1176 } |
| 1177 int64_t heap_size = (heap()->UsedInWords(Heap::kNew) * kWordSize) + |
| 1178 (heap()->UsedInWords(Heap::kOld) * kWordSize); |
| 1179 GetRunnableHeapSizeMetric()->set_value(heap_size); |
| 1180 } |
| 1171 return true; | 1181 return true; |
| 1172 } | 1182 } |
| 1173 | 1183 |
| 1174 | 1184 |
| 1175 bool Isolate::VerifyPauseCapability(const Object& capability) const { | 1185 bool Isolate::VerifyPauseCapability(const Object& capability) const { |
| 1176 return !capability.IsNull() && capability.IsCapability() && | 1186 return !capability.IsNull() && capability.IsCapability() && |
| 1177 (pause_capability() == Capability::Cast(capability).Id()); | 1187 (pause_capability() == Capability::Cast(capability).Id()); |
| 1178 } | 1188 } |
| 1179 | 1189 |
| 1180 | 1190 |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 if (FLAG_dump_symbol_stats) { | 1668 if (FLAG_dump_symbol_stats) { |
| 1659 Symbols::DumpStats(this); | 1669 Symbols::DumpStats(this); |
| 1660 } | 1670 } |
| 1661 if (FLAG_trace_isolates) { | 1671 if (FLAG_trace_isolates) { |
| 1662 heap()->PrintSizes(); | 1672 heap()->PrintSizes(); |
| 1663 OS::Print( | 1673 OS::Print( |
| 1664 "[-] Stopping isolate:\n" | 1674 "[-] Stopping isolate:\n" |
| 1665 "\tisolate: %s\n", | 1675 "\tisolate: %s\n", |
| 1666 name()); | 1676 name()); |
| 1667 } | 1677 } |
| 1668 if (FLAG_print_metrics) { | 1678 if (FLAG_print_metrics || FLAG_print_benchmarking_metrics) { |
| 1669 LogBlock lb; | 1679 LogBlock lb; |
| 1670 OS::PrintErr("Printing metrics for %s\n", name()); | 1680 OS::PrintErr("Printing metrics for %s\n", name()); |
| 1671 #define ISOLATE_METRIC_PRINT(type, variable, name, unit) \ | 1681 #define ISOLATE_METRIC_PRINT(type, variable, name, unit) \ |
| 1672 OS::PrintErr("%s\n", metric_##variable##_.ToString()); | 1682 OS::PrintErr("%s\n", metric_##variable##_.ToString()); |
| 1673 | 1683 ISOLATE_METRIC_LIST(ISOLATE_METRIC_PRINT) |
| 1674 ISOLATE_METRIC_LIST(ISOLATE_METRIC_PRINT); | |
| 1675 #undef ISOLATE_METRIC_PRINT | 1684 #undef ISOLATE_METRIC_PRINT |
| 1676 OS::PrintErr("\n"); | 1685 OS::PrintErr("\n"); |
| 1677 } | 1686 } |
| 1678 } | 1687 } |
| 1679 | 1688 |
| 1680 | 1689 |
| 1681 void Isolate::StopBackgroundCompiler() { | 1690 void Isolate::StopBackgroundCompiler() { |
| 1682 // Wait until all background compilation has finished. | 1691 // Wait until all background compilation has finished. |
| 1683 if (background_compiler_ != NULL) { | 1692 if (background_compiler_ != NULL) { |
| 1684 BackgroundCompiler::Stop(this); | 1693 BackgroundCompiler::Stop(this); |
| (...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2936 void IsolateSpawnState::DecrementSpawnCount() { | 2945 void IsolateSpawnState::DecrementSpawnCount() { |
| 2937 ASSERT(spawn_count_monitor_ != NULL); | 2946 ASSERT(spawn_count_monitor_ != NULL); |
| 2938 ASSERT(spawn_count_ != NULL); | 2947 ASSERT(spawn_count_ != NULL); |
| 2939 MonitorLocker ml(spawn_count_monitor_); | 2948 MonitorLocker ml(spawn_count_monitor_); |
| 2940 ASSERT(*spawn_count_ > 0); | 2949 ASSERT(*spawn_count_ > 0); |
| 2941 *spawn_count_ = *spawn_count_ - 1; | 2950 *spawn_count_ = *spawn_count_ - 1; |
| 2942 ml.Notify(); | 2951 ml.Notify(); |
| 2943 } | 2952 } |
| 2944 | 2953 |
| 2945 } // namespace dart | 2954 } // namespace dart |
| OLD | NEW |