Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: runtime/vm/service.cc

Issue 98253007: Adds CPU message type to vm service. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/cpu.h"
5 #include "vm/debugger.h" 6 #include "vm/debugger.h"
6 #include "vm/heap_histogram.h" 7 #include "vm/heap_histogram.h"
7 #include "vm/isolate.h" 8 #include "vm/isolate.h"
8 #include "vm/message.h" 9 #include "vm/message.h"
9 #include "vm/object.h" 10 #include "vm/object.h"
10 #include "vm/object_id_ring.h" 11 #include "vm/object_id_ring.h"
11 #include "vm/object_store.h" 12 #include "vm/object_store.h"
12 #include "vm/port.h" 13 #include "vm/port.h"
13 #include "vm/service.h" 14 #include "vm/service.h"
14 15
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 REQUIRE_COLLECTION_ID("objects"); 248 REQUIRE_COLLECTION_ID("objects");
248 ASSERT(js->num_arguments() >= 2); 249 ASSERT(js->num_arguments() >= 2);
249 ObjectIdRing* ring = isolate->object_id_ring(); 250 ObjectIdRing* ring = isolate->object_id_ring();
250 ASSERT(ring != NULL); 251 ASSERT(ring != NULL);
251 intptr_t id = atoi(js->GetArgument(1)); 252 intptr_t id = atoi(js->GetArgument(1));
252 Object& obj = Object::Handle(ring->GetObjectForId(id)); 253 Object& obj = Object::Handle(ring->GetObjectForId(id));
253 obj.PrintToJSONStream(js, false); 254 obj.PrintToJSONStream(js, false);
254 } 255 }
255 256
256 257
258 static void HandleCpu(Isolate* isolate, JSONStream* js) {
259 JSONObject jsobj(js);
260 jsobj.AddProperty("type", "CPU");
261 jsobj.AddProperty("architecture", CPU::Id());
262 }
263
264
265 // Alphabetical order.
257 static ServiceMessageHandlerEntry __message_handlers[] = { 266 static ServiceMessageHandlerEntry __message_handlers[] = {
267 { "_echo", HandleEcho },
268 { "classes", HandleClasses },
269 { "cpu", HandleCpu },
270 { "library", HandleLibrary },
258 { "name", HandleName }, 271 { "name", HandleName },
272 { "objecthistogram", HandleObjectHistogram},
273 { "objects", HandleObjects },
259 { "stacktrace", HandleStackTrace }, 274 { "stacktrace", HandleStackTrace },
260 { "objecthistogram", HandleObjectHistogram},
261 { "library", HandleLibrary },
262 { "classes", HandleClasses },
263 { "objects", HandleObjects },
264 { "_echo", HandleEcho },
265 }; 275 };
266 276
267 277
268 static void HandleFallthrough(Isolate* isolate, JSONStream* js) { 278 static void HandleFallthrough(Isolate* isolate, JSONStream* js) {
269 JSONObject jsobj(js); 279 JSONObject jsobj(js);
270 jsobj.AddProperty("type", "error"); 280 jsobj.AddProperty("type", "error");
271 jsobj.AddProperty("text", "request not understood."); 281 jsobj.AddProperty("text", "request not understood.");
272 PrintArgumentsAndOptions(jsobj, js); 282 PrintArgumentsAndOptions(jsobj, js);
273 } 283 }
274 284
275 285
276 static ServiceMessageHandler FindServiceMessageHandler(const char* command) { 286 static ServiceMessageHandler FindServiceMessageHandler(const char* command) {
277 intptr_t num_message_handlers = sizeof(__message_handlers) / 287 intptr_t num_message_handlers = sizeof(__message_handlers) /
278 sizeof(__message_handlers[0]); 288 sizeof(__message_handlers[0]);
279 for (intptr_t i = 0; i < num_message_handlers; i++) { 289 for (intptr_t i = 0; i < num_message_handlers; i++) {
280 const ServiceMessageHandlerEntry& entry = __message_handlers[i]; 290 const ServiceMessageHandlerEntry& entry = __message_handlers[i];
281 if (!strcmp(command, entry.command)) { 291 if (!strcmp(command, entry.command)) {
282 return entry.handler; 292 return entry.handler;
283 } 293 }
284 } 294 }
285 return HandleFallthrough; 295 return HandleFallthrough;
286 } 296 }
287 297
288 } // namespace dart 298 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698