mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			22 lines
		
	
	
		
			505 B
		
	
	
	
		
			Swift
		
	
			
		
		
	
	
			22 lines
		
	
	
		
			505 B
		
	
	
	
		
			Swift
		
	
//
 | 
						|
//  Copyright (c) 2018 Open Whisper Systems. All rights reserved.
 | 
						|
//
 | 
						|
 | 
						|
import Foundation
 | 
						|
 | 
						|
public func BenchAsync(title: String, block: (() -> Void) -> Void) {
 | 
						|
    let startTime = CFAbsoluteTimeGetCurrent()
 | 
						|
 | 
						|
    block {
 | 
						|
        let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime
 | 
						|
        Logger.debug("[Bench] title: \(title), duration: \(timeElapsed)")
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
public func Bench(title: String, block: () -> Void) {
 | 
						|
    BenchAsync(title: title) { finish in
 | 
						|
        block()
 | 
						|
        finish()
 | 
						|
    }
 | 
						|
}
 |