A debugging tool for investigating code execution coordination, sequencing, and timing.
TimeIt is a lightweight debugging utility that helps you track timing information and execution order in your Swift code. It provides a simple API to log events with automatic timestamps and compute time intervals between operations.
import TimeIt // Log events with timestamps TimeIt.log("myOperation", entry: "Started processing") // ... do some work ... TimeIt.log("myOperation", entry: "Finished step 1") // ... do more work ... TimeIt.log("myOperation", entry: "Completed") // Retrieve formatted logs with timing information TimeIt.complete(log: "myOperation") { logs in logs.forEach { print($0) } // Output: [myOperation] 14:23:45.1234 0.0000secs Started processing // [myOperation] 14:23:45.2234 0.1000secs Finished step 1 // [myOperation] 14:23:45.3234 0.2000secs Completed }Full API documentation is available online at https://mikelrob.github.io/TimeIt/documentation/timeit/.
You can also generate and view the documentation locally:
swift package generate-documentationOr explore the inline documentation in Xcode by Option-clicking on any TimeIt method.
Add TimeIt as a dependency in your Package.swift:
dependencies: [ .package(url: "https://github.com/mikelrob/TimeIt.git", from: "1.0.0") ]- Simple API: Just two static methods to log events and retrieve results
- Thread-Safe: All operations use a serial dispatch queue for thread safety
- Time Tracking: Automatically captures timestamps and computes intervals
- Organized Logs: Group related events using named logs