ANREye
Class for monitor excessive blocking on the main thread
Family
This library is derived from the GodEye project which can automaticly display Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code. Just like god opened his eyes
Book & Principle
I has wrote a book named 《iOS监控编程》,each chapter records the course function of the implementation details and the way to explore.sorry for english friends,this book wrote by chineses.
Installation
CocoaPods
ANREye is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ANREye"
Carthage
Or, if you’re using Carthage, add SwViewCapture to your Cartfile:
github "zixun/ANREye"
Usage
open and add delegate
self.anrEye = ANREye()
self.anrEye.delegate = self
self.anrEye.start(with: 1)
implement the delegate
extension ViewController: ANREyeDelegate {
func anrEye(anrEye:ANREye,
catchWithThreshold threshold:Double,
mainThreadBacktrace:String?,
allThreadBacktrace:String?) {
print("------------------")
print(mainThreadBacktrace!)
print("------------------")
print(allThreadBacktrace!)
}
}
test code
var s = ""
for _ in 0..<9999 {
for _ in 0..<9999 {
s.append("1")
}
}
print("invoke")
Author
name: 陈奕龙
twitter: @zixun_
email: [email protected]
github: zixun
blog: 子循(SubCycle)
License
ANREye is available under the MIT license. See the LICENSE file for more info.