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

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

Issue 1406413006: Timeline service protocol support with Observatory UI (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/thread.h » ('j') | 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/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
(...skipping 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 2485
2486 static bool GetVMMetric(Thread* thread, JSONStream* js) { 2486 static bool GetVMMetric(Thread* thread, JSONStream* js) {
2487 const char* metric_id = js->LookupParam("metricId"); 2487 const char* metric_id = js->LookupParam("metricId");
2488 if (metric_id == NULL) { 2488 if (metric_id == NULL) {
2489 PrintMissingParamError(js, "metricId"); 2489 PrintMissingParamError(js, "metricId");
2490 } 2490 }
2491 return false; 2491 return false;
2492 } 2492 }
2493 2493
2494 2494
2495 static const MethodParameter* set_vm_timeline_flag_params[] = {
2496 NO_ISOLATE_PARAMETER,
2497 new MethodParameter("_record", true),
2498 NULL,
2499 };
2500
2501
2502 static bool SetVMTimelineFlag(Thread* thread, JSONStream* js) {
2503 Isolate* isolate = thread->isolate();
2504 ASSERT(isolate != NULL);
2505 StackZone zone(thread);
2506
2507 bool recording = strcmp(js->LookupParam("_record"), "all") == 0;
2508 Timeline::SetStreamAPIEnabled(recording);
2509 Timeline::SetStreamCompilerEnabled(recording);
2510 Timeline::SetStreamDartEnabled(recording);
2511 Timeline::SetStreamDebuggerEnabled(recording);
2512 Timeline::SetStreamEmbedderEnabled(recording);
2513 Timeline::SetStreamGCEnabled(recording);
2514 Timeline::SetStreamIsolateEnabled(recording);
2515
2516 PrintSuccess(js);
2517
2518 return true;
2519 }
2520
2521
2522 static const MethodParameter* get_vm_timeline_flag_params[] = {
2523 NO_ISOLATE_PARAMETER,
2524 new MethodParameter("_record", false),
2525 NULL,
2526 };
2527
2528
2529 static bool GetVMTimelineFlag(Thread* thread, JSONStream* js) {
2530 Isolate* isolate = thread->isolate();
2531 ASSERT(isolate != NULL);
2532 StackZone zone(thread);
2533
2534 js->PrintError(kFeatureDisabled, "TODO(johnmccutchan)");
2535 return true;
2536 }
2537
2538
2539 static const MethodParameter* clear_vm_timeline_params[] = {
2540 NO_ISOLATE_PARAMETER,
2541 NULL,
2542 };
2543
2544
2545 static bool ClearVMTimeline(Thread* thread, JSONStream* js) {
2546 Isolate* isolate = thread->isolate();
2547 ASSERT(isolate != NULL);
2548 StackZone zone(thread);
2549
2550 Timeline::Clear();
2551
2552 PrintSuccess(js);
2553
2554 return true;
2555 }
2556
2557
2558 static const MethodParameter* get_vm_timeline_params[] = {
2559 NO_ISOLATE_PARAMETER,
2560 NULL,
2561 };
2562
2563
2564 static bool GetVMTimeline(Thread* thread, JSONStream* js) {
2565 Isolate* isolate = thread->isolate();
2566 ASSERT(isolate != NULL);
2567 StackZone zone(thread);
2568 Timeline::ReclaimCachedBlocksFromThreads();
2569 TimelineEventRecorder* timeline_recorder = Timeline::recorder();
2570 // TODO(johnmccutchan): Return an error.
2571 ASSERT(timeline_recorder != NULL);
2572 TimelineEventFilter filter;
2573 timeline_recorder->PrintJSON(js, &filter);
2574
2575 return true;
2576 }
2577
2578
2495 static const MethodParameter* resume_params[] = { 2579 static const MethodParameter* resume_params[] = {
2496 ISOLATE_PARAMETER, 2580 ISOLATE_PARAMETER,
2497 NULL, 2581 NULL,
2498 }; 2582 };
2499 2583
2500 2584
2501 static bool Resume(Thread* thread, JSONStream* js) { 2585 static bool Resume(Thread* thread, JSONStream* js) {
2502 const char* step_param = js->LookupParam("step"); 2586 const char* step_param = js->LookupParam("step");
2503 Isolate* isolate = thread->isolate(); 2587 Isolate* isolate = thread->isolate();
2504 if (isolate->message_handler()->paused_on_start()) { 2588 if (isolate->message_handler()->paused_on_start()) {
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
3326 { "addBreakpoint", AddBreakpoint, 3410 { "addBreakpoint", AddBreakpoint,
3327 add_breakpoint_params }, 3411 add_breakpoint_params },
3328 { "addBreakpointWithScriptUri", AddBreakpointWithScriptUri, 3412 { "addBreakpointWithScriptUri", AddBreakpointWithScriptUri,
3329 add_breakpoint_with_script_uri_params }, 3413 add_breakpoint_with_script_uri_params },
3330 { "addBreakpointAtEntry", AddBreakpointAtEntry, 3414 { "addBreakpointAtEntry", AddBreakpointAtEntry,
3331 add_breakpoint_at_entry_params }, 3415 add_breakpoint_at_entry_params },
3332 { "_addBreakpointAtActivation", AddBreakpointAtActivation, 3416 { "_addBreakpointAtActivation", AddBreakpointAtActivation,
3333 add_breakpoint_at_activation_params }, 3417 add_breakpoint_at_activation_params },
3334 { "_clearCpuProfile", ClearCpuProfile, 3418 { "_clearCpuProfile", ClearCpuProfile,
3335 clear_cpu_profile_params }, 3419 clear_cpu_profile_params },
3420 { "_clearVMTimeline", ClearVMTimeline,
3421 clear_vm_timeline_params, },
3336 { "evaluate", Evaluate, 3422 { "evaluate", Evaluate,
3337 evaluate_params }, 3423 evaluate_params },
3338 { "evaluateInFrame", EvaluateInFrame, 3424 { "evaluateInFrame", EvaluateInFrame,
3339 evaluate_in_frame_params }, 3425 evaluate_in_frame_params },
3340 { "_getAllocationProfile", GetAllocationProfile, 3426 { "_getAllocationProfile", GetAllocationProfile,
3341 get_allocation_profile_params }, 3427 get_allocation_profile_params },
3342 { "_getAllocationSamples", GetAllocationSamples, 3428 { "_getAllocationSamples", GetAllocationSamples,
3343 get_allocation_samples_params }, 3429 get_allocation_samples_params },
3344 { "_getCallSiteData", GetCallSiteData, 3430 { "_getCallSiteData", GetCallSiteData,
3345 get_call_site_data_params }, 3431 get_call_site_data_params },
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3380 { "_getTypeArgumentsList", GetTypeArgumentsList, 3466 { "_getTypeArgumentsList", GetTypeArgumentsList,
3381 get_type_arguments_list_params }, 3467 get_type_arguments_list_params },
3382 { "getVersion", GetVersion, 3468 { "getVersion", GetVersion,
3383 get_version_params }, 3469 get_version_params },
3384 { "getVM", GetVM, 3470 { "getVM", GetVM,
3385 get_vm_params }, 3471 get_vm_params },
3386 { "_getVMMetric", GetVMMetric, 3472 { "_getVMMetric", GetVMMetric,
3387 get_vm_metric_params }, 3473 get_vm_metric_params },
3388 { "_getVMMetricList", GetVMMetricList, 3474 { "_getVMMetricList", GetVMMetricList,
3389 get_vm_metric_list_params }, 3475 get_vm_metric_list_params },
3476 { "_getVMTimeline", GetVMTimeline,
3477 get_vm_timeline_params },
3478 { "_getVMTimelineFlag", GetVMTimelineFlag,
3479 get_vm_timeline_flag_params },
3390 { "pause", Pause, 3480 { "pause", Pause,
3391 pause_params }, 3481 pause_params },
3392 { "removeBreakpoint", RemoveBreakpoint, 3482 { "removeBreakpoint", RemoveBreakpoint,
3393 remove_breakpoint_params }, 3483 remove_breakpoint_params },
3394 { "_restartVM", RestartVM, 3484 { "_restartVM", RestartVM,
3395 restart_vm_params }, 3485 restart_vm_params },
3396 { "resume", Resume, 3486 { "resume", Resume,
3397 resume_params }, 3487 resume_params },
3398 { "_requestHeapSnapshot", RequestHeapSnapshot, 3488 { "_requestHeapSnapshot", RequestHeapSnapshot,
3399 request_heap_snapshot_params }, 3489 request_heap_snapshot_params },
3400 { "setExceptionPauseMode", SetExceptionPauseMode, 3490 { "setExceptionPauseMode", SetExceptionPauseMode,
3401 set_exception_pause_mode_params }, 3491 set_exception_pause_mode_params },
3402 { "_setFlag", SetFlag, 3492 { "_setFlag", SetFlag,
3403 set_flags_params }, 3493 set_flags_params },
3404 { "setLibraryDebuggable", SetLibraryDebuggable, 3494 { "setLibraryDebuggable", SetLibraryDebuggable,
3405 set_library_debuggable_params }, 3495 set_library_debuggable_params },
3406 { "setName", SetName, 3496 { "setName", SetName,
3407 set_name_params }, 3497 set_name_params },
3408 { "_setTraceClassAllocation", SetTraceClassAllocation, 3498 { "_setTraceClassAllocation", SetTraceClassAllocation,
3409 set_trace_class_allocation_params }, 3499 set_trace_class_allocation_params },
3410 { "setVMName", SetVMName, 3500 { "setVMName", SetVMName,
3411 set_vm_name_params }, 3501 set_vm_name_params },
3502 { "_setVMTimelineFlag", SetVMTimelineFlag,
3503 set_vm_timeline_flag_params },
3412 }; 3504 };
3413 3505
3414 3506
3415 ServiceMethodDescriptor* FindMethod(const char* method_name) { 3507 ServiceMethodDescriptor* FindMethod(const char* method_name) {
3416 intptr_t num_methods = sizeof(service_methods_) / 3508 intptr_t num_methods = sizeof(service_methods_) /
3417 sizeof(service_methods_[0]); 3509 sizeof(service_methods_[0]);
3418 for (intptr_t i = 0; i < num_methods; i++) { 3510 for (intptr_t i = 0; i < num_methods; i++) {
3419 ServiceMethodDescriptor& method = service_methods_[i]; 3511 ServiceMethodDescriptor& method = service_methods_[i];
3420 if (strcmp(method_name, method.name) == 0) { 3512 if (strcmp(method_name, method.name) == 0) {
3421 return &method; 3513 return &method;
3422 } 3514 }
3423 } 3515 }
3424 return NULL; 3516 return NULL;
3425 } 3517 }
3426 3518
3427 3519
3428 } // namespace dart 3520 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698