Statistics of past execution periods
Here is a sample execution graphic using the default setting,
'slip', for the
OverrunAction property in the
Rate object. See
OverrunAction for more information on overrun code execution.
The output of
stats = Periods: [0.7 0.11 0.7 0.11] NumPeriods: 4 AveragePeriod: 0.09 StandardDeviation: 0.0231 NumOverruns: 2
stats— Time execution statistics
Time execution statistics, returned as a structure. This structure contains the following fields:
Period — All time periods (returned
in seconds) used to calculate statistics as an indexed array.
stats.Period(end) is the most recent
NumPeriods — Number of elements in
AveragePeriod — Average time in
StandardDeviation — Standard
deviation of all periods in seconds, centered around the mean
NumOverruns — Number of periods with
rateControl object for running at 20 Hz.
r = rateControl(20);
Start a loop and control operation using the
for i = 1:30 % Your code goes here waitfor(r); end
Rate object statistics after loop operation.
stats = statistics(r)
stats = struct with fields: Periods: [0.0563 0.0486 0.0487 0.0491 0.0532 0.0443 0.0500 ... ] NumPeriods: 30 AveragePeriod: 0.0500 StandardDeviation: 0.0022 NumOverruns: 0