| 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/service.h" | 5 #include "vm/service.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 } | 1660 } |
| 1661 if (js->HasOption("gc")) { | 1661 if (js->HasOption("gc")) { |
| 1662 if (js->OptionIs("gc", "full")) { | 1662 if (js->OptionIs("gc", "full")) { |
| 1663 should_collect = true; | 1663 should_collect = true; |
| 1664 } else { | 1664 } else { |
| 1665 PrintError(js, "Unrecognized gc option '%s'", js->LookupOption("gc")); | 1665 PrintError(js, "Unrecognized gc option '%s'", js->LookupOption("gc")); |
| 1666 return true; | 1666 return true; |
| 1667 } | 1667 } |
| 1668 } | 1668 } |
| 1669 if (should_reset_accumulator) { | 1669 if (should_reset_accumulator) { |
| 1670 isolate->UpdateLastAllocationProfileAccumulatorResetTimestamp(); |
| 1670 isolate->class_table()->ResetAllocationAccumulators(); | 1671 isolate->class_table()->ResetAllocationAccumulators(); |
| 1671 } | 1672 } |
| 1672 if (should_collect) { | 1673 if (should_collect) { |
| 1674 isolate->UpdateLastAllocationProfileGCTimestamp(); |
| 1673 isolate->heap()->CollectAllGarbage(); | 1675 isolate->heap()->CollectAllGarbage(); |
| 1674 } | 1676 } |
| 1675 isolate->class_table()->AllocationProfilePrintJSON(js); | 1677 isolate->class_table()->AllocationProfilePrintJSON(js); |
| 1676 return true; | 1678 return true; |
| 1677 } | 1679 } |
| 1678 | 1680 |
| 1679 | 1681 |
| 1680 static bool HandleTypeArguments(Isolate* isolate, JSONStream* js) { | 1682 static bool HandleTypeArguments(Isolate* isolate, JSONStream* js) { |
| 1681 ObjectStore* object_store = isolate->object_store(); | 1683 ObjectStore* object_store = isolate->object_store(); |
| 1682 const Array& table = Array::Handle(object_store->canonical_type_arguments()); | 1684 const Array& table = Array::Handle(object_store->canonical_type_arguments()); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1931 JSONArray* jsarr_; | 1933 JSONArray* jsarr_; |
| 1932 }; | 1934 }; |
| 1933 | 1935 |
| 1934 | 1936 |
| 1935 static bool HandleVM(JSONStream* js) { | 1937 static bool HandleVM(JSONStream* js) { |
| 1936 JSONObject jsobj(js); | 1938 JSONObject jsobj(js); |
| 1937 jsobj.AddProperty("type", "VM"); | 1939 jsobj.AddProperty("type", "VM"); |
| 1938 jsobj.AddProperty("id", "vm"); | 1940 jsobj.AddProperty("id", "vm"); |
| 1939 jsobj.AddProperty("targetCPU", CPU::Id()); | 1941 jsobj.AddProperty("targetCPU", CPU::Id()); |
| 1940 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); | 1942 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); |
| 1943 jsobj.AddPropertyF("date", "%" Pd64 "", OS::GetCurrentTimeMillis()); |
| 1941 jsobj.AddProperty("version", Version::String()); | 1944 jsobj.AddProperty("version", Version::String()); |
| 1942 // Send pid as a string because it allows us to avoid any issues with | 1945 // Send pid as a string because it allows us to avoid any issues with |
| 1943 // pids > 53-bits (when consumed by JavaScript). | 1946 // pids > 53-bits (when consumed by JavaScript). |
| 1944 // TODO(johnmccutchan): Codify how integers are sent across the service. | 1947 // TODO(johnmccutchan): Codify how integers are sent across the service. |
| 1945 jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId()); | 1948 jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId()); |
| 1946 jsobj.AddProperty("assertsEnabled", FLAG_enable_asserts); | 1949 jsobj.AddProperty("assertsEnabled", FLAG_enable_asserts); |
| 1947 jsobj.AddProperty("typeChecksEnabled", FLAG_enable_type_checks); | 1950 jsobj.AddProperty("typeChecksEnabled", FLAG_enable_type_checks); |
| 1948 int64_t start_time_micros = Dart::vm_isolate()->start_time(); | 1951 int64_t start_time_micros = Dart::vm_isolate()->start_time(); |
| 1949 int64_t uptime_micros = (OS::GetCurrentTimeMicros() - start_time_micros); | 1952 int64_t uptime_micros = (OS::GetCurrentTimeMicros() - start_time_micros); |
| 1950 double seconds = (static_cast<double>(uptime_micros) / | 1953 double seconds = (static_cast<double>(uptime_micros) / |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2110 while (current != NULL) { | 2113 while (current != NULL) { |
| 2111 if (strcmp(name, current->name()) == 0) { | 2114 if (strcmp(name, current->name()) == 0) { |
| 2112 return current; | 2115 return current; |
| 2113 } | 2116 } |
| 2114 current = current->next(); | 2117 current = current->next(); |
| 2115 } | 2118 } |
| 2116 return NULL; | 2119 return NULL; |
| 2117 } | 2120 } |
| 2118 | 2121 |
| 2119 } // namespace dart | 2122 } // namespace dart |
| OLD | NEW |