| 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 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 }; | 1932 }; |
| 1933 | 1933 |
| 1934 | 1934 |
| 1935 static bool HandleVM(JSONStream* js) { | 1935 static bool HandleVM(JSONStream* js) { |
| 1936 JSONObject jsobj(js); | 1936 JSONObject jsobj(js); |
| 1937 jsobj.AddProperty("type", "VM"); | 1937 jsobj.AddProperty("type", "VM"); |
| 1938 jsobj.AddProperty("id", "vm"); | 1938 jsobj.AddProperty("id", "vm"); |
| 1939 jsobj.AddProperty("targetCPU", CPU::Id()); | 1939 jsobj.AddProperty("targetCPU", CPU::Id()); |
| 1940 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); | 1940 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); |
| 1941 jsobj.AddProperty("version", Version::String()); | 1941 jsobj.AddProperty("version", Version::String()); |
| 1942 // Send pid as a string because it allows us to avoid any issues with |
| 1943 // pids > 53-bits (when consumed by JavaScript). |
| 1944 // TODO(johnmccutchan): Codify how integers are sent across the service. |
| 1945 jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId()); |
| 1942 jsobj.AddProperty("assertsEnabled", FLAG_enable_asserts); | 1946 jsobj.AddProperty("assertsEnabled", FLAG_enable_asserts); |
| 1943 jsobj.AddProperty("typeChecksEnabled", FLAG_enable_type_checks); | 1947 jsobj.AddProperty("typeChecksEnabled", FLAG_enable_type_checks); |
| 1944 int64_t start_time_micros = Dart::vm_isolate()->start_time(); | 1948 int64_t start_time_micros = Dart::vm_isolate()->start_time(); |
| 1945 int64_t uptime_micros = (OS::GetCurrentTimeMicros() - start_time_micros); | 1949 int64_t uptime_micros = (OS::GetCurrentTimeMicros() - start_time_micros); |
| 1946 double seconds = (static_cast<double>(uptime_micros) / | 1950 double seconds = (static_cast<double>(uptime_micros) / |
| 1947 static_cast<double>(kMicrosecondsPerSecond)); | 1951 static_cast<double>(kMicrosecondsPerSecond)); |
| 1948 jsobj.AddProperty("uptime", seconds); | 1952 jsobj.AddProperty("uptime", seconds); |
| 1949 | 1953 |
| 1950 // Construct the isolate list. | 1954 // Construct the isolate list. |
| 1951 { | 1955 { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 while (current != NULL) { | 2110 while (current != NULL) { |
| 2107 if (strcmp(name, current->name()) == 0) { | 2111 if (strcmp(name, current->name()) == 0) { |
| 2108 return current; | 2112 return current; |
| 2109 } | 2113 } |
| 2110 current = current->next(); | 2114 current = current->next(); |
| 2111 } | 2115 } |
| 2112 return NULL; | 2116 return NULL; |
| 2113 } | 2117 } |
| 2114 | 2118 |
| 2115 } // namespace dart | 2119 } // namespace dart |
| OLD | NEW |