comparison libinterp/parse-tree/pt-unop.cc @ 19361: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 d63878346099
children be7ac98fab43
comparison
equal deleted inserted replaced
19359:2b708273548d 19361:91cd85a75705
71 { 71 {
72 octave_lvalue ref = op->lvalue (); 72 octave_lvalue ref = op->lvalue ();
73 73
74 if (! error_state) 74 if (! error_state)
75 { 75 {
76 BEGIN_PROFILER_BLOCK ("prefix " + oper ()) 76 BEGIN_PROFILER_BLOCK (tree_prefix_expression)
77 77
78 ref.do_unary_op (etype); 78 ref.do_unary_op (etype);
79 79
80 if (! error_state) 80 if (! error_state)
81 retval = ref.value (); 81 retval = ref.value ();
82 82
87 { 87 {
88 octave_value val = op->rvalue1 (); 88 octave_value val = op->rvalue1 ();
89 89
90 if (! error_state && val.is_defined ()) 90 if (! error_state && val.is_defined ())
91 { 91 {
92 BEGIN_PROFILER_BLOCK ("prefix " + oper ()) 92 BEGIN_PROFILER_BLOCK (tree_prefix_expression)
93 93
94 // Attempt to do the operation in-place if it is unshared 94 // Attempt to do the operation in-place if it is unshared
95 // (a temporary expression). 95 // (a temporary expression).
96 if (val.get_count () == 1) 96 if (val.get_count () == 1)
97 retval = val.do_non_const_unary_op (etype); 97 retval = val.do_non_const_unary_op (etype);
160 160
161 if (! error_state) 161 if (! error_state)
162 { 162 {
163 retval = ref.value (); 163 retval = ref.value ();
164 164
165 BEGIN_PROFILER_BLOCK ("postfix " + oper ()) 165 BEGIN_PROFILER_BLOCK (tree_postfix_expression)
166
166 ref.do_unary_op (etype); 167 ref.do_unary_op (etype);
168
167 END_PROFILER_BLOCK 169 END_PROFILER_BLOCK
168 } 170 }
169 } 171 }
170 else 172 else
171 { 173 {
172 octave_value val = op->rvalue1 (); 174 octave_value val = op->rvalue1 ();
173 175
174 if (! error_state && val.is_defined ()) 176 if (! error_state && val.is_defined ())
175 { 177 {
176 BEGIN_PROFILER_BLOCK ("postfix " + oper ()) 178 BEGIN_PROFILER_BLOCK (tree_postfix_expression)
177 179
178 retval = ::do_unary_op (etype, val); 180 retval = ::do_unary_op (etype, val);
179 181
180 if (error_state) 182 if (error_state)
181 retval = octave_value (); 183 retval = octave_value ();