timeSync<T> method
Time a synchronous operation.
Implementation
T timeSync<T>(String operation, T Function() fn) {
if (!_enabled) return fn();
final sw = Stopwatch()..start();
try {
final result = fn();
sw.stop();
record(operation, sw.elapsed, success: true);
return result;
} catch (e) {
sw.stop();
record(operation, sw.elapsed, success: false);
rethrow;
}
}