about summary refs log tree commit diff stats
path: root/html/020run.cc.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-08-12 18:00:47 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-08-12 18:00:47 -0700
commite07cbe5edfef74005a56205586202e9a224f0500 (patch)
tree28f15db3a56d77e1716fcc7e82f451f097d0ee1a /html/020run.cc.html
parent32983f88e46082ebdbf3357ea488beda9497ce38 (diff)
downloadmu-e07cbe5edfef74005a56205586202e9a224f0500.tar.gz
3174
Diffstat (limited to 'html/020run.cc.html')
-rw-r--r--html/020run.cc.html13
1 files changed, 11 insertions, 2 deletions
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<span class="Delimiter">();</span>
   <span class="Comment">// Running Main</span>
   setup<span class="Delimiter">();</span>
 <span class="CommentedCode">//?   Save_trace = true;</span>
-<span class="CommentedCode">//?   START_TRACING_UNTIL_END_OF_SCOPE;</span>
+  <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_main<span class="Delimiter">)</span> Trace_stream = <span class="Normal">new</span> trace_stream<span class="Delimiter">;</span>
   trace<span class="Delimiter">(</span><span class="Constant">9990</span><span class="Delimiter">,</span> <span class="Constant">&quot;run&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;=== Starting to run&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
   assert<span class="Delimiter">(</span>Num_calls_to_transform_all == <span class="Constant">1</span><span class="Delimiter">);</span>
   run_main<span class="Delimiter">(</span>argc<span class="Delimiter">,</span> argv<span class="Delimiter">);</span>
+  <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_main<span class="Delimiter">)</span> <span class="Normal">delete</span> Trace_stream<span class="Delimiter">,</span> Trace_stream = <span class="Constant">NULL</span><span class="Delimiter">;</span>
   teardown<span class="Delimiter">();</span>
 <span class="Delimiter">}</span>
-
 <span class="Delimiter">:(code)</span>
 <span class="Normal">void</span> run_main<span class="Delimiter">(</span><span class="Normal">int</span> argc<span class="Delimiter">,</span> <span class="Normal">char</span>* argv[]<span class="Delimiter">)</span> <span class="Delimiter">{</span>
   recipe_ordinal r = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">&quot;main&quot;</span><span class="Delimiter">);</span>
   <span class="Normal">if</span> <span class="Delimiter">(</span>r<span class="Delimiter">)</span> run<span class="Delimiter">(</span>r<span class="Delimiter">);</span>
 <span class="Delimiter">}</span>
 
+<span class="Comment">//: By default we don't maintain the trace while running main because its</span>
+<span class="Comment">//: overheads can grow rapidly. However, it's useful when debugging.</span>
+<span class="Delimiter">:(before &quot;End Globals&quot;)</span>
+<span class="Normal">bool</span> Trace_main = <span class="Constant">false</span><span class="Delimiter">;</span>
+<span class="Delimiter">:(before &quot;End Commandline Options(*arg)&quot;)</span>
+<span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_equal<span class="Delimiter">(</span>*arg<span class="Delimiter">,</span> <span class="Constant">&quot;--trace&quot;</span><span class="Delimiter">))</span> <span class="Delimiter">{</span>
+  Trace_main = <span class="Constant">true</span><span class="Delimiter">;</span>
+<span class="Delimiter">}</span>
+
 <span class="Delimiter">:(code)</span>
 <span class="Normal">void</span> dump_profile<span class="Delimiter">()</span> <span class="Delimiter">{</span>
   <span class="Normal">for</span> <span class="Delimiter">(</span>map&lt;string<span class="Delimiter">,</span> <span class="Normal">int</span>&gt;::iterator p = Instructions_running<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Instructions_running<span class="Delimiter">.</span>end<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span>