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 3187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3198 jsarr_->AddValue(isolate); | 3198 jsarr_->AddValue(isolate); |
3199 } | 3199 } |
3200 } | 3200 } |
3201 | 3201 |
3202 private: | 3202 private: |
3203 JSONArray* jsarr_; | 3203 JSONArray* jsarr_; |
3204 }; | 3204 }; |
3205 | 3205 |
3206 | 3206 |
3207 static bool HandleVM(JSONStream* js) { | 3207 static bool HandleVM(JSONStream* js) { |
| 3208 Isolate* isolate = Isolate::Current(); |
3208 JSONObject jsobj(js); | 3209 JSONObject jsobj(js); |
3209 jsobj.AddProperty("type", "VM"); | 3210 jsobj.AddProperty("type", "VM"); |
3210 jsobj.AddProperty("id", "vm"); | 3211 jsobj.AddProperty("id", "vm"); |
3211 jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord)); | 3212 jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord)); |
3212 jsobj.AddProperty("targetCPU", CPU::Id()); | 3213 jsobj.AddProperty("targetCPU", CPU::Id()); |
3213 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); | 3214 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); |
3214 jsobj.AddPropertyF("date", "%" Pd64 "", OS::GetCurrentTimeMillis()); | 3215 jsobj.AddPropertyF("date", "%" Pd64 "", OS::GetCurrentTimeMillis()); |
3215 jsobj.AddProperty("version", Version::String()); | 3216 jsobj.AddProperty("version", Version::String()); |
3216 // Send pid as a string because it allows us to avoid any issues with | 3217 // Send pid as a string because it allows us to avoid any issues with |
3217 // pids > 53-bits (when consumed by JavaScript). | 3218 // pids > 53-bits (when consumed by JavaScript). |
3218 // TODO(johnmccutchan): Codify how integers are sent across the service. | 3219 // TODO(johnmccutchan): Codify how integers are sent across the service. |
3219 jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId()); | 3220 jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId()); |
3220 jsobj.AddProperty("assertsEnabled", FLAG_enable_asserts); | 3221 jsobj.AddProperty("assertsEnabled", |
3221 jsobj.AddProperty("typeChecksEnabled", FLAG_enable_type_checks); | 3222 FLAG_enable_asserts || isolate->checked_mode()); |
| 3223 jsobj.AddProperty("typeChecksEnabled", |
| 3224 FLAG_enable_type_checks || isolate->checked_mode()); |
3222 int64_t start_time_micros = Dart::vm_isolate()->start_time(); | 3225 int64_t start_time_micros = Dart::vm_isolate()->start_time(); |
3223 int64_t uptime_micros = (OS::GetCurrentTimeMicros() - start_time_micros); | 3226 int64_t uptime_micros = (OS::GetCurrentTimeMicros() - start_time_micros); |
3224 double seconds = (static_cast<double>(uptime_micros) / | 3227 double seconds = (static_cast<double>(uptime_micros) / |
3225 static_cast<double>(kMicrosecondsPerSecond)); | 3228 static_cast<double>(kMicrosecondsPerSecond)); |
3226 jsobj.AddProperty("uptime", seconds); | 3229 jsobj.AddProperty("uptime", seconds); |
3227 | 3230 |
3228 // Construct the isolate list. | 3231 // Construct the isolate list. |
3229 { | 3232 { |
3230 JSONArray jsarr(&jsobj, "isolates"); | 3233 JSONArray jsarr(&jsobj, "isolates"); |
3231 ServiceIsolateVisitor visitor(&jsarr); | 3234 ServiceIsolateVisitor visitor(&jsarr); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3480 while (current != NULL) { | 3483 while (current != NULL) { |
3481 if (strcmp(name, current->name()) == 0) { | 3484 if (strcmp(name, current->name()) == 0) { |
3482 return current; | 3485 return current; |
3483 } | 3486 } |
3484 current = current->next(); | 3487 current = current->next(); |
3485 } | 3488 } |
3486 return NULL; | 3489 return NULL; |
3487 } | 3490 } |
3488 | 3491 |
3489 } // namespace dart | 3492 } // namespace dart |
OLD | NEW |