Shows your current framerate (fps) in the status bar of your iOS app

Overview

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 Cocoapods Version CocoaPods Platform Carthage Compatible Twitter

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

Install

CocoaPods

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. Specify in Cartfile:

github "tapwork/WatchdogInspector"

Usage

Objective-C | Swift

Start

After launch or whenever you want.

import WatchdogInspector
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        TWWatchdogInspector.start()
        return true
}

####Stop To stop it just call

TWWatchdogInspector.stop()

Main Thread Stalling Exceptions

You can set a custom watchdog timeout for stalling exceptions (Default: 3 seconds)

TWWatchdogInspector.setStallingThreshhold(10.0)

You could also disable the Main Thread exceptions

TWWatchdogInspector.setEnableMainthreadStallingException(false)

####Logging To log all measured framerates you can log them in the console by calling (Default: on)

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

Author

License

MIT

Comments
  • port to tvOS

    port to tvOS

    I have ported the framework to tvOS. I didn't touch the cocoapods or other additional stuff. I tested it in app I ported to tvOS as well, just adding the framework in a workspace, and it looks fine. There are no warnings either (I had issues with the umbrella headers but I fixed them changing the headers from "project" to "public").

    opened by Michelasso 18
  • Port to tvOS

    Port to tvOS

    I don't know if you're interested, but I made it working on tvOS. At least I get a "status bar" (just a CGRect) showing on top of the screen. This is the code modified, file "TWWatchdogInspector.m"

    #pragma mark - UI Updates
    
    + (void)setupStatusView
    {
    #if TARGET_OS_IOS
        CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
    #elif TARGET_OS_TV
        CGRect statusBarFrame = CGRectMake(0, 0, 1920, 20);
    #endif
        CGSize size =  statusBarFrame.size;
        CGRect frame = CGRectMake(0, 0, size.width, size.height);
        UIWindow *window = [[UIWindow alloc] initWithFrame:frame];
        window.rootViewController = [[TWWatchdogInspectorViewController alloc] init];
        [window setHidden:NO];
    #if TARGET_OS_IOS
        window.windowLevel = UIWindowLevelStatusBar + 50;
    #elif TARGET_OS_TV
        window.windowLevel = UIWindowLevelNormal + 50;
    #endif
        kInspectorWindow = window;
    }
    

    I tested it in (yet another) port to tvOS of this git on my Apple TV 4K. It compiles just fine (well.. after messing up with the project configuration to manage to actually make it compiling and importing as a tvOS framework - not an Objective C guy, here) and runs beautifully:

    screen shot 2018-08-06 at 11 16 43

    Although I am not sure if the fps text is supposed to overlap the chart.

    opened by Michelasso 8
  • Allow to customize kUpdateWatchdogInterval

    Allow to customize kUpdateWatchdogInterval

    2 seconds is a bit high to my liking — I would've preferred the status bar to update more frequently. (I'm more concerned about FPS drops rather than general FPS trends...)

    opened by radex 5
  • Getting `TWWatchdogInspectorStallingTimeout` after doing a start > stop > start

    Getting `TWWatchdogInspectorStallingTimeout` after doing a start > stop > start

    I'm toggling whether Watchdog is running via a button, i.e not programatically. When I tap that button 3 times - start > stop > start - the library invariably crashes with the TWWatchdogInspectorStallingTimeout. Should that be expected? And, if so, hoping to understand better why that's the case.

    Thanks!

    opened by hkellaway 4
  • Add ability to disable throwing TWWatchdogInspectorStallingTimeout exception

    Add ability to disable throwing TWWatchdogInspectorStallingTimeout exception

    Would be good if it can add ability to disable throwing TWWatchdogInspectorStallingTimeout exception. While debugging the app, this will always be thrown and crash the app.

    opened by caoer 3
  • Private API usage - confirmation needed.

    Private API usage - confirmation needed.

    HI!

    In readme you wrote:

    Make sure that you don't use WatchdogInspector in production.

    I would like to keep Watchdoginspector for sometime for my development and staging build. Hence,

    #if ENV_DEVELOPMENT || ENV_STAGING
        TWWatchdogInspector.setEnableMainthreadStallingException(false)
        TWWatchdogInspector.start()
    #endif
    

    and so my question is: is it enough to protect myself from app rejection? Does Watchdoginspector use any private API? I'm asking because in release mode Watchdoginspector framework is bundled inside *.ipa.

    Best, Pikor

    opened by pikor 2
  • Add TWWatchdogInspector.h as public library to fix Carthage issue

    Add TWWatchdogInspector.h as public library to fix Carthage issue

    While I was trying to use your library in our project with Carthage I found out some public headers were missing in order to make it work. This PR fix the issue.

    opened by andresBrunFever 1
  • Updated Podfile to fix WatchdogInspector (from ) error for cocoapod v…

    Updated Podfile to fix WatchdogInspector (from ) error for cocoapod v…

    …ersion 1.0.0.beta.4

    When i tried to run example project i got [!] The dependencyWatchdogInspector (from ../WatchdogInspector.podspec)is not used in any concrete target. and i am using cocoapods with version 1.0.0.beta.4` adding these lines into Podfile fixed the issue.

    opened by eraydiler 0
  • Status bar text stays on top of the FPS bar on iOS 13

    Status bar text stays on top of the FPS bar on iOS 13

    Hey 👋 Thanks for the awesome library! Sadly, since iOS 13 apple decided to disallow windows appearing on top of the statusbar text:

    bar

    Some references:

    • https://github.com/SwiftKickMobile/SwiftMessages/issues/335
    • https://developer.apple.com/forums/thread/124649

    Seems that there isn't any workaround for this 😞

    opened by acecilia 0
Releases(1.3.0)
  • 1.3.0(Aug 15, 2018)

  • 1.0.0(Aug 10, 2016)

  • 0.3(May 30, 2016)

  • 0.2.1(Mar 10, 2016)

    • Does not log (Start and Stop) if logging is disabled
    • Adds some more Tests
    • Updates the example projects (Swift)
    • Uses iOS 7 as CocoaPods deployment target (instead of iOS 8)
    Source code(tar.gz)
    Source code(zip)
  • 0.2.0(Mar 6, 2016)

    • Exposes updateWatchdogInterval + (void)setUpdateWatchdogInterval:(NSTimeInterval)time;
      • Change the update interval for the background thread timer to count the main thread frames
    • Adds getter to check activity + (BOOL)isRunning;
    • Fixes wrong behaviour when start/stop/start via a button or toggle function
    Source code(tar.gz)
    Source code(zip)
Owner
Christian Menschel
Christian Menschel
All new design. Inspect your iOS application at runtime.

Peek: All new design Peek 5 with an all new design and all new features. Whether you're a developer, designer or QA/tester, Peek can help you at all s

Shaps 2.6k Dec 17, 2022
An iOS app decrypter, full static using fouldecrypt.

Iridium An iOS app decrypter, full static using fouldecrypt. Supporting iOS 13+ Note We have built everything into the package, you can install and fl

Lakr Aream 234 Jan 9, 2023
An iOS app decrypter, full static using fouldecrypt.

Iridium An iOS app decrypter, full static using fouldecrypt. Supporting iOS 13+ Note We have built everything into the package, you can install and fl

Lakr Aream 226 Dec 24, 2022
SwiftGen is a tool to automatically generate Swift code for resources of your projects

SwiftGen SwiftGen is a tool to automatically generate Swift code for resources of your projects (like images, localised strings, etc), to make them ty

null 8.3k Jan 5, 2023
An Xcode plug-in to format your code using SwiftLint.

SwiftLintXcode An Xcode plug-in to format your code using SwiftLint. Runs swiftlint autocorrect --path CURRENT_FILE before *.swift file is saved. IMPO

Yuya Tanaka 348 Sep 18, 2022
AVXCAssets Generator takes path for your assets images and creates appiconset and imageset for you in just one click

AVXCAssets Generator Often while developing an app, We ran into a condition when we need to scale images to each and every aspect ratios for icons and

Angel Vasa 339 Dec 6, 2022
Automatically build and rebuild Xcode image catalogs for app icons, universal images, and more

Better asset workflow for iOS developers. Generate Xcode image catalogs for iOS / OSX app icons, universal images, and more.

Dotan J. Nahum 822 Dec 21, 2022
Command line program that detects unused resource strings in an iOS or OS X application.

Abandoned Resource String Detection This command line program detects unused resource strings in an iOS or OS X application. Updated to Swift 3, thank

Josh Smith 360 Nov 26, 2022
Build native iOS, Android, and Web apps with Capacitor and Remix.run 💿

This repository holds production ready Capacitor templates for building native mobile applications using Remix. Using Capacitor, you can quickly build out a native mobile application for iOS and Android using web technology, such as Remix.

Ionic 70 Dec 30, 2022
Shows your current framerate (fps) in the status bar of your iOS app

WatchdogInspector Shows your current framerate (fps) in the status bar of your iOS app Be a good citizen! Don't block your main thread! WatchdogInspec

Christian Menschel 510 Nov 24, 2022
macOS menu bar app that displays the current status of SIP (System Integrity Protection)

MenuBarSIPDetector This is a DEMO app for my Swift library TINURecovery and it is a macOS menu bar app that displays the current status of SIP (System

null 19 Dec 18, 2022
🚄ℹ️ Show current train info (speed, next station, arrival time) in macOS status bar

TrainStatusInfo This macOS application shows the current train status info in the status bar when connected to the trains hotspot. It uses the "intern

Niklas 10 Jul 16, 2022
StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again. It supports apps which hide the status bar and The Notch

StatusBarOverlay StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again. It support

Idle Hands Apps 160 Nov 2, 2022
a simple macOS menu bar application that shows you the lyrics of current playing spotify track.

lyricsify a simple macOS menu bar application that shows you the lyrics of current playing spotify track.

Krisna Pranav 4 Sep 16, 2021
BPStatusBarAlert is a library that allows you to easily make text-based alert that appear on the status bar and below navigation bar.

BPStatusBarAlert BPStatusBarAlert is a library that allows you to easily make text-based alert that appear on the status bar and below navigation bar.

Ben.Park 131 Aug 12, 2022
Automaticly display Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code based on Swift. Just like God opened his eyes

GodEye Automaticly display Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code based on Swift. Just like God opened hi

陈奕龙(子循) 3.7k Dec 23, 2022
This app shows the current percentage of the vaccination campaign in Brazil and its states

This app shows the current percentage of the vaccination campaign in Brazil and its states. The data is obtained thanks to covid19br.

Anderson Kloss Maia 8 Jul 22, 2022
Simple app that tracks your works hours from the status bar.

Track Your Work Hours Simple app that tracks your works hours from status bar. Features: Simple and private. Data is stored in CSV in the Documents fo

Niteo 44 Dec 2, 2022
Work-hours-mac - Simple app that tracks your work hours from the status bar

Track Your Work Hours Simple app that tracks your work hours from status bar. Fe

Niteo 44 Dec 2, 2022