stopTiming static method

void stopTiming(
  1. String operation
)

Stop timing an operation and record the result

Implementation

static void stopTiming(String operation) {
  if (!ZenConfig.enablePerformanceTracking || !_stopwatch.isRunning) return;

  _stopwatch.stop();
  final duration = _stopwatch.elapsed;

  if (!_operationTimes.containsKey(operation)) {
    _operationTimes[operation] = [];
  }

  _operationTimes[operation]!.add(duration);

  // If the list gets too long, keep only the most recent entries
  if (_operationTimes[operation]!.length > 100) {
    _operationTimes[operation] = _operationTimes[operation]!
        .sublist(_operationTimes[operation]!.length - 100);
  }
}