Latest 1.0.2
Homepage https://github.com/GrigoryPtashko/GPTimeProfiler
License MIT
Platforms ios 8.1, requires ARC
Authors

CI Status
Version
License
Platform

GPTimeProfiler is used to track the execution time of an arbitrary piece of code. The time is tracked during one
profile cycle. One cycle is the time between two method calls -start and -stop. The object of the GPTimeProfiler
class stores the total amount of profile cycles. With every call to the -stop method the amount of profile
cycles is increased by 1. GPTimeProfiler can be used to determine the overall time of execution or the average
time of one profile cycle. It can also be used to track the amount of profile cycles.

It has the convenience methods to get the tracked time in seconds and milliseconds as NSString.

The time tracking part of the GPTimeProfiler is based on the CFAbsoluteTimeGetCurrent() function.
The GPTimeProfiler can be used in Objective-C and Swift based applications.

Usage

Use the GPTimeProfiler to profile one or more cycles:

GPTimeProfiler *p = [[GPTimeProfiler alloc] init:@"name"];
for (int i = 0; i < 100; i++) {
    [p start];
    [NSThread sleepForTimeInterval:0.01f];
    [p stop];
}

NSLog(@"%@", [p averageTimeS]);
NSLog(@"%@", [p averageTimeMs]);

And the output will be similar to:

2016-02-18 14:39:05.124 xctest[15556:688513] name s: 0.11
2016-02-18 14:39:05.126 xctest[15556:688513] name ms: 107.37

To run the example project, clone the repo, and run pod install from the Example directory first.

To add GPTimeProfiler to your Swift based project add this to the bridging header:

#import "GPTimeProfiler.h"

Installation

GPTimeProfiler is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "GPTimeProfiler"

Author

Grigory Ptashko, [email protected]

License

GPTimeProfiler is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "GPTimeProfiler",
    "version": "1.0.2",
    "summary": "A simple time profiler for Cocoa-based software (Objective-C, Objective-C++, Swift).",
    "description": "`GPTimeProfiler` is used to track the execution time of an arbitrary piece of code. The time is tracked during onenprofile cycle. One cycle is the time between two method calls `-start` and `-stop`. The object of the `GPTimeProfiler`nclass stores the total amount of profile cycles. With every call to the `-stop` method the amount of profilencycles is increased by 1. `GPTimeProfiler` can be used to determine the overall time of execution or the averagentime of one profile cycle. It can also be used to track the amount of profile cycles.nnIt has the convenience methods to get the tracked time in seconds and milliseconds as `NSString`.nnThe time tracking part of the `GPTimeProfiler` is based on the `CFAbsoluteTimeGetCurrent()` function.nThe `GPTimeProfiler` can be used in Objective-C and Swift based applications.",
    "homepage": "https://github.com/GrigoryPtashko/GPTimeProfiler",
    "license": "MIT",
    "authors": {
        "Grigory Ptashko": "[email protected]"
    },
    "source": {
        "git": "https://github.com/GrigoryPtashko/GPTimeProfiler.git",
        "tag": "1.0.2"
    },
    "social_media_url": "https://facebook.com/GrigoryPtashko",
    "platforms": {
        "ios": "8.1"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "public_header_files": "Pod/Classes/**/*.h"
}

Pin It on Pinterest

Share This