asks) {
    if (windowSize <= 0) {
      throw Error('The window size must be positive number');
    }
    if (startTime + windowSize > endTime) {
      throw Error('The sliding window must fit in the specified time range');
    }

    const sortedTasks = tasks.slice().sort((a, b) => a.start - b.start);

    for (let i = 1; i < sortedTasks.length; i++) {
      // Ensure that the previous task finishes not later than the current task.
      // This can happen with short trace events late in the timeline, whe