Skip to content

tmspzz/stopwatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stopwatch

Carthage compatible

A quick time profiling utility framework.

What is stopwatch

Sometimes you just want to have an idea of how long some code takes to execute, without firing up Instruments and using the time profiler.

Stopwatch does just that. Read more about the motivations behinde it at http://allocinit.io/ios/timing-function-execution-stopwatch/.

Usage

  • Create a StopWatch
  • Start an event
  • call function
  • Stop event
  • Log execution time (in milliseconds)

Example:

let stopWatch = StopWatch(name:"SleepingBeauty")

stopWatch.startEvent("Sleeping")
                        
for i in 0...10000 {
    usleep(10)
}

let event = stopWatch.stopEvent("Sleeping")
println(event?.elapsedTime)

About

A quick time profiling utility framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published