diff libinterp/octave-value/ov-usr-fcn.cc @ 19327:91cd85a75705 gui-release

Reduce profiling overhead using inlining and templates. * profiler.cc (profile_data_accumulator::enter::enter): Remove function. * profiler.h: Make class "enter" a templated class. Have enter constructor check whether profiling is active before calling the expensive profiler_name() function. Redefine BEGIN_PROFILER_BLOCK macro to call profile_data_accumulator::enter with a classname argument to template. * ov-builtin.cc (octave_builtin::do_multi_index_op): Use new BEGIN_PROFILER_BLOCK macro. * ov-mex-fcn.cc (octave_mex_function::do_multi_index_op): Use new BEGIN_PROFILER_BLOCK macro. * ov-usr-fcn.cc (octave_user_script::do_multi_index_op, octave_user_function::do_multi_index_op): Use new BEGIN_PROFILER_BLOCK macro. * pt-binop.cc (tree_binary_expression::rvalue1): Use new BEGIN_PROFILER_BLOCK macro. * pt-binop.h (profiler_name): New function to return profiler name for class tree_binary_expression. * pt-unop.cc (tree_prefix_expression::rvalue1, tree_postfix_expression::rvalue1): Use new BEGIN_PROFILER_BLOCK macro. * pt-binop.h (profiler_name): New function to return profiler name for class tree_prefix_expression and tree_postfix_expression.
author Julien Bect <julien.bect@supelec.fr>
date Mon, 23 Jun 2014 18:46:32 +0200
parents e3fca7930c1e
children cbc838b3020c
line wrap: on
line diff
--- a/libinterp/octave-value/ov-usr-fcn.cc	Sat Nov 08 16:45:13 2014 +0100
+++ b/libinterp/octave-value/ov-usr-fcn.cc	Mon Jun 23 18:46:32 2014 +0200
@@ -149,8 +149,10 @@
                   frame.protect_var (tree_evaluator::statement_context);
                   tree_evaluator::statement_context = tree_evaluator::script;
 
-                  BEGIN_PROFILER_BLOCK (profiler_name ())
+                  BEGIN_PROFILER_BLOCK (octave_user_script)
+
                   cmd_list->accept (*current_evaluator);
+
                   END_PROFILER_BLOCK
 
                   if (tree_return_command::returning)
@@ -574,7 +576,7 @@
   frame.protect_var (tree_evaluator::statement_context);
   tree_evaluator::statement_context = tree_evaluator::function;
 
-  BEGIN_PROFILER_BLOCK (profiler_name ())
+  BEGIN_PROFILER_BLOCK (octave_user_function)
 
   if (is_special_expr ())
     {