Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tapwork/WatchdogInspector
Shows your current framerate (fps) in the status bar of your iOS app
https://github.com/tapwork/WatchdogInspector
carthage cocoapods fps frame-rate frames frames-counter ios monitoring performance performance-analysis performance-monitoring performance-visualization stalling-exceptions thread thread-exceptions thread-timer uikit watchdog
Last synced: 3 months ago
JSON representation
Shows your current framerate (fps) in the status bar of your iOS app
- Host: GitHub
- URL: https://github.com/tapwork/WatchdogInspector
- Owner: tapwork
- License: mit
- Created: 2016-01-26T22:07:42.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-04-27T16:32:57.000Z (over 2 years ago)
- Last Synced: 2024-08-04T04:02:40.220Z (3 months ago)
- Topics: carthage, cocoapods, fps, frame-rate, frames, frames-counter, ios, monitoring, performance, performance-analysis, performance-monitoring, performance-visualization, stalling-exceptions, thread, thread-exceptions, thread-timer, uikit, watchdog
- Language: Objective-C
- Homepage:
- Size: 1.15 MB
- Stars: 516
- Watchers: 10
- Forks: 22
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - WatchdogInspector - Shows your current framerate (fps) in the status bar of your iOS app. (Tools / Web View)
- awesome-swift - WatchdogInspector - A logging tool to show the current framerate (fps) in the status bar of your iOS app. (Libs / Logging)
- awesome-swift - WatchdogInspector - A logging tool to show the current framerate (fps) in the status bar of your iOS app. (Libs / Logging)
- awesome-ios-star - WatchdogInspector - Shows your current framerate (fps) in the status bar of your iOS app. (Tools / Web View)
- fucking-awesome-swift - WatchdogInspector - A logging tool to show the current framerate (fps) in the status bar of your iOS app. (Libs / Logging)
- awesome-swift - WatchdogInspector - Shows your current framerate (fps) in the status bar of your iOS app ` 📝 3 years ago ` (Logging [🔝](#readme))
README
# WatchdogInspector
#### Shows your current framerate (fps) in the status bar of your iOS app
##### Be a good citizen! Don't block your main thread!
[![Build Status](https://api.travis-ci.org/tapwork/WatchdogInspector.svg?style=flat)](https://travis-ci.org/tapwork/WatchdogInspector)
[![Cocoapods Version](http://img.shields.io/cocoapods/v/WatchdogInspector.svg?style=flat)](https://github.com/tapwork/WatchdogInspector/blob/master/WatchdogInspector.podspec)
[![](http://img.shields.io/cocoapods/l/WatchdogInspector.svg?style=flat)](https://github.com/tapwork/WatchdogInspector/blob/master/LICENSE)
[![CocoaPods Platform](http://img.shields.io/cocoapods/p/WatchdogInspector.svg?style=flat)]()
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Twitter](https://img.shields.io/badge/[email protected]?style=flat)](http://twitter.com/cmenschel)WatchdogInspector counts your app's framerate and displays the fps in the status bar.
The coloured status bar lets you know when your framerate drops below 60 fps.
If everything is fine your status bar gets happy and will stay green.
To detect unwanted main thread stalls you can set a custom watchdog timeout.## Features
* Status bar displays the current framerate in fps (measured every 2 seconds)
* Colours the status bar from green (good fps) to red (bad fps)
* Custom watchdog timeout: Exception when main thread stalls for a defined time![screencast](screencast.gif)
## Install
#### CocoaPods
```ruby
pod "WatchdogInspector"
```
and run `pod install`
You can see the example project how to setup and run `WatchdogInspector`
Make sure that you **don't** use `WatchdogInspector` in production.#### Carthage
You can use [Carthage](https://github.com/Carthage/Carthage).
Specify in Cartfile:```ruby
github "tapwork/WatchdogInspector"
```## Usage
##### [Objective-C](README_objc.md) | Swift
#### Start
After launch or whenever you want.
```Swift
import WatchdogInspector
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
TWWatchdogInspector.start()
return true
}
```
#### Stop
To stop it just call
```Swift
TWWatchdogInspector.stop()
```
#### Main Thread Stalling Exceptions
You can set a custom watchdog timeout for stalling exceptions (Default: 3 seconds)
```Swift
TWWatchdogInspector.setStallingThreshhold(10.0)
```
You could also disable the Main Thread exceptions
```Swift
TWWatchdogInspector.setEnableMainthreadStallingException(false)
```
#### Logging
To log all measured framerates you can log them in the console by calling (Default: on)
```Swift
TWWatchdogInspector.setUseLogs(true)
```## How it works
There are basically two timers running to measure the framerate.1. The background thread timer fires every 2 seconds to count how many frames were set by the main thread. Ideally the result would be 120 frames in 2 seconds to get 60 fps. The background timer resets the frames counter every event. He also sends the measured fps to the status bar on the main thread.
2. The main thread timer should fire every 1/60 second (60 fps is optimum for a smooth animation) to increment the frames counter. If the main thread is blocked and can't run every 1/60 second the framerate will drop the 60 fps.
There is also a run loop observer running to detect main thread stalls for a defined timeout. If the timeout has been reached an exception will be thrown.
## Related projects
* [HeapInspector](https://github.com/tapwork/HeapInspector-for-iOS)
Find memory issues & leaks in your iOS app## Author
* [Christian Menschel](http://github.com/tapwork) ([@cmenschel](https://twitter.com/cmenschel))## License
[MIT](LICENSE)