Shows FPS, CPU and memory usage, device model, app and iOS versions above the status bar and report FPS, CPU and memory usage via delegate.

Overview

GDPerformanceView-Swift

Shows FPS, CPU and memory usage, device model, app and iOS versions above the status bar and report FPS, CPU and memory usage via delegate.

Carthage compatible Pod Version Swift Version Swift Version Swift Version Plaform License MIT

Alt text Alt text Alt text Alt text

Installation

Simply add GDPerformanceMonitoring folder with files to your project, or use CocoaPods.

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/GDPerformanceView.framework to an iOS project.

github "dani-gavrilov/GDPerformanceView-Swift" ~> 2.1.1

Don't forget to import GDPerformanceView by adding:

import GDPerformanceView

CocoaPods

You can use CocoaPods to install GDPerformanceView by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!

target 'project_name' do
	pod 'GDPerformanceView-Swift', '~> 2.1.1'
end

Don't forget to import GDPerformanceView by adding:

import GDPerformanceView_Swift

Usage example

Simply start monitoring. Performance view will be added above the status bar automatically. Also, you can configure appearance as you like or just hide the monitoring view and use its delegate.

You can find example projects here.

Start monitoring

By default, monitoring is paused. Call the following command to start or resume monitoring:

PerformanceMonitor.shared().start()

or

self.performanceView = PerformanceMonitor()
self.performanceView?. start()

This won't show the monitoring view if it was hidden previously. To show it call the following command:

self.performanceView?.show()

Pause monitoring

Call the following command to pause monitoring:

self.performanceView?.pause()

This won't hide the monitoring view. To hide it call the following command:

self.performanceView?.hide()

Displayed information

You can change displayed information by changing options of the performance monitor:

self.performanceView?.performanceViewConfigurator.options = .all

You can choose from:

  • performance - CPU usage and FPS.
  • memory - Memory usage.
  • application - Application version with build number.
  • device - Device model.
  • system - System name with version.

Also you can mix them, but order doesn't matter:

self.performanceView?.performanceViewConfigurator.options = [.performance, .application, .system]

By default, set of [.performance, .application, .system] options is used.

You can also add your custom information by using:

self.performanceView?.performanceViewConfigurator.userInfo = .custom(string: "Launch date \(Date())")

Keep in mind that custom string will not automatically fit the screen, use \n if it is too long.

Appearance

You can change monitoring view appearance by changing style of the performance monitor:

Call the following command to change output information:

self.performanceView?.performanceViewConfigurator.style = .dark

You can choose from:

  • dark - Black background, white text.
  • light - White background, black text.
  • custom - You can set background color, border color, border width, corner radius, text color and font.

By default, dark style is used.

Also you can override prefersStatusBarHidden and preferredStatusBarStyle to match your expectations:

self.performanceView?.statusBarConfigurator.statusBarHidden = false
self.performanceView?.statusBarConfigurator.statusBarStyle = .lightContent

Interactions

You can interact with performance view via gesture recognizers. Add them by using:

self.performanceView?.performanceViewConfigurator.interactors = [tapGesture, swipeGesture]

If interactors is nil or empty point(inside:with:) of the view will return false to make all touches pass underneath. So to remove interactors just call the following command:

self.performanceView?.performanceViewConfigurator.interactors = nil

By default, interactors are nil.

Delegate

Set the delegate and implement its method:

self.performanceView?.delegate = self
func performanceMonitor(didReport performanceReport: PerformanceReport) {
	print(performanceReport.cpuUsage, performanceReport.fps, performanceReport.memoryUsage.used, performanceReport.memoryUsage.total)
}

Requirements

  • iOS 9.0+
  • xCode 12.0+

Donations

Wanna say thanks? You can do it using Patreon.

Meta

Daniil Gavrilov - VK - FB

I will be pleased to know that your project uses this framework. You can send a link to your project in App Store to my email - [email protected].

License

GDPerformanceView is available under the MIT license. See the LICENSE file for more info.

Comments
  • Fix compilation with Xcode 8.3

    Fix compilation with Xcode 8.3

    Compiler complains Cannot force unwrap value of non-optional type 'thread_act_array_t?.Type' (aka 'Optional<UnsafeMutablePointer<UInt32>>.Type').

    For a simpler explanation, the type of the object is Optional<T>.Type which is not optional itself, as opposed to Optional<T>

    opened by mjarvis 4
  • Need some example to add to my app

    Need some example to add to my app

    Using the pod-file and updating my project given the example is fairly easy, but I'm missing instructions on how to get it running?! I tried adding the start-monitoring to my AppDelegate.swift

    private func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. }

    and the stop-monitoring to my AppDelegate.swift

    func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. gdpMonitoringStop() }

    but getting compile-errors. Do I need to add 'import GDPMonitoring' after 'import UIKit' in my AppDelegate.swift ?

    opened by githotto 4
  • Swift 5 migration

    Swift 5 migration

    Hi there, I did some minor modifications in order for the project to be Swift 5 compatible. No source changes involved. Maybe you'd be so kind to incorporate these changes back into your master repo.

    Thanks Tino

    opened by tinora 2
  • Add custom info

    Add custom info

    Is it possible to add custom info info in the performance view?

    For example, I would like to add the date when the user started the application.

    Thank you a lot !

    opened by jeryTymate 2
  • App crashes using iPhone with iOS 12.4.8

    App crashes using iPhone with iOS 12.4.8

    Hello, when trying to run my app with the latest GDPerfomanceView-Swift 2.1.0 on an iPhone with iOS 12.4.8 it crashes upon start at:

    extension UIApplication {
        
        var keyWindow: UIWindow? {
            if #available(iOS 13, *) {
                return UIApplication.shared.windows.first { $0.isKeyWindow }
            } else {
                return UIApplication.shared.keyWindow
            }
        }
    ...
    }
    

    this results in an endless getter loop:

    #2	0x00000001087ab9b4 in UIApplication.keyWindow.getter at Example/Pods/GDPerformanceView-Swift/GDPerformanceView-Swift/GDPerformanceMonitoring/Extensions.swift:28
    ...
    #5309	0x00000001087abb2c in UIApplication.keyWindow.getter at Example/Pods/GDPerformanceView-Swift/GDPerformanceView-Swift/GDPerformanceMonitoring/Extensions.swift:31
    
    opened by car5ten 1
  • fix memory usage not equal Xcode Debug Gauge

    fix memory usage not equal Xcode Debug Gauge

    resident_size does not get accurate memory, and the correct way is to use phys_footprint, which can be proved from the source codes of WebKit and XNU.Webkit Source

    opened by JinJieGu 1
  • Would be nice to expose a public variable to know whether or not a monitor view has been created.

    Would be nice to expose a public variable to know whether or not a monitor view has been created.

    For cases where you don't want to call start monitoring while there is already a monitor view active.

    Or at least expose a read only performanceView property...

    opened by lemonkey 1
  • iOS 9 status bar style

    iOS 9 status bar style "lightContent" not working

    Now that the status bar is visible on iOS 9 I recognized that the status bar style set by the view controller is ignored. My code is pretty simple:

    ` override var prefersStatusBarHidden: Bool { return false }

    override var preferredStatusBarStyle: UIStatusBarStyle { return isDarkMode ? .lightContent : .default } `

    The status bar style is switching on iOS 10 but not on iOS 9 (where it is always default).

    opened by 1024kilobyte 1
  • Support for Interface Orientation

    Support for Interface Orientation

    It would be nice if this library supported interface rotation gracefully.

    Currently, if I start the app in portrait and rotate to landscape, the performance view becomes centered on the top left corner.

    Tested on iPhone 6, iOS 10.2

    opened by bizz84 1
  • Carthage support

    Carthage support

    opened by TofPlay 1
  • Does the FPS measurement detect dropped frames during compositing?

    Does the FPS measurement detect dropped frames during compositing?

    I've got a performance tool that similarly uses CADisplayLink to try and measure the framerate / dropped frames. But in my tests back during iOS 7 and 8, CADisplayLink's callback timing was only affected when a frame drop happened due to slowness in-process, for example if there's a lot of auto layout work. My understanding of UIKit's drawing is that after the layers are all prepared, they are composited out-of-process in iOS's equivalent of the WindowServer, as OpenGL / Metal rectangles. So if compositing is too slow, say because you have a bunch of expensive layers with blurring and rounded corners, the display link callback will still happen right on time. You'll see a slow frame rate, but the meter will show 60.

    I did an ugly hack to solve this that worked in iOS 7 and 8, but doesn't work anymore in iOS 9 and 10. Did you have a way to address this? If we can figure it out, we can improve both our projects. If not, you may want to write some kind of disclaimer in your readme. :)

    If you want to test this out, the repo I linked to has an example project, and you can add your meter to it. You'd want to use the ios9 branch.

    opened by kconner 1
  • rename PerformanceCalculator to fix stranger character displayed as name

    rename PerformanceCalculator to fix stranger character displayed as name

    The previous version contains file named GDPerformanceView-Swift/GDPerformanceMonitoring/Performance\320\241alculator.swift that prevent the build from success that showed on the attached image. I renamed it to normal. Hope that you can create a new release for it. Thank you Screen Shot 2021-08-17 at 09 37 08

    opened by hieupham9809 0
  • Performance not show on ipad device

    Performance not show on ipad device

    Hello, I have a problem on ipad, after start PerformanceMonitor, there are nothing show on screen about monitoring. This issue cause when run app on ipad without debugging mode.

    opened by khoadotan12 0
Releases(2.1.1)
Owner
Gavrilov Daniil
iOS developer
Gavrilov Daniil
Swift autocompleter for Sublime Text, via the adorable SourceKitten framework

SwiftKitten SwiftKitten is a Swift autocompleter for Sublime Text, via the adorable SourceKitten framework. Faster than XCode ! This package is new an

John Snyder 142 Sep 9, 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
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
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
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
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
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
Swift CLI for strong-typing images, colors, storyboards, fonts and localizations

Shark Shark is a Swift command line tool that generates type safe enums for your images, colors, storyboards, fonts and localizations. Because Shark r

Kaan Dedeoglu 377 Dec 1, 2022
Strong typed, autocompleted resources like images, fonts and segues in Swift projects

R.swift Get strong typed, autocompleted resources like images, fonts and segues in Swift projects Why use this? It makes your code that uses resources

Mathijs Kadijk 8.9k Jan 6, 2023
Xcode storyboards diff and merge tool.

StoryboardMerge Storyboard diff and merge tool which: compares and merges two storyboard files, provides an automatic merge-facility, The storyboardin

null 238 Sep 12, 2022
An adorable little framework and command line tool for interacting with SourceKit.

SourceKitten An adorable little framework and command line tool for interacting with SourceKit. SourceKitten links and communicates with sourcekitd.fr

JP Simard 2.1k Jan 5, 2023
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
QR code detector. Simple usage, you can get recognition results via delegate or callback.

SPQRCode QR code detector. Simple usage, you can get recognition results via delegate or callback. Installation Swift Package Manager CocoaPods Manual

Sparrow Code 58 Jan 6, 2023
An animated gif & apng engine for iOS in Swift. Have a great performance on memory and cpu usage.

Features Small but complete, only200lines of code. Allow to control display quality, memory usage, loop time and display progress. Have a great perfor

Jiawei Wang 1k Nov 9, 2022
Resource monitor - A flutter plugin for Android and IOS to monitor CPU and RAM usage of device.

resource_monitor A flutter plugin for Android and IOS to monitor CPU and RAM usage of device. TODO Implement Android Side of this plugin. Add listener

Skandar Munir 1 Nov 11, 2022
A command line profiling tool with stopwatch, cpu and memory usage

timeui A command line profiling tool with stopwatch, cpu and memory usage. Usage ./timeui path/to/app-to-profile runs the stopwatch and signpost regio

Marin Todorov 107 Dec 10, 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
A fast, convenient and nonintrusive conversion framework between JSON and model. Your model class doesn't need to extend any base class. You don't need to modify any model file.

MJExtension A fast, convenient and nonintrusive conversion framework between JSON and model. 转换速度快、使用简单方便的字典转模型框架 ?? ✍??Release Notes: more details Co

M了个J 8.5k Jan 3, 2023