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

Unified Diff: bin/main.cc

Issue 10446116: Add flow graph printing into a .cfg file with flag --print-flow-graph-file. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/dart_api.h » ('j') | vm/dart.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/main.cc
===================================================================
--- bin/main.cc (revision 8145)
+++ bin/main.cc (working copy)
@@ -39,6 +39,10 @@
static const char* generate_pprof_symbols_filename = NULL;
+// Global state that stores a file name for flow graph debugging output.
+// NULL if no output is generated.
+static File* flow_graph_file = NULL;
+
// Global state that indicates whether there is a debug breakpoint.
// This pointer points into an argv buffer and does not need to be
// free'd.
@@ -129,6 +133,13 @@
}
+static void ProcessFlowGraphOption(const char* flowgraph_option) {
+ ASSERT(flowgraph_option != NULL);
+ flow_graph_file = File::Open("flowgraph.cfg", File::kWriteTruncate);
+ ASSERT(flow_graph_file != NULL);
siva 2012/06/04 18:23:57 Where is flow_graph_file closed?
Florian Schneider 2012/06/06 11:06:10 At process exit. I could close it explicitly righ
siva 2012/06/06 17:02:47 I disagree, correctness not conciseness is the yar
Florian Schneider 2012/06/07 09:32:26 I view this as an experimental flag. How about ab
+}
+
+
static void ProcessImportMapOption(const char* map) {
ASSERT(map != NULL);
import_map_options->AddArgument(map);
@@ -145,6 +156,7 @@
{ "--generate_pprof_symbols=", ProcessPprofOption },
{ "--import_map=", ProcessImportMapOption },
{ "--package-root=", ProcessPackageRootOption },
+ { "--generate_flow_graph", ProcessFlowGraphOption },
{ NULL, NULL }
};
@@ -165,6 +177,12 @@
}
+static void WriteToFlowGraphFile(const char* buffer, int64_t num_bytes) {
+ ASSERT(flow_graph_file != NULL);
+ flow_graph_file->WriteFully(buffer, num_bytes);
+}
+
+
// Parse out the command line arguments. Returns -1 if the arguments
// are incorrect, 0 otherwise.
static int ParseArguments(int argc,
@@ -195,6 +213,10 @@
Dart_InitPprofSupport();
}
+ if (flow_graph_file != NULL) {
+ Dart_InitFlowGraphPrinting(&WriteToFlowGraphFile);
+ }
+
// Get the script name.
if (i < argc) {
*script_name = argv[i];
« no previous file with comments | « no previous file | include/dart_api.h » ('j') | vm/dart.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698