This is a static copy of a profile report

Home

graphics.linkprop.linkprop>localUpdateListeners (4 calls, 0.066 sec)
Generated 05-Aug-2011 13:02:39 using cpu time.
subfunction in file /usr/local/MATLAB/R2011a/toolbox/matlab/graphics/@graphics/@linkprop/linkprop.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
graphics.linkprop.linkpropfunction1
graphics.linkprop.removetargetfunction3
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
147
set(hlist(ind),prop,val);
10.044 s66.7%
151
end
10.011 s16.7%
87
hDeleteListener(m) = eventList...
60.011 s16.7%
150
end % for
10 s0%
148
end
10 s0%
All other lines  0 s0%
Totals  0.066 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
...vd)(localUpdate(obj,evd,hLink,hlist))anonymous function30.044 s66.7%
ispropfunction10 s0%
...linkprop.linkprop>localSetEnableStatesubfunction60 s0%
...vd)(localUpdate(obj,evd,hLink,hlist))anonymous function60 s0%
...RemoveHandle(obj,evd,hlist(m),hLink))anonymous function60 s0%
Self time (built-ins, overhead, etc.)  0.022 s33.3%
Totals  0.066 s100% 
Code Analyzer results
Line numberMessage
87The variable 'hDeleteListener' appears to change size on every loop iteration. Consider preallocating for speed.
101The variable 'hProp' appears to change size on every loop iteration. Consider preallocating for speed.
109The variable 'hListener' appears to change size on every loop iteration. Consider preallocating for speed.
Coverage results
[ Show coverage for parent directory ]
Total lines in function96
Non-code lines (comments, blank lines)38
Code lines (lines that can run)58
Code lines that did run51
Code lines that did not run7
Coverage (did run/can run)87.93 %
Function listing
   time   calls  line
56 function localUpdateListeners(hLink, synchronizeprops)
57
4 58 if nargin == 1
1 59 synchronizeprops = true;
1 60 end
61
62 % dereference old listeners
4 63 set(hLink,'Listeners',[]);
64
65 % Get properties and handles
4 66 propnames = get(hLink,'PropertyNames');
4 67 hlist = get(hLink,'Targets');
4 68 foundlistener = false;
4 69 count = 0;
70
71 % Cycle through list of objects
72 % Create listeners for each input object
4 73 for m = 1:length(hlist)
6 74 if isobject(hlist(m))
75 eventListenerConstructor = @event.listener;
76 propListenerConstructor = @event.proplistener;
77 propEvent = 'PostSet';
6 78 else
6 79 eventListenerConstructor = @handle.listener;
6 80 propListenerConstructor = @handle.listener;
6 81 propEvent = 'PropertyPostSet';
6 82 end
83
6 84 if (~isobject(hlist(m)) && ishandle(hlist(m))) || (isobject(hlist(m)) && isvalid(hlist(m)))
85
86 % Listen to deletion
0.01 6 87 hDeleteListener(m) = eventListenerConstructor(hlist(m), ...
88 'ObjectBeingDestroyed',...
89 @(obj,evd)(localRemoveHandle(obj,evd,hlist(m),hLink)));
90
91 % Count the number of property objects
6 92 count = 1;
93
94 % Get list of property objects for listening
6 95 foundprop = false;
6 96 for n = 1:length(propnames)
6 97 prop = findprop(hlist(m),propnames{n});
6 98 if isempty(prop)
99 warning('MATLAB:graphics:linkprop','Invalid property');
6 100 else
6 101 hProp(count) = prop;
6 102 count = count + 1;
6 103 foundprop = true;
6 104 end
6 105 end % for
106
6 107 if foundprop
108 % Create one handle listener per object
6 109 hListener(m) = propListenerConstructor(hlist(m),...
110 hProp, ...
111 propEvent,...
112 @(obj,evd)(localUpdate(obj,evd,hLink,hlist)));
6 113 localSetEnableState(hListener(m),get(hLink,'Enabled'));
6 114 foundlistener = true;
6 115 end
116
6 117 end % if
6 118 end % for
119
120 % If we have delete listeners
4 121 if count > 0
3 122 set(hLink,'TargetDeletionListeners',hDeleteListener);
3 123 end
124
125 % Bail out early if we have no listeners
4 126 if ~foundlistener,
1 127 return;
128 end
129
3 130 set(hLink,'Listeners',hListener);
131
3 132 if synchronizeprops
133 % Update all objects so they have the same properties
134 % as the first object in the list. This is an arbitrary
135 % convention documented in LINKPROP m-help
136
137 % Loop through properties
1 138 for n = 1:length(propnames)
1 139 prop = propnames{n};
140
141 % Get handles that have this property
1 142 ind = find(isprop(hlist,prop));
1 143 if length(ind) > 1
144
145 % Set handles that have this property
1 146 val = get(hlist(ind(1)),prop);
0.04 1 147 set(hlist(ind),prop,val);
1 148 end
149
1 150 end % for
0.01 1 151 end

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