51 acc.exit_function (fcn);
55 : time (0.0), calls (0), recursive (false),
56 parents (), children ()
66 for (function_set::const_iterator p = list.begin (); p != list.end (); ++p)
77 : parent (p), fcn_id (f), children (), time (0.0), calls (0)
82 for (child_map::iterator i = children.begin (); i != children.end (); ++i)
91 child_map::iterator pos = children.find (fcn);
92 if (pos == children.end ())
95 children[fcn] = retval;
108 assert (fcn_id == fcn);
119 stats& entry = data[fcn_id - 1];
122 entry.
calls += calls;
125 if (parent->fcn_id != 0)
127 entry.
parents.insert (parent->fcn_id);
128 data[parent->fcn_id - 1].children.insert (fcn_id);
133 if (i->fcn_id == fcn_id)
141 for (child_map::const_iterator i = children.begin ();
142 i != children.end (); ++i)
143 i->second->build_flat (data);
156 Cell rv_indices (n, 1);
157 Cell rv_times (n, 1);
158 Cell rv_totals (n, 1);
159 Cell rv_calls (n, 1);
160 Cell rv_children (n, 1);
163 for (child_map::const_iterator p = children.begin ();
164 p != children.end (); ++p)
167 double child_total = entry.
time;
176 *total += child_total;
184 retval.
assign (
"Index", rv_indices);
185 retval.
assign (
"SelfTime", rv_times);
186 retval.
assign (
"TotalTime", rv_totals);
187 retval.
assign (
"NumCalls", rv_calls);
188 retval.
assign (
"Children", rv_children);
240 fcn_index_map::iterator pos =
fcn_index.find (fcn);
248 fcn_idx = pos->second;
266 fcn_index_map::iterator pos =
fcn_index.find (fcn);
280 error (
"Can't reset active profiler.");
309 Cell rv_names (n, 1);
310 Cell rv_times (n, 1);
311 Cell rv_calls (n, 1);
312 Cell rv_recursive (n, 1);
313 Cell rv_parents (n, 1);
314 Cell rv_children (n, 1);
328 m.
assign (
"FunctionName", rv_names);
329 m.
assign (
"TotalTime", rv_times);
330 m.
assign (
"NumCalls", rv_calls);
331 m.
assign (
"IsRecursive", rv_recursive);
332 m.
assign (
"Parents", rv_parents);
333 m.
assign (
"Children", rv_children);
339 static const char *fn[] =
367 static const char *fn[] =
409 DEFUN (__profiler_enable__, args, ,
411 @deftypefn {Function File} __profiler_enable ()\n\
412 Undocumented internal function.\n\
417 const int nargin = args.
length ();
435 DEFUN (__profiler_reset__, args, ,
437 @deftypefn {Function File} __profiler_reset ()\n\
438 Undocumented internal function.\n\
442 const int nargin = args.
length ();
445 warning (
"profiler_reset: ignoring extra arguments");
453 DEFUN (__profiler_data__, args, nargout,
455 @deftypefn {Function File} __profiler_data ()\n\
456 Undocumented internal function.\n\
460 const int nargin = args.
length ();
463 warning (
"profiler_data: ignoring extra arguments");