This is a static copy of a profile reportHome
timer.timer (33 calls, 0.125 sec)
Generated 15-Mar-2007 12:01:48 using real time.
M-function in file C:\Program Files\MATLAB71\toolbox\matlab\iofun\@timer\timer.m
[Copy to new window for comparing multiple runs]
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
67 | obj.jobject.setName(['timer-' ... | 2 | 0.047 s | 37.4% |  |
65 | obj.jobject = handle(com.mathw... | 2 | 0.047 s | 37.4% |  |
77 | set(obj, varargin{:}); | 2 | 0.031 s | 24.9% |  |
33 | obj.ud = {}; % this is in supp... | 33 | 0.000 s | 0.2% |  |
85 | end | 2 | 0 s | 0% |  |
Other lines & overhead | | | 0 s | 0% |  |
Totals | | | 0.125 s | 100% | |
Children (called functions)
M-Lint results
Line number | Message |
47 | FOR may not be aligned with its matching END (line 60). |
Coverage results
[ Show coverage for parent directory ]
Total lines in file | 85 |
Non-code lines (comments, blank lines) | 40 |
Code lines (lines that can run) | 45 |
Code lines that did run | 22 |
Code lines that did not run | 23 |
Coverage (did run/can run) | 48.89 % |
Function listing
time calls line
1
2 function obj = timer(varargin)
3 %TIMER Construct timer object.
4 %
5 % T = TIMER constructs a timer object with default attributes.
6 %
7 % T = TIMER('PropertyName1',PropertyValue1, 'PropertyName2', PropertyValue2,...)
8 % constructs a timer object in which the given Property name/value pairs are
9 % set on the object.
10 %
11 % Note that the property value pairs can be in any format supported by
12 % the SET function, i.e., param-value string pairs, structures, and
13 % param-value cell array pairs.
14 %
15 % Example:
16 % % To construct a timer object with a timer callback mycallback and a 10s interval:
17 % t = timer('TimerFcn',@mycallback, 'Period', 10.0);
18 %
19 %
20 % See also TIMER/SET, TIMER/TIMERFIND, TIMER/START, TIMER/STARTAT.
21
22 % RDD 10/23/01
23 % Copyright 2001-2004 The MathWorks, Inc.
24 % $Revision: 1.3.4.4 $ $Date: 2005/06/21 19:34:58 $
25
26 % Create the default class.
27
28 % check for JVM
33 29 if ~isempty(javachk('jvm'))
30 error('MATLAB:timer:nojvm',timererror('MATLAB:timer:nojvm'));
31 end
32
< 0.01 33 33 obj.ud = {}; % this is in support of loadobj/saveobj
34
33 35 if (nargin>0) && all(ishandle(varargin{1})) && all(isJavaTimer(varargin{1})) % java handle given, just wrap in OOPS
36 % this flavor of the constructor is not intended to be for the end-user
31 37 if sum(gt(size(varargin{1}),1)) > 1 % not a vector, sorry.
38 error('MATLAB:timer:creatematrix',timererror('matlab:timer:creatematrix'));
39 end
31 40 obj.jobject = varargin{1}; % make a MATLAB timer object from a java timer object
31 41 obj = class(obj,'timer');
2 42 elseif nargin>0 && isa(varargin{1},'timer') % duplicate a timer object
43 % e.g., q = timer(t), where t is a timer array.
44 orig = varargin{1};
45 len = length(orig);
46 % foreach valid object in the original timer object array...
47 for lcv=1:len
48 if isJavaTimer(orig.jobject(lcv))
49 % for valid java timers found, make new java timer object,...
50 obj.jobject(lcv) = handle(com.mathworks.timer.TimerTask);
51 obj.jobject.MakeDeleteFcn(@deleteAsync);
52 % duplicate copy of settable properties from the old object to the new object,and ...
53 propnames = fieldnames(set(orig.jobject(lcv)));
54 propvals = get(orig.jobject(lcv),propnames);
55 set(obj.jobject(lcv),propnames,propvals);
56 mltimerpackage('Add', obj.jobject(lcv));
57 else
58 obj.jobject(lcv) = orig.jobject(lcv);
59 end
60 end
61 obj = class(obj,'timer'); % create the OOPS class
2 62 else
63 % e.g., t=timer or t=timer('pn',pv,...)
64 % create new java object
0.05 2 65 obj.jobject = handle(com.mathworks.timer.TimerTask);
66 % set a default name to a unique identifier, i.e., an object 'serial number'
0.05 2 67 obj.jobject.setName(['timer-' num2str(mltimerpackage('Count'))]);
2 68 obj.jobject.timerFcn = '';
2 69 obj.jobject.errorFcn = '';
2 70 obj.jobject.stopFcn = '';
2 71 obj.jobject.startFcn = '';
2 72 obj.jobject.MakeDeleteFcn(@deleteAsync);
2 73 obj = class(obj,'timer');
2 74 if (nargin>0)
75 % user gave PV pairs, so process them by calling set.
2 76 try
0.03 2 77 set(obj, varargin{:});
78 catch
79 lerr = fixlasterr;
80 error(lerr{:});
81 end
2 82 end
83 % register the new object so timerfind can find it later,
2 84 mltimerpackage('Add', obj.jobject);
2 85 end