From e07cbe5edfef74005a56205586202e9a224f0500 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 12 Aug 2016 18:00:47 -0700 Subject: 3174 --- html/020run.cc.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'html/020run.cc.html') diff --git a/html/020run.cc.html b/html/020run.cc.html index 77f00c93..f3a54f18 100644 --- a/html/020run.cc.html +++ b/html/020run.cc.html @@ -207,19 +207,28 @@ save_snapshots(); // Running Main setup(); //? Save_trace = true; -//? START_TRACING_UNTIL_END_OF_SCOPE; + if (Trace_main) Trace_stream = new trace_stream; trace(9990, "run") << "=== Starting to run" << end(); assert(Num_calls_to_transform_all == 1); run_main(argc, argv); + if (Trace_main) delete Trace_stream, Trace_stream = NULL; teardown(); } - :(code) void run_main(int argc, char* argv[]) { recipe_ordinal r = get(Recipe_ordinal, "main"); if (r) run(r); } +//: By default we don't maintain the trace while running main because its +//: overheads can grow rapidly. However, it's useful when debugging. +:(before "End Globals") +bool Trace_main = false; +:(before "End Commandline Options(*arg)") +else if (is_equal(*arg, "--trace")) { + Trace_main = true; +} + :(code) void dump_profile() { for (map<string, int>::iterator p = Instructions_running.begin(); p != Instructions_running.end(); ++p) { -- cgit 1.4.1-2-gfad0