15/36
Part 4 of 8 · Comparing samplesLearn and do

In this lesson, a call ends at the first sample that doesn't show it

Why the time 40? Look at when parse was seen:

When parse was seen, and when it could have run
parse began, somewhere here
parse ended, somewhere here
in the trace
10203040

parse is in the samples at 20 and 30, and not at 10 or 40.

The sampler saw parse at 30 and not at 40. So it ended somewhere in between, and nothing in the samples says where. The same goes for its start, somewhere after 10 and by 20.

This lesson and its practice problem use one rule: a call starts at the first sample that shows it, and ends at the first sample that doesn't. Each sample then stands for the time until the next one.

Every start after the first sample, and every end before the last, is off by less than one sampling interval. Calls already running at the first sample, or still running at the last, are cut off at that sample's time. Nothing says how long they ran outside the samples.

SAMPLES in the editor is eight samples of a short run, one every 10 ms, with the samples at 30 and 40 among them. Write call_window(samples, name): the start and end that this rule gives a call of name.