| 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 3206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3217 jsarr_->AddValue(isolate); | 3217 jsarr_->AddValue(isolate); |
| 3218 } | 3218 } |
| 3219 } | 3219 } |
| 3220 | 3220 |
| 3221 private: | 3221 private: |
| 3222 JSONArray* jsarr_; | 3222 JSONArray* jsarr_; |
| 3223 }; | 3223 }; |
| 3224 | 3224 |
| 3225 | 3225 |
| 3226 static bool HandleVM(JSONStream* js) { | 3226 static bool HandleVM(JSONStream* js) { |
| 3227 Isolate* isolate = Isolate::Current(); |
| 3227 JSONObject jsobj(js); | 3228 JSONObject jsobj(js); |
| 3228 jsobj.AddProperty("type", "VM"); | 3229 jsobj.AddProperty("type", "VM"); |
| 3229 jsobj.AddProperty("id", "vm"); | 3230 jsobj.AddProperty("id", "vm"); |
| 3230 jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord)); | 3231 jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord)); |
| 3231 jsobj.AddProperty("targetCPU", CPU::Id()); | 3232 jsobj.AddProperty("targetCPU", CPU::Id()); |
| 3232 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); | 3233 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); |
| 3233 jsobj.AddPropertyF("date", "%" Pd64 "", OS::GetCurrentTimeMillis()); | 3234 jsobj.AddPropertyF("date", "%" Pd64 "", OS::GetCurrentTimeMillis()); |
| 3234 jsobj.AddProperty("version", Version::String()); | 3235 jsobj.AddProperty("version", Version::String()); |
| 3235 // Send pid as a string because it allows us to avoid any issues with | 3236 // Send pid as a string because it allows us to avoid any issues with |
| 3236 // pids > 53-bits (when consumed by JavaScript). | 3237 // pids > 53-bits (when consumed by JavaScript). |
| 3237 // TODO(johnmccutchan): Codify how integers are sent across the service. | 3238 // TODO(johnmccutchan): Codify how integers are sent across the service. |
| 3238 jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId()); | 3239 jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId()); |
| 3239 jsobj.AddProperty("assertsEnabled", FLAG_enable_asserts); | 3240 jsobj.AddProperty("assertsEnabled", isolate->AssertsEnabled()); |
| 3240 jsobj.AddProperty("typeChecksEnabled", FLAG_enable_type_checks); | 3241 jsobj.AddProperty("typeChecksEnabled", isolate->TypeChecksEnabled()); |
| 3241 int64_t start_time_micros = Dart::vm_isolate()->start_time(); | 3242 int64_t start_time_micros = Dart::vm_isolate()->start_time(); |
| 3242 int64_t uptime_micros = (OS::GetCurrentTimeMicros() - start_time_micros); | 3243 int64_t uptime_micros = (OS::GetCurrentTimeMicros() - start_time_micros); |
| 3243 double seconds = (static_cast<double>(uptime_micros) / | 3244 double seconds = (static_cast<double>(uptime_micros) / |
| 3244 static_cast<double>(kMicrosecondsPerSecond)); | 3245 static_cast<double>(kMicrosecondsPerSecond)); |
| 3245 jsobj.AddProperty("uptime", seconds); | 3246 jsobj.AddProperty("uptime", seconds); |
| 3246 | 3247 |
| 3247 // Construct the isolate list. | 3248 // Construct the isolate list. |
| 3248 { | 3249 { |
| 3249 JSONArray jsarr(&jsobj, "isolates"); | 3250 JSONArray jsarr(&jsobj, "isolates"); |
| 3250 ServiceIsolateVisitor visitor(&jsarr); | 3251 ServiceIsolateVisitor visitor(&jsarr); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3498 while (current != NULL) { | 3499 while (current != NULL) { |
| 3499 if (strcmp(name, current->name()) == 0) { | 3500 if (strcmp(name, current->name()) == 0) { |
| 3500 return current; | 3501 return current; |
| 3501 } | 3502 } |
| 3502 current = current->next(); | 3503 current = current->next(); |
| 3503 } | 3504 } |
| 3504 return NULL; | 3505 return NULL; |
| 3505 } | 3506 } |
| 3506 | 3507 |
| 3507 } // namespace dart | 3508 } // namespace dart |
| OLD | NEW |