diff src/ov-usr-fcn.cc @ 12960:43d78e103984

Use macro to start profiler blocks. profile.h: Define macros BEGIN/END_PROFILER_BLOCK. ov-builtin.cc: Use it. ov-mex-fcn.cc: Ditto. ov-usr-fcn.cc: Ditto. pt-binop.cc: Ditto. pt-unop.cc: Ditto.
author Daniel Kraft <d@domob.eu>
date Fri, 12 Aug 2011 12:21:48 +0200
parents 5d18231eee00
children 2a8dcb5b3a00
line wrap: on
line diff
--- a/src/ov-usr-fcn.cc	Thu Aug 11 21:12:56 2011 -0500
+++ b/src/ov-usr-fcn.cc	Fri Aug 12 12:21:48 2011 +0200
@@ -134,11 +134,9 @@
                   frame.protect_var (tree_evaluator::statement_context);
                   tree_evaluator::statement_context = tree_evaluator::script;
 
-                  {
-                    profile_data_accumulator::enter pe (profiler,
-                                                        profiler_name ());
-                    cmd_list->accept (*current_evaluator);
-                  }
+                  BEGIN_PROFILER_BLOCK (profiler_name ())
+                  cmd_list->accept (*current_evaluator);
+                  END_PROFILER_BLOCK
 
                   if (tree_return_command::returning)
                     tree_return_command::returning = 0;
@@ -455,26 +453,26 @@
   bool special_expr = (is_inline_function ()
                        || cmd_list->is_anon_function_body ());
 
-  {
-    profile_data_accumulator::enter pe (profiler, profiler_name ());
+  BEGIN_PROFILER_BLOCK (profiler_name ())
 
-    if (special_expr)
-      {
-        assert (cmd_list->length () == 1);
+  if (special_expr)
+    {
+      assert (cmd_list->length () == 1);
 
-        tree_statement *stmt = 0;
+      tree_statement *stmt = 0;
 
-        if ((stmt = cmd_list->front ())
-            && stmt->is_expression ())
-          {
-            tree_expression *expr = stmt->expression ();
+      if ((stmt = cmd_list->front ())
+          && stmt->is_expression ())
+        {
+          tree_expression *expr = stmt->expression ();
 
-            retval = expr->rvalue (nargout);
-          }
-      }
-    else
-      cmd_list->accept (*current_evaluator);
-  }
+          retval = expr->rvalue (nargout);
+        }
+    }
+  else
+    cmd_list->accept (*current_evaluator);
+
+  END_PROFILER_BLOCK
 
   if (echo_commands)
     print_code_function_trailer ();