This is a static copy of a profile report

Home

profile (1 call, 0.000 sec)
Generated 15-Mar-2007 12:02:10 using real time.
M-function in file C:\Program Files\MATLAB71\toolbox\matlab\codetools\profile.m
[Copy to new window for comparing multiple runs]

Parents (calling functions)

Function NameFunction TypeCalls
profsaveM-function1
Lines where the most time was spent
No measurable time spent in this function

Line NumberCodeCallsTotal Time% TimeTime Plot
123
callstats('stop');
10 s0%
122
initialState = callstats('stat...
10 s0%
Other lines & overhead  0 s0%
Totals  0.000 s0% 
Children (called functions)
No children
M-Lint results
No M-Lint messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in file227
Non-code lines (comments, blank lines)148
Code lines (lines that can run)79
Code lines that did run2
Code lines that did not run77
Coverage (did run/can run)2.53 %
Function listing
   time   calls  line
1 function s = profile(varargin)
2 %PROFILE Profile function execution time.
3 % PROFILE ON starts the profiler and clears previously recorded
4 % profile statistics.
5 %
6 % PROFILE takes the following options:
7 %
8 % -DETAIL LEVEL
9 % This option specifies the set of functions for which
10 % profiling statistics are gathered. If LEVEL is 'mmex'
11 % (the default), then information about M-functions,
12 % M-subfunctions, and MEX-functions is recorded. If
13 % LEVEL is 'builtin', then in addition the profiler
14 % records information about builtin functions such as
15 % EIG.
16 %
17 % -TIMER CLOCK
18 % This option specifies the type of time to be used in profiling.
19 % If CLOCK is 'cpu' (the default), then compute time is measured.
20 % If CLOCK is 'real', then wall-clock time is measured. For
21 % example, the function PAUSE will have very small cpu time, but
22 % real time that accounts for the actual time paused.
23 %
24 % -HISTORY
25 % If this option is specified, MATLAB records the exact
26 % sequence of function calls so that a function call
27 % history report can be generated. NOTE: MATLAB will
28 % not record more than 10000 function entry and exit
29 % events. However, MATLAB will continue recording
30 % other profiling statistics after this limit has been
31 % reached.
32 %
33 % Options may appear either before or after ON in the same command,
34 % but they may not be changed if the profiler has been started in a
35 % previous command and has not yet been stopped.
36 %
37 % PROFILE OFF stops the profiler.
38 %
39 % PROFILE VIEWER stops the profiler and opens the graphical profile browser.
40 % The output for PROFILE VIEWER is an HTML file in the Profiler window.
41 % The file listing at the bottom of the function profile page shows four
42 % columns to the left of each line of code.
43 % Column 1 (red) is total time spent on the line in seconds.
44 % Column 2 (blue) is number of calls to that line.
45 % Column 3 is the line number
46 %
47 % PROFILE RESUME restarts the profiler without clearing
48 % previously recorded function statistics.
49 %
50 % PROFILE CLEAR clears all recorded profile statistics.
51 %
52 % S = PROFILE('STATUS') returns a structure containing
53 % information about the current profiler state. S contains
54 % these fields:
55 %
56 % ProfilerStatus -- 'on' or 'off'
57 % DetailLevel -- 'mmex' or 'builtin'
58 % Timer -- 'cpu' or 'real'
59 % HistoryTracking -- 'on' or 'off'
60 %
61 % STATS = PROFILE('INFO') suspends the profiler and returns
62 % a structure containing the current profiler statistics.
63 % STATS contains these fields:
64 %
65 % FunctionTable -- structure array containing stats
66 % about each called function
67 % FunctionHistory -- function call history table
68 % ClockPrecision -- precision of profiler time
69 % measurement
70 % ClockSpeed -- Estimated clock speed of the cpu (or 0)
71 % Name -- name of the profiler (i.e. MATLAB)
72 %
73 % The FunctionTable array is the most important part of the STATS
74 % structure. Its fields are:
75 %
76 % FunctionName -- function name, includes subfunction references
77 % FileName -- file name is a fully qualified path
78 % Type -- M-function, MEX-function
79 % NumCalls -- number of times this function was called
80 % TotalTime -- total time spent in this function
81 % Children -- FunctionTable indices to child functions
82 % Parents -- FunctionTable indices to parent functions
83 % ExecutedLines -- array detailing line-by-line details (see below)
84 % IsRecursive -- is this function recursive? boolean value
85 %
86 % The ExecutedLines array has several columns. Column 1 is the line
87 % number that executed. If a line was not executed, it does not appear in
88 % this matrix. Column 2 is the number of times that line was executed,
89 % and Column 3 is the total spent on that line. Note: The sum of Column 3 does
90 % not necessarily add up to the function's TotalTime.
91 %
92 % If you want to save the results of your profiler session to disk, use
93 % the PROFSAVE command.
94 %
95 % Examples:
96 %
97 % profile on
98 % plot(magic(35))
99 % profile viewer
100 % profsave(profile('info'),'profile_results')
101 %
102 % profile on -history
103 % plot(magic(4));
104 % p = profile('info');
105 % for n = 1:size(p.FunctionHistory,2)
106 % if p.FunctionHistory(1,n)==0
107 % str = 'entering function: ';
108 % else
109 % str = ' exiting function: ';
110 % end
111 % disp([str p.FunctionTable(p.FunctionHistory(2,n)).FunctionName]);
112 % end
113 %
114 % See also PROFSAVE, PROFVIEW.
115
116 % Copyright 1984-2004 The MathWorks, Inc.
117 % $Revision: 1.1.6.13 $ $Date: 2005/06/21 19:23:38 $
118
119 % This code exists to inhibit profiling of functions called by
120 % profile.m, except, of course, callstats.m, which is suppressed
121 % from the view (see profview.m).
1 122 initialState = callstats('status');
1 123 callstats('stop');
124 enableAtEnd = strcmp(initialState, 'on');
125
126 [action, detailLevel, timerIndex, history, msg] ...
127 = ParseInputs(initialState, varargin{:});
128
129 if (~isempty(msg))
130 error('MATLAB:profiler:InputParseProblem',msg);
131 end
132
133 if detailLevel > 0
134 callstats('level', detailLevel);
135 end
136
137 if timerIndex > 0
138 callstats('timer', timerIndex);
139 end
140
141 if history
142 callstats('history', history);
143 end
144
145 switch action
146 case 'on'
147 callstats('clear');
148 notifyUI('start');
149 callstats('start');
150
151 case 'off'
152 notifyUI('stop');
153 enableAtEnd = false;
154
155 case 'resume'
156 notifyUI('start');
157 enableAtEnd = true;
158
159 case 'clear'
160 callstats('clear');
161 notifyUI('clear');
162
163 case 'report'
164 profreport
165
166 case 'viewer'
167 if ~usejava('mwt')
168 error('The profiler requires the Java VM');
169 else
170 enableAtEnd = false;
171
172 stats = profile('info');
173 if isempty(stats.FunctionTable)
174 com.mathworks.mde.profiler.Profiler.invoke;
175 else
176 notifyUI('stop');
177 profview(0,stats);
178 end
179 end
180
181 case 'status'
182 s.ProfilerStatus = initialState;
183 switch callstats('level')
184 case 1
185 s.DetailLevel = 'mmex';
186
187 case 2
188 s.DetailLevel = 'builtin';
189 end
190 switch callstats('timer')
191 case 1
192 s.Timer = 'cpu';
193
194 case 2
195 s.Timer = 'real';
196 end
197 if (callstats('history'))
198 s.HistoryTracking = 'on';
199 else
200 s.HistoryTracking = 'off';
201 end
202
203 case 'info'
204 [ft,fh,cp,name,cs] = callstats('stats');
205 s.FunctionTable = ft;
206 s.FunctionHistory = fh;
207 s.ClockPrecision = cp;
208 s.ClockSpeed = cs;
209 s.Name = name;
210
211 case 'none'
212 % Nothing to do
213
214 otherwise
215 warning('MATLAB:profile:ObsoleteSyntax', ...
216 'Unknown argument for PROFILE. See HELP PROFILE.');
217 end
218
219 if (enableAtEnd)
220 callstats('resume');
221 end
222 end
223
224 %%%
225 %%% ParseInputs
226 %%%
227 function [action, level, clock, history, msg] ...

Other subfunctions in this file are not included in this listing.