diff libinterp/parse-tree/pt-unop.h @ 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 ebb3ef964372
children 4197fc428c7d
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-unop.h	Sat Nov 08 16:45:13 2014 +0100
+++ b/libinterp/parse-tree/pt-unop.h	Mon Jun 23 18:46:32 2014 +0200
@@ -108,6 +108,9 @@
 
   void accept (tree_walker& tw);
 
+  std::string profiler_name (void) const { return "prefix " + oper (); }
+
+
 private:
 
   // No copying!
@@ -145,6 +148,8 @@
 
   void accept (tree_walker& tw);
 
+  std::string profiler_name (void) const { return "postfix " + oper (); }
+
 private:
 
   // No copying!