[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
-
[Xcode] 디버깅 옵션
-
[winmobile] 윈도우 모바일 간단한 테스트 코드 ㅋㅋ
-
[windows] 패스워드를 잊어먹었을때..
-
[windows] 최근 열어본 문서목록 안나오게 하는 방법
-
[windows] 종료, 재시작, 로그아웃 아이콘 만들기
-
[windows] 인터넷 익스플로러(IE) 도구모음 표시줄에 아이콘 추가
-
[windows] 윈도우즈 콘솔에서 정품인증 하는 방법
-
[windows] 윈도우 사용자 계정 로그인 암호 분실, 암호 변경하는 방법
-
[windows] 원격 데스크탑(터미널 서비스) 포트 변경
-
[windows] 여러가지 활용 팁
-
[windows] 배치(bat)파일 제작 방법
-
[windows] 도스 사용 팁