// A page's open timeline, as log lines (subsystem `com.cottondb.page`,// category `open`; lane threadload, 16 Oct 2026), the way `SwitchClock` logs// a database switch: the moment a screen is pushed — the tap, or a link// arriving — and then, once each, the milliseconds since then at which its// record is drawn (`record`), its conversation's messages are drawn// (`messages`) and everything the page draws has been read (`settled`).// `scripts/perf/pages.py times` reads them off a run.import OSLog@MainActorenumPageClock {privatestaticvar asked: (route: String, at: ContinuousClock.Instant)?privatestaticvar marked: Set<String> = []privatestaticlet log = Logger(subsystem: "com.cottondb.page", category: "open")/// A screen was asked for: its open starts now.staticfunc asked(_ route: String) { asked = (route, .now) marked = [] log.notice("open: \(route, privacy: .public) asked") }/// `what` happened for the open under way, once: logged with the/// milliseconds since the screen was asked for.staticfunc mark(_ what: String) {guardlet asked, !marked.contains(what) else { return } marked.insert(what)let elapsed = ContinuousClock.now - asked.atlet ms = Int((Double(elapsed.components.seconds) * 1000 + Double(elapsed.components.attoseconds) / 1e15).rounded()) log.notice("open: \(asked.route, privacy: .public) \(what, privacy: .public) \(ms) ms") }/// The same, on the frame after this one: what was just set is drawn.staticfunc markDrawn(_ what: String) {DispatchQueue.main.async { mark(what) } }}