David Cordero

TimeBlock

Published on 28 Jun 2014

TimeBlock is a simple set of macros to measure the time spent for executing a block in Objective-C, you can find it published on my GitHub

■ TraceElapsedTimeInBlock: A simple little helper to measure the time spent for executing a block.

traceElapsedTimeInBlock (@"Log message", ^{
    // Write here the code you want to measure
});

■ TraceSlowExecutionBlock: Similar to the first one but just log if the block takes more than a indicated amount of seconds.

traceSlowExecutionBlock (@"Log message", 25, ^{
    // Write here the code you want to log if it takes more than
    // 25 seconds on runtime
});