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

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

Issue 1779333004: Add profile data to getSourceReport (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months 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/profiler_test.cc ('k') | runtime/vm/source_report.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 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 NULL, 2393 NULL,
2394 }; 2394 };
2395 2395
2396 2396
2397 static bool GetCoverage(Thread* thread, JSONStream* js) { 2397 static bool GetCoverage(Thread* thread, JSONStream* js) {
2398 // TODO(rmacnak): Remove this response; it is subsumed by GetCallSiteData. 2398 // TODO(rmacnak): Remove this response; it is subsumed by GetCallSiteData.
2399 return GetHitsOrSites(thread, js, false); 2399 return GetHitsOrSites(thread, js, false);
2400 } 2400 }
2401 2401
2402 2402
2403 static const char* kCallSitesStr = "_CallSites";
2404 static const char* kCoverageStr = "Coverage";
2405 static const char* kPossibleBreakpointsStr = "PossibleBreakpoints";
2406
2407
2408 static const char* const report_enum_names[] = { 2403 static const char* const report_enum_names[] = {
2409 kCallSitesStr, 2404 SourceReport::kCallSitesStr,
2410 kCoverageStr, 2405 SourceReport::kCoverageStr,
2411 kPossibleBreakpointsStr, 2406 SourceReport::kPossibleBreakpointsStr,
2407 SourceReport::kProfileStr,
2412 NULL, 2408 NULL,
2413 }; 2409 };
2414 2410
2415 2411
2416 static const MethodParameter* get_source_report_params[] = { 2412 static const MethodParameter* get_source_report_params[] = {
2417 RUNNABLE_ISOLATE_PARAMETER, 2413 RUNNABLE_ISOLATE_PARAMETER,
2418 new EnumListParameter("reports", true, report_enum_names), 2414 new EnumListParameter("reports", true, report_enum_names),
2419 new IdParameter("scriptId", false), 2415 new IdParameter("scriptId", false),
2420 new UIntParameter("tokenPos", false), 2416 new UIntParameter("tokenPos", false),
2421 new UIntParameter("endTokenPos", false), 2417 new UIntParameter("endTokenPos", false),
2422 new BoolParameter("forceCompile", false), 2418 new BoolParameter("forceCompile", false),
2423 NULL, 2419 NULL,
2424 }; 2420 };
2425 2421
2426 2422
2427 static bool GetSourceReport(Thread* thread, JSONStream* js) { 2423 static bool GetSourceReport(Thread* thread, JSONStream* js) {
2428 if (!thread->isolate()->compilation_allowed()) { 2424 if (!thread->isolate()->compilation_allowed()) {
2429 js->PrintError(kFeatureDisabled, 2425 js->PrintError(kFeatureDisabled,
2430 "Cannot get source report when running a precompiled program."); 2426 "Cannot get source report when running a precompiled program.");
2431 return true; 2427 return true;
2432 } 2428 }
2433 const char* reports_str = js->LookupParam("reports"); 2429 const char* reports_str = js->LookupParam("reports");
2434 const EnumListParameter* reports_parameter = 2430 const EnumListParameter* reports_parameter =
2435 static_cast<const EnumListParameter*>(get_source_report_params[1]); 2431 static_cast<const EnumListParameter*>(get_source_report_params[1]);
2436 const char** reports = reports_parameter->Parse(thread->zone(), reports_str); 2432 const char** reports = reports_parameter->Parse(thread->zone(), reports_str);
2437 intptr_t report_set = 0; 2433 intptr_t report_set = 0;
2438 while (*reports != NULL) { 2434 while (*reports != NULL) {
2439 if (strcmp(*reports, kCallSitesStr) == 0) { 2435 if (strcmp(*reports, SourceReport::kCallSitesStr) == 0) {
2440 report_set |= SourceReport::kCallSites; 2436 report_set |= SourceReport::kCallSites;
2441 } else if (strcmp(*reports, kCoverageStr) == 0) { 2437 } else if (strcmp(*reports, SourceReport::kCoverageStr) == 0) {
2442 report_set |= SourceReport::kCoverage; 2438 report_set |= SourceReport::kCoverage;
2443 } else if (strcmp(*reports, kPossibleBreakpointsStr) == 0) { 2439 } else if (strcmp(*reports, SourceReport::kPossibleBreakpointsStr) == 0) {
2444 report_set |= SourceReport::kPossibleBreakpoints; 2440 report_set |= SourceReport::kPossibleBreakpoints;
2441 } else if (strcmp(*reports, SourceReport::kProfileStr) == 0) {
2442 report_set |= SourceReport::kProfile;
2445 } 2443 }
2446 reports++; 2444 reports++;
2447 } 2445 }
2448 2446
2449 SourceReport::CompileMode compile_mode = SourceReport::kNoCompile; 2447 SourceReport::CompileMode compile_mode = SourceReport::kNoCompile;
2450 if (BoolParameter::Parse(js->LookupParam("forceCompile"), false)) { 2448 if (BoolParameter::Parse(js->LookupParam("forceCompile"), false)) {
2451 compile_mode = SourceReport::kForceCompile; 2449 compile_mode = SourceReport::kForceCompile;
2452 } 2450 }
2453 2451
2454 Script& script = Script::Handle(); 2452 Script& script = Script::Handle();
(...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after
4108 if (strcmp(method_name, method.name) == 0) { 4106 if (strcmp(method_name, method.name) == 0) {
4109 return &method; 4107 return &method;
4110 } 4108 }
4111 } 4109 }
4112 return NULL; 4110 return NULL;
4113 } 4111 }
4114 4112
4115 #endif // !PRODUCT 4113 #endif // !PRODUCT
4116 4114
4117 } // namespace dart 4115 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/profiler_test.cc ('k') | runtime/vm/source_report.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698