26 #if ! defined (octave_profiler_h)
27 #define octave_profiler_h 1
29 #include "octave-config.h"
49 template <
typename T>
class enter
62 m_enabled = m_profiler.
enabled ();
66 m_fcn = t.profiler_name ();
75 m_profiler.enter_function (m_fcn);
79 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (
enter)
84 m_profiler.exit_function (m_fcn);
94 bool enabled ()
const {
return m_enabled; }
95 void set_active (
bool);
113 OCTAVE_DEFAULT_COPY_MOVE_DELETE (stats)
115 typedef std::set<octave_idx_type> function_set;
118 static octave_value function_set_value (
const function_set&);
127 function_set m_parents;
128 function_set m_children;
131 typedef std::vector<stats> flat_profile;
141 virtual ~tree_node ();
143 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_node)
145 void add_time (
double dt) { m_time += dt; }
156 void build_flat (flat_profile&)
const;
161 octave_value get_hierarchical (
double *total =
nullptr)
const;
168 typedef std::map<octave_idx_type, tree_node *> child_map;
169 child_map m_children;
182 typedef std::vector<std::string> function_set;
183 typedef std::map<std::string, octave_idx_type> fcn_index_map;
185 function_set m_known_functions;
186 fcn_index_map m_fcn_index;
190 tree_node *m_call_tree;
191 tree_node *m_active_fcn;
199 void enter_function (
const std::string&);
200 void exit_function (
const std::string&);
206 double query_time ()
const;
211 void add_current_time ();
214 OCTAVE_END_NAMESPACE(
octave)
enter(profiler &p, const T &t)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn