MethodTimeTracker 1.2.1

MethodTimeTracker 1.2.1

TestsTested
LangLanguage Obj-CObjective C
License Custom
ReleasedLast Release Mar 2017

Maintained by ahimahas.



  • By
  • ahimahas

MethodTimeTracker is a module that can measure a time to spend in each method.

When can be used

If you felt that your application works a bit slow and you want to know where is the bottleneck in the code level, you are in right place.

Method time tracker measures for each method that how much time they spend. You can specify a single method you want to measure, or just check all methods in a class.

Sample result

Here is the result of measuring all methods in Sample project. The return value is a time in second.

sameple screenshot

Installation

Use the CocoaPods

pod 'MethodTimeTracker'

and import header file

#import <NSObject+MethodTimeTracker.h>

If you want to use MethodTimeTracker without setting CocoaPods, you can download codes in MethodTimeTracker folder directly and add it to your project.

How to use

  • Measure a single method
- (instancetype)init {
  ...

  //! with method name in String value
  [self trackingMethod:@"viewDidLoad"];

  //! or with method name in Selector
  [self trackingMethodWithSelector:@selector(viewDidLoad)];
}
  • Measure multiple methods
- (instancetype)init {
  ...

  //! with method name in String value
  [self trackingMethods:@[@"viewDidLoad", @"privateMethod:"]];

  //! or with method name in Selector
  [self trackingMethodWithSelectors:@selector(viewDidLoad), @selector(privateMethod:), nil];
}
  • Measure all methods in class
- (instancetype)init {
  ...

  //! measure all methods
  [self trackAllMethods];

  //! measure all methods and shows result log dynamically
  [self trackAllMethodsShowingLogDynamically];
}

//! at a point that you want to see logs.
//! The result will be shown sorted by desc order
...
[self displayMethodTimeLogs];
...

sameple screenshot