Skip to content

HuolalaTech/hll-wp-guldan-ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

license Pod Version Platform Language


Introduce

guldan is an open source time-consuming analysis tool for iOS Objective-C method. It can facilitate development/testing students to quickly obtain the cost time of all OC methods within a certain period of time when the APP is running, and supports visualization. see more: juejin paper

Compare

scheme compare advantage shortcomint
static instrumentation The entry edge and exit edge of the function can be overwritten, and the entire execution process of the function can be covered Negative impact on package volume; cannot be applied to closed source libraries; high access cost
Messier Analysis product visualization, with time series Relying on third-party maintenance, some iOS systems cannot be applied
Xcode Instruments Powerful functions and support for sub-thread analysis High cost of use; unsustainable analysis results; does not support timing
our scheme Low invasiveness, high performance, low cost of use, visualization Does not support simulators, only for OC methods time-consuming

Features

  • Low intrusion: Hook objc_megSend is used to collect time-consuming data without intrusion to business target code;
  • High performance: The core code is implemented in assembly language, and the performance is guaranteed;
  • Visualization: Supports visualization of analysis results on desktop and mobile;
  • Support sub-threads: In addition to the method time-consuming analysis of the main thread, it also supports the method time-consuming analysis of sub-threads;

Dependency

  • Real device and some simulators

Usage

(1) Install via CocoaPods command

pod 'Guldan'

(2) import header file

#import <Guldan/GDNOCMethodTimeProfiler.h>

(3)start analysis

[GDNOCMethodTimeProfiler start];

(4)stop analysis

[GDNOCMethodTimeProfiler stop];

(5)output result path

[GDNOCMethodTimeProfiler handleRecordsWithComplete:^(NSArray<NSString *> * _Nonnull filePaths) {
    // file path
}];

(6)output file path It can be opened quickly with the help of some sandbox tools. The sandbox directory can also be downloaded using Xcode. Here is only how to use Xcode to find the result file in the sandbox. Xcode window/Devices and Simulators/select target APP/Click the gear icon and select「Download Container」

Right-click the file downloaded in the previous step, select "Show Package Contents" and find the oc_method_cost_mainthread file

(7)Desktop visualization with Chrome Enter chrome://tracing/ in the chrome browser and drag in the oc_method_cost_mainthread file。

Author

   HUOLALA mobile technology team

License

  Guldan is released under the Apache 2.0 license. See LICENSE for details.