Mercurial > octave-nkf
diff libinterp/corefcn/profiler.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 | 83c85d95ac7b |
children | cbc838b3020c a1d172bfcb2f |
line wrap: on
line diff
--- a/libinterp/corefcn/profiler.cc Sat Nov 08 16:45:13 2014 +0100 +++ b/libinterp/corefcn/profiler.cc Mon Jun 23 18:46:32 2014 +0200 @@ -1,5 +1,6 @@ /* +Copyright (C) 2014 Julien Bect Copyright (C) 2012-2013 Daniel Kraft This file is part of Octave. @@ -32,29 +33,6 @@ #include "pager.h" #include "profiler.h" -profile_data_accumulator::enter::enter (profile_data_accumulator& a, - const std::string& f) - : acc (a) -{ - // FIXME: Add test for f != "" to prevent a blank line showing up - // in profiler statistics. See bug #39524. The root cause - // is that the function name is not set for the recurring readline - // hook function. - if (acc.is_active () && f != "") - { - fcn = f; - acc.enter_function (fcn); - } - else - fcn = ""; -} - -profile_data_accumulator::enter::~enter () -{ - if (fcn != "") - acc.exit_function (fcn); -} - profile_data_accumulator::stats::stats () : time (0.0), calls (0), recursive (false), parents (), children ()