changeset 12961:8c64cc024e8c

Make hierarchical profile available via profile('info'). profile.m: Make profile('info') return also hierarchical call-tree.
author Daniel Kraft <d@domob.eu>
date Fri, 12 Aug 2011 12:27:56 +0200
parents 43d78e103984
children 55c3da8f1c9a
files scripts/general/profile.m
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/general/profile.m	Fri Aug 12 12:21:48 2011 +0200
+++ b/scripts/general/profile.m	Fri Aug 12 12:27:56 2011 +0200
@@ -48,9 +48,13 @@
 ##
 ## @item @var{T} = profile ('info')
 ## Return the collected profiling statistics in the structure @var{T}.
-## Currently, the only field is @code{FunctionTable} which is an array
-## of structures, each entry corresponding to a function which was called
-## and for which profiling statistics are present.
+## The flat profile is returned in the field @code{FunctionTable} which is an
+## array of structures, each entry corresponding to a function which was called
+## and for which profiling statistics are present.  Furthermore, the field
+## @code{Hierarchical} contains the hierarchical call-tree.  Each node
+## has an index into the @code{FunctionTable} identifying the function it
+## corresponds to as well as data fields for number of calls and time spent
+## at this level in the call-tree.
 ## @end table
 ## @end deftypefn
 
@@ -87,8 +91,8 @@
       retval = struct ('ProfilerStatus', enabled);
 
     case 'info'
-      data = __profiler_data__ ();
-      retval = struct ('FunctionTable', data);
+      [flat, tree] = __profiler_data__ ();
+      retval = struct ('FunctionTable', flat, 'Hierarchical', tree);
 
     otherwise
       warning ("profile: Unrecognized option '%s'", option);