#if COTTON_DEV// DevReads.swift — DEVELOPER TOOL, compiled into Cotton Dev only.//// Every call this process made into the core, with when it started and how// long it took, so the timings overlay (`CottonUI/Developer/DevTimings.swift`)// can say which reads a surface made before its first row. Noted from the one// door every call goes through (`CottonCore.call`), so nothing is missed and// no caller writes anything.importFoundationpublicenumDevReads {/// One finished call.publicstructCall: Sendable, Equatable {publiclet method: Stringpubliclet started: ContinuousClock.Instantpubliclet millis: Double }/// Enough for any one surface; the oldest go first.staticlet capacity = 500privatefinalclassBox: @unchecked Sendable {let lock = NSLock()var calls: [Call] = [] }privatestaticlet box = Box()staticfunc note(_ method: String, started: ContinuousClock.Instant) {let elapsed = ContinuousClock.now - startedlet millis = Double(elapsed.components.seconds) * 1000 + Double(elapsed.components.attoseconds) / 1e15 box.lock.lock()defer { box.lock.unlock() } box.calls.append(Call(method: method, started: started, millis: millis))if box.calls.count > capacity { box.calls.removeFirst(box.calls.count - capacity) } }/// The calls that started at or after `instant`, oldest first.publicstaticfunc since(_ instant: ContinuousClock.Instant) -> [Call] { box.lock.lock()defer { box.lock.unlock() }return box.calls.filter { $0.started >= instant } }}#endif