47 template <
typename T>
class enter
60 m_enabled = m_profiler.
enabled ();
64 m_fcn = t.profiler_name ();
73 m_profiler.enter_function (m_fcn);
77 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (
enter)
82 m_profiler.exit_function (m_fcn);
92 bool enabled ()
const {
return m_enabled; }
93 void set_active (
bool);
111 OCTAVE_DEFAULT_COPY_MOVE_DELETE (stats)
113 typedef std::set<octave_idx_type> function_set;
116 static octave_value function_set_value (
const function_set&);
125 function_set m_parents;
126 function_set m_children;
129 typedef std::vector<stats> flat_profile;
139 virtual ~tree_node ();
141 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_node)
143 void add_time (
double dt) { m_time += dt; }
154 void build_flat (flat_profile&)
const;
159 octave_value get_hierarchical (
double *total =
nullptr)
const;
166 typedef std::map<octave_idx_type, tree_node *> child_map;
167 child_map m_children;
180 typedef std::vector<std::string> function_set;
181 typedef std::map<std::string, octave_idx_type> fcn_index_map;
183 function_set m_known_functions;
184 fcn_index_map m_fcn_index;
188 tree_node *m_call_tree;
189 tree_node *m_active_fcn;
197 void enter_function (
const std::string&);
198 void exit_function (
const std::string&);
204 double query_time ()
const;
209 void add_current_time ();