record method

void record(
  1. SystemLabel label,
  2. ScheduleLabel schedule,
  3. int micros
)

Records one run of label (in schedule) that took micros microseconds. Reuses the per-(system, schedule) SystemTiming record.

Implementation

void record(SystemLabel label, ScheduleLabel schedule, int micros) {
  final bySchedule = _timings[label] ??= <ScheduleLabel, SystemTiming>{};
  final timing = bySchedule[schedule] ??= SystemTiming(
    label: label,
    debugName: _shortName(label.id),
    schedule: schedule,
  );
  timing._record(micros, _frame);

  final threshold = _slowMicros;
  if (threshold != null && micros >= threshold) {
    final sink = onSlowSystem;
    if (sink != null) {
      sink(
        SlowSystemEvent(
          timing: timing,
          elapsed: Duration(microseconds: micros),
          frame: _frame,
        ),
      );
    }
  }
}