41public record
TimingSample(String name, Instant startedAt, Instant finishedAt) {
44 if (name ==
null || name.isBlank()) {
45 throw new IllegalArgumentException(
"name is required");
47 if (startedAt ==
null || finishedAt ==
null) {
48 throw new IllegalArgumentException(
"startedAt and finishedAt are required");
57 public Duration duration() {
58 return Duration.between(startedAt, finishedAt);