24 #if defined (HAVE_CONFIG_H) 40 : m_time (0.0), m_calls (0), m_recursive (
false),
41 m_parents (), m_children ()
51 for (
const auto&
nm :
list)
60 : m_parent (
p), m_fcn_id (
f), m_children (), m_time (0.0), m_calls (0)
65 for (
auto& idx_tnode : m_children)
66 delete idx_tnode.second;
74 child_map::iterator pos = m_children.find (
fcn);
75 if (pos == m_children.end ())
104 stats& entry = data[m_fcn_id - 1];
110 if (m_parent->m_fcn_id != 0)
112 entry.
m_parents.insert (m_parent->m_fcn_id);
113 data[m_parent->m_fcn_id - 1].m_children.insert (m_fcn_id);
118 if (
i->m_fcn_id == m_fcn_id)
126 for (
const auto& idx_tnode : m_children)
127 idx_tnode.second->build_flat (data);
140 Cell rv_indices (n, 1);
141 Cell rv_times (n, 1);
142 Cell rv_totals (n, 1);
143 Cell rv_calls (n, 1);
144 Cell rv_children (n, 1);
147 for (
const auto& idx_tnode : m_children)
149 const tree_node& entry = *idx_tnode.second;
150 double child_total = entry.
m_time;
159 *total += child_total;
215 fcn_idx = pos->second;
258 error (
"Can't reset active profiler.");
286 Cell rv_names (n, 1);
287 Cell rv_times (n, 1);
288 Cell rv_calls (n, 1);
289 Cell rv_recursive (n, 1);
290 Cell rv_parents (n, 1);
291 Cell rv_children (n, 1);
305 m.
assign (
"FunctionName", rv_names);
306 m.
assign (
"TotalTime", rv_times);
307 m.
assign (
"NumCalls", rv_calls);
308 m.
assign (
"IsRecursive", rv_recursive);
309 m.
assign (
"Parents", rv_parents);
310 m.
assign (
"Children", rv_children);
316 static const char *fn[] =
344 static const char *fn[] =
386 DEFMETHOD (__profiler_enable__, interp, args, ,
392 int nargin = args.length ();
406 DEFMETHOD (__profiler_reset__, interp, args, ,
412 if (args.length () != 0)
429 if (args.length () != 0)
void exit_function(const std::string &)
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
std::vector< stats > flat_profile
The value of lines which begin with a space character are not saved in the history list A value of all commands are saved on the history list
void assign(const std::string &k, const Cell &val)
OCTINTERP_API void print_usage(void)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
tree_node * enter(octave_idx_type)
void error(const char *fmt,...)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
octave_value & assign(assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
tree_node(tree_node *, octave_idx_type)
double double_value(void) const
function_set m_known_functions
octave_value get_hierarchical(void) const
void build_flat(flat_profile &) const
static octave_value function_set_value(const function_set &)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
void add_current_time(void)
octave_value get_flat(void) const
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
fcn_index_map m_fcn_index
double query_time(void) const
void enter_function(const std::string &)
tree_node * exit(octave_idx_type)
std::set< octave_idx_type > function_set
octave_value get_hierarchical(double *total=nullptr) const
Vector representing the dimensions (size) of an Array.
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
nd group nd example For each display the value