I am seeking advice about supported macOS performance tracing, NOT reporting a confirmed APFS bug. This is a real application failure. AI assisted with organizing this report, and the measurements were reviewed against existing records.
Environment
- Apple Silicon Mac Studio, 32 GB RAM, macOS 15.7.9 (24G830).
- CPython 3.11.15, linked SQLite 3.50.4.
- SQLite database: 3,224,576,000 bytes on an internal APFS volume, journal_mode=DELETE.
- The application runs PRAGMA quick_check before starting worker processes. A progress handler cancels the operation after 30 seconds, producing SQLITE_INTERRUPT. This is application-triggered, not proof of corruption.
Observed results
- Original database: 30.008 s wall / 5.220 s CPU; a separate run took 30.192 s wall / 5.420 s CPU. Both were interrupted.
- A two-second sample showed 95/96 samples on SQLite's checkTreePage → readDbPage → unixRead → pread path. Individual pread latency was not measured.
- A transaction-consistent SQLite Backup API snapshot on a different APFS volume completed quick_check in 2.412 s and integrity_check in 8.797 s, both returning "ok".
- The snapshot and original were checked at different times with uncontrolled cache and system-load conditions.
Additional mmap experiment
On the same offline snapshot:
- A: mmap_size=0, executed first, quick_check took 31.070 s and was interrupted.
- B: reported mmap limit approximately 2 GiB, executed second, quick_check returned "ok" after 22.146 s.
Cache conditions and host load were not equivalent, so these observations do NOT establish an mmap performance improvement.
A separate deliberate mapped-I/O error test ended with SIGBUS in an isolated child process. This does not establish an ordinary APFS defect.
Questions
-
Which supported macOS Instruments templates or APIs can correlate pread offsets, sizes and timings with physical disk latency, filesystem cache activity, memory pressure and thread scheduling, without disabling system security protections?
-
What minimum set of simultaneous observations could distinguish cache misses, APFS metadata/layout overhead, physical device delays and CPU scheduling contention? How should process read-byte counts be interpreted against physical disk I/O?
-
How should I safely compare read-only SQLite mmap against normal pread access on disposable copies, without mistaking a warmer second run for a performance gain? What SIGBUS containment and recovery checks would be appropriate?
I am primarily looking for a reliable instrumentation plan and interpretation criteria before conducting further tests. I do not want to modify the original database, weaken integrity checks or bypass security controls.