This is a static copy of a profile report

Home

findobjhelper (4018 calls, 1.782 sec)
Generated 05-Aug-2011 13:01:33 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/graphics/findobjhelper.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
findobjfunction4018
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
63
h = findobjinternal( varargin{...
40181.399 s78.5%
8
rootHandleVis = builtin( 'get'...
40180.109 s6.1%
13
if strcmp( varargin{2}, 'flat'...
36900.044 s2.5%
85
h = ones(0,1);
26780.033 s1.8%
65
end
40180.033 s1.8%
All other lines  0.164 s9.2%
Totals  1.782 s100% 
Children (called functions)
No children
Code Analyzer results
Line numberMessage
36{ A{:} B } can often be replaced by [ A {B}], which can be much faster.
36{ A{:} B } can often be replaced by [ A {B}], which can be much faster.
67Input argument 'h' might be unused. If this is OK, consider replacing it by ~.
Coverage results
[ Show coverage for parent directory ]
Total lines in function87
Non-code lines (comments, blank lines)36
Code lines (lines that can run)51
Code lines that did run20
Code lines that did not run31
Coverage (did run/can run)39.22 %
Function listing
   time   calls  line
1 function h = findobjhelper( varargin )
2
3 % Copyright 2009-2010 The MathWorks, Inc.
4
0.01 4018 5 allowHVHandles = true;
6
4018 7 nin = nargin;
0.11 4018 8 rootHandleVis = builtin( 'get', 0, 'ShowHiddenHandles' );
9
10 % See if 'flat' keyword is present
0.02 4018 11 hasflat = false;
0.01 4018 12 if (nin > 1)
0.04 3690 13 if strcmp( varargin{2}, 'flat' ) % Does the 'flat' keyword exist
358 14 hasflat = true;
358 15 end
3690 16 end
17
4018 18 if nin == 0
19 if feature('HgUsingMatlabClasses')
20 h = findobjinternal( 0, '-function', @findobjfilter );
21 else
22 h = findobjinternal(0);
23 end
4018 24 else
0.03 4018 25 if feature('HgUsingMatlabClasses')
26 handles = varargin{1};
27 args = varargin(2:end);
28 if ischar( varargin{1} )
29 handles = handle(0);
30 args = varargin(1:end);
31 end
32
33 if hasflat
34 pargs = {'-depth', 0};
35 sargs = args(2:end);
36 args = {pargs{:} sargs{:}};
37 end
38
39 if allowHVHandles
40 % If HandleVisibility of any handles is 'off', set it to 'on'
41 % for the duration of the findobj call
42 HV = get(handles,'HandleVisibility');
43 set(handles,'HandleVisibility','on');
44 end
45
46 h = findobjinternal( handles, args, '-function', @findobjfilter );
47
48 if allowHVHandles
49 len = length(handles);
50 % NOTE: This next block should work with a single line of code.
51 % Look at the hg2utils.HGHandle.set() method to see if cells are handled
52 % correctly.
53 if len > 1
54 for i=1:len
55 set(handles(i),'HandleVisibility',HV{i});
56 % set(handles,'HandleVisibility',HV);
57 end
58 else
59 set(handles, 'HandleVisibility', HV);
60 end
61 end
4018 62 else
1.40 4018 63 h = findobjinternal( varargin{:} );
4018 64 end
0.03 4018 65 end
66
67 function b = findobjfilter( obj, h )
68 % test for 'internal' objects
69 in = get(obj, 'Internal');
70
71 % test for handle visibility
72 hv = get(obj, 'HandleVisibility');
73 isInCallback = ~isempty(get(0, 'CallbackObject'));
74 if (strcmp(rootHandleVis, 'on' ) || ...
75 (strcmp(hv, 'callback') && isInCallback))
76 hv = 'on';
77 end
78
79 b = strcmp( hv, 'on' ) && ~in;
80 end
81
82 % The MCOS findobj method return an empty array of type of handle class
83 % The following handling of empty conforms to existing hg expectations.
0.02 4018 84 if isempty(h)
0.03 2678 85 h = ones(0,1);
2678 86 end
0.02 4018 87 end