[swift] 실행시간 측정하기
start, end 구해서 end-start
func evaluateProblem(problemNumber: Int, problemBlock: () -> Int) -> Answer
{
print("Evaluating problem \(problemNumber)")
let start = DispatchTime.now() // <<<<< Start time
let myGuess = problemBlock()
let end = DispatchTime.now() // <<<<< End time
let theAnswer = self.checkAnswer(answerNum: "\(problemNumber)", guess: myGuess)
let nanoTime = end.uptimeNanoseconds - start.uptimeNanoseconds // <<<<< Difference in nano seconds (UInt64)
let timeInterval = Double(nanoTime) / 1_000_000_000 // Technically could overflow for long running test
print("Time to evaluate problem \(problemNumber): \(timeInterval) seconds")
return theAnswer
}
출처: https://stackoverflow.com/questions/24755558/measure-elapsed-time-in-swift
-
[swift] 실행시간 측정하기
-
[swift] UIView에서 subview 찾기
-
[swift] popToRoot 모달뷰, 네비게이션컨트롤러 한꺼번에 닫기
-
[swift] NotificationCenter 간단 예제
-
[spring] 스프링 IoC/DI
-
[sh] 쉘스크립트 if 비교 연산
-
[sh] html 안에 있는 img 다운 받는 쉘 스크립트
-
[python][django] request.cookie 읽어오기 ㅋㅋㅋ (쓰기)
-
[python] 파이썬 공부하는 사이트~
-
[python] 파라미터 앞에 *, ** 의 의미? (*args, **kwargs)
-
[python] 애니팡, 캔디팡 매크로
-
[python] DJI Tello 드론 코딩 (프로그래밍)