benchmark migration

pull/1/head
Michael Kirk 7 years ago
parent b281b37637
commit 2eb3ec6d0c

@ -13,7 +13,15 @@ class OWS110SortIdMigration: OWSDatabaseMigration {
override public func runUp(completion: @escaping OWSDatabaseMigrationCompletion) {
Logger.debug("")
BenchAsync(title: "Sort Migration") { completeBenchmark in
self.doMigration {
completeBenchmark()
completion()
}
}
}
private func doMigration(completion: @escaping OWSDatabaseMigrationCompletion) {
// TODO batch this?
self.dbReadWriteConnection().readWrite { transaction in

@ -4,7 +4,16 @@
import Foundation
public func BenchAsync(title: String, block: (() -> Void) -> Void) {
/// Benchmark async code by calling the passed in block parameter when the work
/// is done.
///
/// BenchAsync(title: "my benchmark") { completeBenchmark in
/// foo {
/// completeBenchmark()
/// fooCompletion()
/// }
/// }
public func BenchAsync(title: String, block: (@escaping () -> Void) -> Void) {
let startTime = CFAbsoluteTimeGetCurrent()
block {

Loading…
Cancel
Save