Chromium Code Reviews| 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]; |