CAPL Script

In-browser analysis · No upload

CAN Message Interval Analyzer

Inspect consecutive arrival intervals for one message on one channel. Find period variation, repeated timestamps and time reversals.

1. Add timestamps

One non-negative number per line, with an optional timestamp header. Use a decimal point. First filter the same channel, ID, direction and frame type, then export timestamps in their original order.

Up to 20,000 timestamps. Data stays in this page’s memory; the tool does not send it to a server or save it to local storage.

2. Set units and comparison

Target and tolerance always use milliseconds. Leave the target empty for descriptive statistics only.

Prepare one message stream

Use this calculator when you already have a sequence of timestamps for a single stream and want to inspect its arrival spacing. Filter your trace by channel, message ID, receive/transmit direction and frame type before exporting. Two streams can use the same numeric ID; mixing them can make a stable periodic message appear to arrive twice as often. Keep the original recording order.

The first version accepts a timestamp list or single-column CSV. It does not parse ASC, BLF, payloads, CAN IDs or multi-column spreadsheets. Copy only the timestamp column after filtering. The optional first non-empty line is timestamp; quoted numeric fields, blank lines and scientific notation such as 1e-3 are accepted. Use a decimal point, without thousands separators, units or comments inside a row. An invalid non-empty row stops the calculation and shows its line number; it is never silently discarded.

timestamp
0
0.010
0.020
0.031

For this example select seconds, not milliseconds. The three intervals are 10, 10 and 11 ms. Every timestamp must be non-negative and no greater than 1,000,000,000 ms after conversion (about 11.57 days). Use elapsed time from the recording origin; convert calendar or Unix timestamps before importing. This limit reduces loss of precision from large time origins. The tool supports at most 20,000 samples and 1 MiB of text.

How the calculation works

For adjacent timestamps, the interval is Δi = ti − t(i−1). The calculator converts this difference to milliseconds. N timestamps produce N−1 differences. It never sorts the input or joins two samples across a rejected difference.

Result Definition and useful interpretation
Minimum / maximum Smallest / largest non-negative interval; inspect their rows before calling them faults.
Mean Sum of included intervals divided by their count. A short and a long interval can cancel in the mean.
Median Middle sorted interval, or the mean of the two middle values. Shows the center without claiming every interval is close to it.
P95 Nearest-rank percentile: sort M included intervals and take position ceil(0.95 × M), counting from 1. For small recordings this can equal the maximum.
Population standard deviation Square root of the average squared distance from the mean, dividing by M. Describes spread in this recording, not a confidence interval or sample estimate.
Deviation Interval minus your target period. Positive means longer than the target; negative means shorter.
Outside tolerance Absolute deviation strictly greater than the allowed deviation. Equality is inside; a small floating-point allowance absorbs numerical subtraction noise.

All target and tolerance inputs are in milliseconds, independently of the timestamp unit. A target of 10 ms and tolerance of 1 ms accepts intervals from 9 through 11 ms. Without a target, deviation and tolerance metrics are not calculated. The distribution uses ten equal-width bins, or one bin if every included interval is identical; each bin includes its lower edge and excludes its upper edge, except the last bin includes the maximum.

Negative differences are flagged as time reversals and excluded from the summary and distribution. Their endpoints remain in the original sequence, so the next adjacent pair is still checked. A zero difference is flagged as a repeated timestamp and included in statistics. It may be a duplicate row or limited timestamp resolution; it is not proof of two simultaneous physical transmissions. The table numbers non-empty numeric samples, not source-file lines. Display values are rounded to at most six decimal places; the CSV contains all pairs at JavaScript numeric precision, even when the table spans several pages.

Worked example: why the average is not enough

The demo button loads synthetic timestamps, not a vehicle test:

0, 10, 20, 31, 40, 60, 60, 70 ms

Paste these as separate lines, or use the button. Their intervals are 10, 10, 11, 9, 20, 0, 10 ms. With a 10 ms target and 1 ms tolerance, the expected result is:

  • 8 timestamps and 7 included intervals, with one repeated timestamp.
  • Mean 10 ms, median 10 ms, minimum 0 ms and maximum 20 ms.
  • P95 20 ms; population standard deviation approximately 5.371884 ms.
  • Two intervals outside tolerance: 20 ms and 0 ms. The 9 ms and 11 ms boundary values are inside.

The average looks ideal because the 20 ms and 0 ms intervals balance each other. The flagged rows and spread reveal why an average alone is an inadequate timing check.

Investigate an unexpected result

  1. Off by a factor of 1,000? Check the exported timestamp unit and the selector. The target period remains in milliseconds.
  2. Intervals near twice the target? Inspect the original trace around those rows. Possible explanations include a recording gap, filtering, changed transmission behavior or a missing observation. Interval arithmetic alone cannot distinguish them or count lost frames reliably.
  3. Repeated timestamps? Check for duplicated export rows, timestamp resolution and accidentally combined streams. Retain the zero intervals while investigating; deleting them changes the reported distribution.
  4. Time reversals? Check whether multiple recordings were concatenated, the clock reset, or export order changed. Split independent recordings before comparing them. Sorting hides this evidence.
  5. A clean result? Check that the recording covers relevant operating states and that the selected target/tolerance come from your actual requirement. This tool cannot select an engineering acceptance limit for you.

These are arrival-spacing statistics at the observation point. They do not measure end-to-end latency, prove the sender's scheduling accuracy, determine a root cause, or certify a system. Export the intervals to preserve exact row references, and inspect those locations in the original trace. Keep sensitive project data under your organization's handling rules.

Use the message timestamp walkthrough to review the recording context and setTimer reference to distinguish timer types and units. A requested timer duration and an observed message interval are different measurements.

The calculator and this explanation are maintained as site-specific learning material. The worked dataset is deliberately constructed and is not a CANoe validation report. Report a reproducible discrepancy through Contact & corrections, with a small synthetic input and expected result instead of a confidential log.

Reading a local file places its text in this page's memory. The calculator makes no data-upload request and does not put inputs in URLs, cookies or local storage. Clearing data or leaving the page removes the tool's retained input; downloaded CSV files remain on your device. Normal page and script delivery still involves hosting requests, as described in the privacy policy.