├── Screenshot └── image.png ├── LHPerformanceStatusBar.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcuserdata │ └── huangwenchen.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── LHPerformanceStatusBar.xcscheme └── project.pbxproj ├── LHPerformanceStatusBar ├── ViewController.h ├── AppDelegate.h ├── main.m ├── ViewController.m ├── Info.plist ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.storyboard ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json └── AppDelegate.m ├── .gitignore ├── Classes ├── LHPerformanceUtil.h ├── LHPerformanceLabel.h ├── LHPerformanceStatusBar.h ├── LHPerformanceTypes.h ├── LHPerformanceMonitorService.h ├── LHPerformanceConfig.h ├── LHPerformanceConfig.m ├── LHPerformanceLabel.m ├── LHPerformanceStatusBar.m ├── LHPerformanceUtil.m └── LHPerformanceMonitorService.m ├── LHPerformanceStatusBar.podspec ├── LICENSE └── README.md /Screenshot/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeoMobileDeveloper/LHPerformanceStatusBar/HEAD/Screenshot/image.png -------------------------------------------------------------------------------- /LHPerformanceStatusBar.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LHPerformanceStatusBar/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LHPerformanceStatusBar 4 | // 5 | // Created by huangwenchen on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # For Xcode 2 | .DS_Store 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | *.xcworkspace 13 | !default.xcworkspace 14 | xcuserdata 15 | profile 16 | *.moved-aside 17 | DerivedData 18 | .idea/ 19 | # If you use cocoa pod 20 | Pods -------------------------------------------------------------------------------- /Classes/LHPerformanceUtil.h: -------------------------------------------------------------------------------- 1 | // 2 | // QTPerformanceUtil.h 3 | // 4 | // 5 | // Created by Leo on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface LHPerformanceUtil : NSObject 13 | 14 | + (CGFloat)usedMemoryInMB; 15 | 16 | + (CGFloat)cpuUsage; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /LHPerformanceStatusBar/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LHPerformanceStatusBar 4 | // 5 | // Created by huangwenchen on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /LHPerformanceStatusBar/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LHPerformanceStatusBar 4 | // 5 | // Created by huangwenchen on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Classes/LHPerformanceLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // LHPerformanceLabel.h 3 | // 4 | // 5 | // Created by Leo on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LHPerformanceMonitorService.h" 11 | 12 | @interface LHPerformanceLabel : UILabel 13 | 14 | @property (assign, nonatomic)LHPerformanceLabelState state; 15 | 16 | - (void)setTextColor:(UIColor *)textColor forState:(LHPerformanceLabelState)state; 17 | 18 | - (UIColor *)textColorForState:(LHPerformanceLabelState)state; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Classes/LHPerformanceStatusBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // LHPerformanceStatusBar.h 3 | // 4 | // 5 | // Created by Leo on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LHPerformanceLabel.h" 11 | 12 | @interface LHPerformanceStatusBar : UIView 13 | 14 | @property (strong, nonatomic) LHPerformanceLabel * fpsLabel; 15 | 16 | @property (strong, nonatomic) LHPerformanceLabel * memoryLabel; 17 | 18 | @property (strong, nonatomic) LHPerformanceLabel * cpuLabel; 19 | 20 | - (NSArray *)subLabels; 21 | @end 22 | -------------------------------------------------------------------------------- /Classes/LHPerformanceTypes.h: -------------------------------------------------------------------------------- 1 | // 2 | // LHPerformanceTypes.h 3 | // LHPerformanceStatusBar 4 | // 5 | // Created by huangwenchen on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger,LHPerformanceLabelState){ 12 | LHPerformanceStateGood, 13 | LHPerformanceStateWarning, 14 | LHPerformanceStateBad, 15 | }; 16 | 17 | typedef NS_ENUM(NSInteger,LHPerformanceMonitorAttributes){ 18 | LHPerformanceMonitorMemory, 19 | LHPerformanceMonitorCPU, 20 | LHPerformanceMonitorFPS, 21 | }; 22 | -------------------------------------------------------------------------------- /LHPerformanceStatusBar.xcodeproj/xcuserdata/huangwenchen.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LHPerformanceStatusBar.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 524DFC7C1E114A6E0026199B 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Classes/LHPerformanceMonitorService.h: -------------------------------------------------------------------------------- 1 | // 2 | // QTFPSMonitor.h 3 | // 4 | // 5 | // Created by Leo on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "LHPerformanceTypes.h" 12 | 13 | @class LHPerformanceConfig; 14 | /** 15 | Run this service will create a window above status to show FPS,CPU and Memory usage. 16 | */ 17 | @interface LHPerformanceMonitorService : NSObject 18 | 19 | + (void)run; 20 | 21 | + (void)stop; 22 | 23 | + (void)setTextColor:(UIColor *)textColor forState:(LHPerformanceLabelState)state; 24 | 25 | + (void)setConfig:(LHPerformanceConfig *)config forAttribte:(LHPerformanceMonitorAttributes)attribtue; 26 | @end 27 | -------------------------------------------------------------------------------- /LHPerformanceStatusBar.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'LHPerformanceStatusBar' 3 | s.version = '0.1.0' 4 | s.summary = 'Add FPS,CPU and Memory to your status bar' 5 | s.description = <<-DESC 6 | This is a library to create a new status bar with realtime FPS,CPU and memory information. 7 | DESC 8 | 9 | s.homepage = 'https://github.com/LeoMobileDeveloper/LHPerformanceStatusBar' 10 | s.license = { :type => 'MIT', :file => 'LICENSE' } 11 | s.author = { 'Leo' => 'leomobiledeveloper@gmail.com' } 12 | s.source = { :git => 'https://github.com/LeoMobileDeveloper/LHPerformanceStatusBar.git', :tag => s.version.to_s } 13 | s.ios.deployment_target = '8.0' 14 | s.source_files = 'Classes/*' 15 | end -------------------------------------------------------------------------------- /LHPerformanceStatusBar/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LHPerformanceStatusBar 4 | // 5 | // Created by huangwenchen on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LHPerformanceMonitorService.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | - (void)viewDidAppear:(BOOL)animated{ 24 | [super viewDidAppear:animated]; 25 | [LHPerformanceMonitorService run]; 26 | } 27 | - (void)didReceiveMemoryWarning { 28 | [super didReceiveMemoryWarning]; 29 | // Dispose of any resources that can be recreated. 30 | } 31 | 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Classes/LHPerformanceConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // LHPerformanceConfig.h 3 | // LHPerformanceStatusBar 4 | // 5 | // Created by huangwenchen on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "LHPerformanceTypes.h" 12 | 13 | @interface LHPerformanceConfig : NSObject 14 | 15 | @property (assign,nonatomic)CGFloat goodThreshold; 16 | 17 | @property (assign,nonatomic)CGFloat warningThreadhold; 18 | 19 | 20 | /** 21 | Default is NO. So,if value is greater than goodThreshold,then it is good.Just like FPS,the higher,the better. 22 | */ 23 | @property (assign,nonatomic)BOOL lessIsBetter; 24 | 25 | + (instancetype)defaultConfigForAttribtue:(LHPerformanceMonitorAttributes)attribute; 26 | 27 | + (instancetype)configWithGood:(CGFloat)good warning:(CGFloat)warning lessIsBetter:(BOOL)lessIsBetter; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Leo 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Classes/LHPerformanceConfig.m: -------------------------------------------------------------------------------- 1 | // 2 | // LHPerformanceConfig.m 3 | // LHPerformanceStatusBar 4 | // 5 | // Created by huangwenchen on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import "LHPerformanceConfig.h" 10 | 11 | @implementation LHPerformanceConfig 12 | 13 | + (instancetype)defaultConfigForAttribtue:(LHPerformanceMonitorAttributes)attribute{ 14 | if (attribute == LHPerformanceMonitorMemory) { 15 | return [self configWithGood:150.0 warning:200.0 lessIsBetter:YES]; 16 | } 17 | if (attribute == LHPerformanceMonitorFPS) { 18 | return [self configWithGood:55.0 warning:40.0 lessIsBetter:NO]; 19 | } 20 | if (attribute == LHPerformanceMonitorCPU) { 21 | return [self configWithGood:70.0 warning:90.0 lessIsBetter:YES];; 22 | } 23 | return nil; 24 | } 25 | + (instancetype)configWithGood:(CGFloat)good warning:(CGFloat)warning lessIsBetter:(BOOL)lessIsBetter{ 26 | LHPerformanceConfig * config = [[LHPerformanceConfig alloc] init]; 27 | config.lessIsBetter = lessIsBetter; 28 | config.goodThreshold = good; 29 | config.warningThreadhold = warning; 30 | return config; 31 | } 32 | @end 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | LHPerformanceStatusBar 4 |

5 | 6 | [![Version](https://img.shields.io/cocoapods/v/LHPerformanceStatusBar.svg?style=flat)](http://cocoapods.org/pods/LHPerformanceStatusBar) [![Platform](http://img.shields.io/badge/platform-ios-blue.svg?style=flat 7 | )](https://developer.apple.com/iphone/index.action) 8 | [![License](http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat 9 | )](http://mit-license.org) 10 | 11 | # LHPerformanceStatusBar 12 | 13 | Replace statusbar with a new bar to show realtime performance 14 | 15 | - FPS 16 | - CPU 17 | - Memory 18 | 19 | 20 | ## Install 21 | 22 | Cocoapod 23 | 24 | ``` 25 | pod LHPerformanceStatusBar 26 | ``` 27 | 28 | ## Usage 29 | In `viewDidAppear` or somewhere where the keyWindow is loaded 30 | 31 | ``` 32 | - (void)viewDidAppear:(BOOL)animated{ 33 | [super viewDidAppear:animated]; 34 | [LHPerformanceMonitorService run]; 35 | } 36 | ``` 37 | ## Author 38 | 39 | Leo, leomobiledeveloper 40 | 41 | ## License 42 | 43 | LHPerformanceStatusBar is available under the MIT license. See the LICENSE file for more info. 44 | -------------------------------------------------------------------------------- /LHPerformanceStatusBar/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Classes/LHPerformanceLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // LHPerformanceLabel.m 3 | // 4 | // 5 | // Created by Leo on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import "LHPerformanceLabel.h" 10 | @interface LHPerformanceLabel() 11 | 12 | @property (strong,nonatomic)NSMutableDictionary * configCache; 13 | 14 | @end 15 | 16 | @implementation LHPerformanceLabel 17 | 18 | - (instancetype)initWithFrame:(CGRect)frame 19 | { 20 | self = [super initWithFrame:frame]; 21 | if (self) { 22 | [self setup]; 23 | } 24 | return self; 25 | } 26 | 27 | - (void)setup{ 28 | [self setTextColor:[UIColor colorWithRed:244.0/255.0 green:66.0/255.0 blue:66.0/255.0 alpha:1.0] forState:LHPerformanceStateBad]; 29 | [self setTextColor:[UIColor orangeColor] forState:LHPerformanceStateWarning]; 30 | [self setTextColor:[UIColor colorWithRed:66.0/255.0 green:244.0/255.0 blue:89.0/255.0 alpha:1.0] forState:LHPerformanceStateGood]; 31 | self.state = LHPerformanceStateGood; 32 | } 33 | 34 | - (NSMutableDictionary *)configCache{ 35 | if (_configCache == nil) { 36 | _configCache = [[NSMutableDictionary alloc] init]; 37 | } 38 | return _configCache; 39 | } 40 | - (void)setTextColor:(UIColor *)textColor forState:(LHPerformanceLabelState)state{ 41 | if (textColor) { 42 | [self.configCache setObject:textColor forKey:@(state)]; 43 | }else{ 44 | [self.configCache removeObjectForKey:@(state)]; 45 | } 46 | } 47 | 48 | - (UIColor *)textColorForState:(LHPerformanceLabelState)state{ 49 | return [self.configCache objectForKey:@(state)]; 50 | } 51 | 52 | - (void)setState:(LHPerformanceLabelState)state{ 53 | _state = state; 54 | UIColor * color = [self textColorForState:state]; 55 | self.textColor = color; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /LHPerformanceStatusBar/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /LHPerformanceStatusBar/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LHPerformanceStatusBar/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /LHPerformanceStatusBar/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LHPerformanceStatusBar 4 | // 5 | // Created by huangwenchen on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Classes/LHPerformanceStatusBar.m: -------------------------------------------------------------------------------- 1 | // 2 | // LHPerformanceStatusBar.m 3 | // 4 | // 5 | // Created by Leo on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import "LHPerformanceStatusBar.h" 10 | 11 | @implementation LHPerformanceStatusBar 12 | 13 | - (instancetype)initWithFrame:(CGRect)frame 14 | { 15 | self = [super initWithFrame:frame]; 16 | if (self) { 17 | [self setup]; 18 | } 19 | return self; 20 | } 21 | - (NSArray *)subLabels{ 22 | return @[_fpsLabel,_memoryLabel,_cpuLabel]; 23 | } 24 | - (void)setup{ 25 | self.backgroundColor = [UIColor whiteColor]; 26 | _fpsLabel = [[LHPerformanceLabel alloc] initWithFrame:CGRectZero]; 27 | _fpsLabel.font = [UIFont systemFontOfSize:10]; 28 | _fpsLabel.textColor = [UIColor whiteColor]; 29 | _fpsLabel.text = @"FPS: d-"; 30 | _fpsLabel.translatesAutoresizingMaskIntoConstraints = NO; 31 | [self addSubview:_fpsLabel]; 32 | 33 | _memoryLabel = [[LHPerformanceLabel alloc] initWithFrame:CGRectZero]; 34 | _memoryLabel.font = [UIFont systemFontOfSize:10]; 35 | _memoryLabel.textColor = [UIColor whiteColor]; 36 | _memoryLabel.text = @"Memory:-"; 37 | _memoryLabel.translatesAutoresizingMaskIntoConstraints = NO; 38 | [self addSubview:_memoryLabel]; 39 | 40 | _cpuLabel = [[LHPerformanceLabel alloc] initWithFrame:CGRectZero]; 41 | _cpuLabel.font = [UIFont systemFontOfSize:10]; 42 | _cpuLabel.textColor = [UIColor whiteColor]; 43 | _cpuLabel.text = @"CPU:-"; 44 | _cpuLabel.translatesAutoresizingMaskIntoConstraints = NO; 45 | [self addSubview:_cpuLabel]; 46 | 47 | //Layout 48 | NSDictionary * subviews = NSDictionaryOfVariableBindings(_fpsLabel,_memoryLabel,_cpuLabel); 49 | //CenterY 50 | for (UIView * label in subviews.allValues) { 51 | [self addConstraint:[NSLayoutConstraint constraintWithItem:label 52 | attribute:NSLayoutAttributeCenterY 53 | relatedBy:NSLayoutRelationEqual 54 | toItem:self 55 | attribute:NSLayoutAttributeCenterY 56 | multiplier:1.0 57 | constant:0]]; 58 | } 59 | //CenterX 60 | [self addConstraint:[NSLayoutConstraint constraintWithItem:_memoryLabel attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]]; 61 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"[_fpsLabel]-8-[_memoryLabel]-8-[_cpuLabel]" options:0 metrics:nil views:subviews]]; 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Classes/LHPerformanceUtil.m: -------------------------------------------------------------------------------- 1 | // 2 | // QTPerformanceUtil.m 3 | // 4 | // 5 | // Created by Leo on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import "LHPerformanceUtil.h" 10 | #import "mach/mach.h" 11 | 12 | @implementation LHPerformanceUtil 13 | 14 | + (CGFloat)usedMemoryInMB{ 15 | vm_size_t memory = usedMemory(); 16 | return memory / 1000.0 / 1000.0; 17 | } 18 | 19 | + (CGFloat)cpuUsage{ 20 | float cpu = cpu_usage(); 21 | return cpu; 22 | } 23 | vm_size_t usedMemory(void) { 24 | struct task_basic_info info; 25 | mach_msg_type_number_t size = sizeof(info); 26 | kern_return_t kerr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size); 27 | return (kerr == KERN_SUCCESS) ? info.resident_size : 0; // size in bytes 28 | } 29 | 30 | float cpu_usage() 31 | { 32 | kern_return_t kr; 33 | task_info_data_t tinfo; 34 | mach_msg_type_number_t task_info_count; 35 | 36 | task_info_count = TASK_INFO_MAX; 37 | kr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)tinfo, &task_info_count); 38 | if (kr != KERN_SUCCESS) { 39 | return -1; 40 | } 41 | 42 | task_basic_info_t basic_info; 43 | thread_array_t thread_list; 44 | mach_msg_type_number_t thread_count; 45 | 46 | thread_info_data_t thinfo; 47 | mach_msg_type_number_t thread_info_count; 48 | 49 | thread_basic_info_t basic_info_th; 50 | uint32_t stat_thread = 0; // Mach threads 51 | 52 | basic_info = (task_basic_info_t)tinfo; 53 | 54 | // get threads in the task 55 | kr = task_threads(mach_task_self(), &thread_list, &thread_count); 56 | if (kr != KERN_SUCCESS) { 57 | return -1; 58 | } 59 | if (thread_count > 0) 60 | stat_thread += thread_count; 61 | 62 | long tot_sec = 0; 63 | long tot_usec = 0; 64 | float tot_cpu = 0; 65 | int j; 66 | 67 | for (j = 0; j < thread_count; j++) 68 | { 69 | thread_info_count = THREAD_INFO_MAX; 70 | kr = thread_info(thread_list[j], THREAD_BASIC_INFO, 71 | (thread_info_t)thinfo, &thread_info_count); 72 | if (kr != KERN_SUCCESS) { 73 | return -1; 74 | } 75 | 76 | basic_info_th = (thread_basic_info_t)thinfo; 77 | 78 | if (!(basic_info_th->flags & TH_FLAGS_IDLE)) { 79 | tot_sec = tot_sec + basic_info_th->user_time.seconds + basic_info_th->system_time.seconds; 80 | tot_usec = tot_usec + basic_info_th->user_time.microseconds + basic_info_th->system_time.microseconds; 81 | tot_cpu = tot_cpu + basic_info_th->cpu_usage / (float)TH_USAGE_SCALE * 100.0; 82 | } 83 | 84 | } // for each thread 85 | 86 | kr = vm_deallocate(mach_task_self(), (vm_offset_t)thread_list, thread_count * sizeof(thread_t)); 87 | assert(kr == KERN_SUCCESS); 88 | 89 | return tot_cpu; 90 | } 91 | @end 92 | -------------------------------------------------------------------------------- /LHPerformanceStatusBar.xcodeproj/xcuserdata/huangwenchen.xcuserdatad/xcschemes/LHPerformanceStatusBar.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Classes/LHPerformanceMonitorService.m: -------------------------------------------------------------------------------- 1 | // 2 | // QTFPSMonitor.m 3 | // 4 | // 5 | // Created by Leo on 2016/12/26. 6 | // Copyright © 2016年 Leo. All rights reserved. 7 | // 8 | 9 | #import "LHPerformanceMonitorService.h" 10 | #import "LHPerformanceStatusBar.h" 11 | #import "LHPerformanceUtil.h" 12 | #import "LHPerformanceConfig.h" 13 | 14 | @interface LHPerformanceMonitorService() 15 | 16 | @property (strong, nonatomic) CADisplayLink * displayLink; 17 | 18 | @property (assign, nonatomic) NSTimeInterval lastTimestamp; 19 | 20 | @property (assign, nonatomic) NSInteger countPerFrame; 21 | 22 | @property (strong, nonatomic) LHPerformanceStatusBar * fpsStatusBar; 23 | 24 | @property (strong, nonatomic) UIWindow * statusBarWindow; 25 | 26 | @property (strong, nonatomic) NSMutableDictionary * configDictionary; 27 | 28 | @end 29 | 30 | @implementation LHPerformanceMonitorService 31 | 32 | #pragma mark - Init 33 | + (instancetype)sharedService{ 34 | static LHPerformanceMonitorService * sharedInstance; 35 | static dispatch_once_t onceToken; 36 | dispatch_once(&onceToken, ^{ 37 | sharedInstance = [[LHPerformanceMonitorService alloc] init]; 38 | }); 39 | return sharedInstance; 40 | } 41 | 42 | - (NSMutableDictionary *)configDictionary{ 43 | if (_configDictionary == nil) { 44 | _configDictionary = [NSMutableDictionary new]; 45 | [_configDictionary setObject:[LHPerformanceConfig defaultConfigForAttribtue:LHPerformanceMonitorCPU] 46 | forKey:@(LHPerformanceMonitorCPU)]; 47 | [_configDictionary setObject:[LHPerformanceConfig defaultConfigForAttribtue:LHPerformanceMonitorFPS] 48 | forKey:@(LHPerformanceMonitorFPS)]; 49 | [_configDictionary setObject:[LHPerformanceConfig defaultConfigForAttribtue:LHPerformanceMonitorMemory] 50 | forKey:@(LHPerformanceMonitorMemory)]; 51 | } 52 | return _configDictionary; 53 | } 54 | - (instancetype)init{ 55 | if (self = [super init]) { 56 | _lastTimestamp = -1; 57 | _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(envokeDisplayLink:)]; 58 | _displayLink.paused = YES; 59 | [_displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; 60 | _fpsStatusBar = [[LHPerformanceStatusBar alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 20.0)]; 61 | //Notification 62 | [[NSNotificationCenter defaultCenter] addObserver: self 63 | selector: @selector(applicationDidBecomeActiveNotification) 64 | name: UIApplicationDidBecomeActiveNotification 65 | object: nil]; 66 | 67 | [[NSNotificationCenter defaultCenter] addObserver: self 68 | selector: @selector(applicationWillResignActiveNotification) 69 | name: UIApplicationWillResignActiveNotification 70 | object: nil]; 71 | self.statusBarWindow = [[UIWindow alloc] initWithFrame:_fpsStatusBar.frame]; 72 | self.statusBarWindow.hidden = YES; 73 | self.statusBarWindow.windowLevel = UIWindowLevelAlert + 1; 74 | [self.statusBarWindow addSubview:self.fpsStatusBar]; 75 | } 76 | return self; 77 | } 78 | - (void)dealloc{ 79 | _displayLink.paused = YES; 80 | [_displayLink removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; 81 | } 82 | 83 | #pragma mark - Private 84 | 85 | - (void)_run{ 86 | _displayLink.paused = NO; 87 | self.statusBarWindow.hidden = NO; 88 | } 89 | 90 | - (void)_stop{ 91 | _displayLink.paused = YES; 92 | self.statusBarWindow.hidden = YES; 93 | } 94 | 95 | #pragma mark - DisplayLink hander 96 | 97 | - (void)envokeDisplayLink:(CADisplayLink *)displayLink{ 98 | if (_lastTimestamp == -1) { 99 | _lastTimestamp = displayLink.timestamp; 100 | return; 101 | } 102 | _countPerFrame ++; 103 | NSTimeInterval interval = displayLink.timestamp - _lastTimestamp; 104 | if (interval < 1) { 105 | return; 106 | } 107 | _lastTimestamp = displayLink.timestamp; 108 | CGFloat fps = _countPerFrame / interval; 109 | _countPerFrame = 0; 110 | self.fpsStatusBar.fpsLabel.text = [NSString stringWithFormat:@"FPS:%d",(int)round(fps)]; 111 | self.fpsStatusBar.fpsLabel.state = [self labelStateWith:LHPerformanceMonitorFPS value:fps]; 112 | 113 | CGFloat memory = [LHPerformanceUtil usedMemoryInMB]; 114 | self.fpsStatusBar.memoryLabel.text = [NSString stringWithFormat:@"Memory:%.2fMB",memory]; 115 | self.fpsStatusBar.memoryLabel.state = [self labelStateWith:LHPerformanceMonitorMemory value:memory]; 116 | 117 | CGFloat cpu = [LHPerformanceUtil cpuUsage]; 118 | self.fpsStatusBar.cpuLabel.text = [NSString stringWithFormat:@"CPU:%.2f%%",cpu]; 119 | self.fpsStatusBar.cpuLabel.state = [self labelStateWith:LHPerformanceMonitorCPU value:cpu]; 120 | } 121 | 122 | #pragma mark - Calculator 123 | 124 | - (LHPerformanceLabelState)labelStateWith:(LHPerformanceMonitorAttributes)attribtue value:(CGFloat)currentValue{ 125 | LHPerformanceConfig * config = [self.configDictionary objectForKey:@(attribtue)]; 126 | if (!config.lessIsBetter) { 127 | if (currentValue > config.goodThreshold) { 128 | return LHPerformanceStateGood; 129 | }else if(currentValue > config.warningThreadhold){ 130 | return LHPerformanceStateWarning; 131 | }else{ 132 | return LHPerformanceStateBad; 133 | } 134 | }else{ 135 | if (currentValue < config.goodThreshold) { 136 | return LHPerformanceStateGood; 137 | }else if(currentValue < config.warningThreadhold){ 138 | return LHPerformanceStateWarning; 139 | }else{ 140 | return LHPerformanceStateBad; 141 | } 142 | } 143 | } 144 | #pragma mark - Notification 145 | 146 | - (void)applicationDidBecomeActiveNotification { 147 | _displayLink.paused = NO; 148 | } 149 | 150 | - (void)applicationWillResignActiveNotification { 151 | _displayLink.paused = YES; 152 | } 153 | 154 | #pragma mark - API 155 | 156 | + (void)run{ 157 | [[LHPerformanceMonitorService sharedService] _run]; 158 | } 159 | 160 | + (void)stop{ 161 | [[LHPerformanceMonitorService sharedService] _stop]; 162 | } 163 | 164 | + (void)setTextColor:(id)textColor forState:(LHPerformanceLabelState)state{ 165 | [[LHPerformanceMonitorService sharedService].fpsStatusBar.subLabels enumerateObjectsUsingBlock:^(LHPerformanceLabel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 166 | [obj setTextColor:textColor forState:state]; 167 | }]; 168 | } 169 | 170 | + (void)setConfig:(LHPerformanceConfig *)config forAttribte:(LHPerformanceMonitorAttributes)attribtue{ 171 | [[LHPerformanceMonitorService sharedService].configDictionary setObject:config forKey:@(attribtue)]; 172 | } 173 | @end 174 | -------------------------------------------------------------------------------- /LHPerformanceStatusBar.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 524DFC821E114A6E0026199B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 524DFC811E114A6E0026199B /* main.m */; }; 11 | 524DFC851E114A6E0026199B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 524DFC841E114A6E0026199B /* AppDelegate.m */; }; 12 | 524DFC881E114A6E0026199B /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 524DFC871E114A6E0026199B /* ViewController.m */; }; 13 | 524DFC8B1E114A6E0026199B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 524DFC891E114A6E0026199B /* Main.storyboard */; }; 14 | 524DFC8D1E114A6E0026199B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 524DFC8C1E114A6E0026199B /* Assets.xcassets */; }; 15 | 524DFC901E114A6E0026199B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 524DFC8E1E114A6E0026199B /* LaunchScreen.storyboard */; }; 16 | 524DFCA11E114BC70026199B /* LHPerformanceLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 524DFC9A1E114BC70026199B /* LHPerformanceLabel.m */; }; 17 | 524DFCA21E114BC70026199B /* LHPerformanceMonitorService.m in Sources */ = {isa = PBXBuildFile; fileRef = 524DFC9C1E114BC70026199B /* LHPerformanceMonitorService.m */; }; 18 | 524DFCA31E114BC70026199B /* LHPerformanceStatusBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 524DFC9E1E114BC70026199B /* LHPerformanceStatusBar.m */; }; 19 | 524DFCA41E114BC70026199B /* LHPerformanceUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 524DFCA01E114BC70026199B /* LHPerformanceUtil.m */; }; 20 | 524DFCA71E114FAF0026199B /* LHPerformanceConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 524DFCA61E114FAF0026199B /* LHPerformanceConfig.m */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | 524DFC7D1E114A6E0026199B /* LHPerformanceStatusBar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LHPerformanceStatusBar.app; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | 524DFC811E114A6E0026199B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 26 | 524DFC831E114A6E0026199B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 27 | 524DFC841E114A6E0026199B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 28 | 524DFC861E114A6E0026199B /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 29 | 524DFC871E114A6E0026199B /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 30 | 524DFC8A1E114A6E0026199B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 31 | 524DFC8C1E114A6E0026199B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 32 | 524DFC8F1E114A6E0026199B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 33 | 524DFC911E114A6E0026199B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | 524DFC991E114BC70026199B /* LHPerformanceLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LHPerformanceLabel.h; sourceTree = ""; }; 35 | 524DFC9A1E114BC70026199B /* LHPerformanceLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LHPerformanceLabel.m; sourceTree = ""; }; 36 | 524DFC9B1E114BC70026199B /* LHPerformanceMonitorService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LHPerformanceMonitorService.h; sourceTree = ""; }; 37 | 524DFC9C1E114BC70026199B /* LHPerformanceMonitorService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LHPerformanceMonitorService.m; sourceTree = ""; }; 38 | 524DFC9D1E114BC70026199B /* LHPerformanceStatusBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LHPerformanceStatusBar.h; sourceTree = ""; }; 39 | 524DFC9E1E114BC70026199B /* LHPerformanceStatusBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LHPerformanceStatusBar.m; sourceTree = ""; }; 40 | 524DFC9F1E114BC70026199B /* LHPerformanceUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LHPerformanceUtil.h; sourceTree = ""; }; 41 | 524DFCA01E114BC70026199B /* LHPerformanceUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LHPerformanceUtil.m; sourceTree = ""; }; 42 | 524DFCA51E114FAF0026199B /* LHPerformanceConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LHPerformanceConfig.h; sourceTree = ""; }; 43 | 524DFCA61E114FAF0026199B /* LHPerformanceConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LHPerformanceConfig.m; sourceTree = ""; }; 44 | 524DFCA81E115B170026199B /* LHPerformanceTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LHPerformanceTypes.h; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 524DFC7A1E114A6E0026199B /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 524DFC741E114A6E0026199B = { 59 | isa = PBXGroup; 60 | children = ( 61 | 524DFC7F1E114A6E0026199B /* LHPerformanceStatusBar */, 62 | 524DFC7E1E114A6E0026199B /* Products */, 63 | ); 64 | sourceTree = ""; 65 | }; 66 | 524DFC7E1E114A6E0026199B /* Products */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 524DFC7D1E114A6E0026199B /* LHPerformanceStatusBar.app */, 70 | ); 71 | name = Products; 72 | sourceTree = ""; 73 | }; 74 | 524DFC7F1E114A6E0026199B /* LHPerformanceStatusBar */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 524DFC981E114BC70026199B /* Classes */, 78 | 524DFC831E114A6E0026199B /* AppDelegate.h */, 79 | 524DFC841E114A6E0026199B /* AppDelegate.m */, 80 | 524DFC861E114A6E0026199B /* ViewController.h */, 81 | 524DFC871E114A6E0026199B /* ViewController.m */, 82 | 524DFC891E114A6E0026199B /* Main.storyboard */, 83 | 524DFC8C1E114A6E0026199B /* Assets.xcassets */, 84 | 524DFC8E1E114A6E0026199B /* LaunchScreen.storyboard */, 85 | 524DFC911E114A6E0026199B /* Info.plist */, 86 | 524DFC801E114A6E0026199B /* Supporting Files */, 87 | ); 88 | path = LHPerformanceStatusBar; 89 | sourceTree = ""; 90 | }; 91 | 524DFC801E114A6E0026199B /* Supporting Files */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 524DFC811E114A6E0026199B /* main.m */, 95 | ); 96 | name = "Supporting Files"; 97 | sourceTree = ""; 98 | }; 99 | 524DFC981E114BC70026199B /* Classes */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 524DFCA81E115B170026199B /* LHPerformanceTypes.h */, 103 | 524DFC9B1E114BC70026199B /* LHPerformanceMonitorService.h */, 104 | 524DFC9C1E114BC70026199B /* LHPerformanceMonitorService.m */, 105 | 524DFCA51E114FAF0026199B /* LHPerformanceConfig.h */, 106 | 524DFCA61E114FAF0026199B /* LHPerformanceConfig.m */, 107 | 524DFC991E114BC70026199B /* LHPerformanceLabel.h */, 108 | 524DFC9A1E114BC70026199B /* LHPerformanceLabel.m */, 109 | 524DFC9D1E114BC70026199B /* LHPerformanceStatusBar.h */, 110 | 524DFC9E1E114BC70026199B /* LHPerformanceStatusBar.m */, 111 | 524DFC9F1E114BC70026199B /* LHPerformanceUtil.h */, 112 | 524DFCA01E114BC70026199B /* LHPerformanceUtil.m */, 113 | ); 114 | path = Classes; 115 | sourceTree = SOURCE_ROOT; 116 | }; 117 | /* End PBXGroup section */ 118 | 119 | /* Begin PBXNativeTarget section */ 120 | 524DFC7C1E114A6E0026199B /* LHPerformanceStatusBar */ = { 121 | isa = PBXNativeTarget; 122 | buildConfigurationList = 524DFC941E114A6E0026199B /* Build configuration list for PBXNativeTarget "LHPerformanceStatusBar" */; 123 | buildPhases = ( 124 | 524DFC791E114A6E0026199B /* Sources */, 125 | 524DFC7A1E114A6E0026199B /* Frameworks */, 126 | 524DFC7B1E114A6E0026199B /* Resources */, 127 | ); 128 | buildRules = ( 129 | ); 130 | dependencies = ( 131 | ); 132 | name = LHPerformanceStatusBar; 133 | productName = LHPerformanceStatusBar; 134 | productReference = 524DFC7D1E114A6E0026199B /* LHPerformanceStatusBar.app */; 135 | productType = "com.apple.product-type.application"; 136 | }; 137 | /* End PBXNativeTarget section */ 138 | 139 | /* Begin PBXProject section */ 140 | 524DFC751E114A6E0026199B /* Project object */ = { 141 | isa = PBXProject; 142 | attributes = { 143 | LastUpgradeCheck = 0820; 144 | ORGANIZATIONNAME = Leo; 145 | TargetAttributes = { 146 | 524DFC7C1E114A6E0026199B = { 147 | CreatedOnToolsVersion = 8.2; 148 | DevelopmentTeam = Q57M6S9CWQ; 149 | ProvisioningStyle = Automatic; 150 | }; 151 | }; 152 | }; 153 | buildConfigurationList = 524DFC781E114A6E0026199B /* Build configuration list for PBXProject "LHPerformanceStatusBar" */; 154 | compatibilityVersion = "Xcode 3.2"; 155 | developmentRegion = English; 156 | hasScannedForEncodings = 0; 157 | knownRegions = ( 158 | en, 159 | Base, 160 | ); 161 | mainGroup = 524DFC741E114A6E0026199B; 162 | productRefGroup = 524DFC7E1E114A6E0026199B /* Products */; 163 | projectDirPath = ""; 164 | projectRoot = ""; 165 | targets = ( 166 | 524DFC7C1E114A6E0026199B /* LHPerformanceStatusBar */, 167 | ); 168 | }; 169 | /* End PBXProject section */ 170 | 171 | /* Begin PBXResourcesBuildPhase section */ 172 | 524DFC7B1E114A6E0026199B /* Resources */ = { 173 | isa = PBXResourcesBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | 524DFC901E114A6E0026199B /* LaunchScreen.storyboard in Resources */, 177 | 524DFC8D1E114A6E0026199B /* Assets.xcassets in Resources */, 178 | 524DFC8B1E114A6E0026199B /* Main.storyboard in Resources */, 179 | ); 180 | runOnlyForDeploymentPostprocessing = 0; 181 | }; 182 | /* End PBXResourcesBuildPhase section */ 183 | 184 | /* Begin PBXSourcesBuildPhase section */ 185 | 524DFC791E114A6E0026199B /* Sources */ = { 186 | isa = PBXSourcesBuildPhase; 187 | buildActionMask = 2147483647; 188 | files = ( 189 | 524DFC881E114A6E0026199B /* ViewController.m in Sources */, 190 | 524DFCA21E114BC70026199B /* LHPerformanceMonitorService.m in Sources */, 191 | 524DFC851E114A6E0026199B /* AppDelegate.m in Sources */, 192 | 524DFCA11E114BC70026199B /* LHPerformanceLabel.m in Sources */, 193 | 524DFCA71E114FAF0026199B /* LHPerformanceConfig.m in Sources */, 194 | 524DFCA41E114BC70026199B /* LHPerformanceUtil.m in Sources */, 195 | 524DFC821E114A6E0026199B /* main.m in Sources */, 196 | 524DFCA31E114BC70026199B /* LHPerformanceStatusBar.m in Sources */, 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | }; 200 | /* End PBXSourcesBuildPhase section */ 201 | 202 | /* Begin PBXVariantGroup section */ 203 | 524DFC891E114A6E0026199B /* Main.storyboard */ = { 204 | isa = PBXVariantGroup; 205 | children = ( 206 | 524DFC8A1E114A6E0026199B /* Base */, 207 | ); 208 | name = Main.storyboard; 209 | sourceTree = ""; 210 | }; 211 | 524DFC8E1E114A6E0026199B /* LaunchScreen.storyboard */ = { 212 | isa = PBXVariantGroup; 213 | children = ( 214 | 524DFC8F1E114A6E0026199B /* Base */, 215 | ); 216 | name = LaunchScreen.storyboard; 217 | sourceTree = ""; 218 | }; 219 | /* End PBXVariantGroup section */ 220 | 221 | /* Begin XCBuildConfiguration section */ 222 | 524DFC921E114A6E0026199B /* Debug */ = { 223 | isa = XCBuildConfiguration; 224 | buildSettings = { 225 | ALWAYS_SEARCH_USER_PATHS = NO; 226 | CLANG_ANALYZER_NONNULL = YES; 227 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 228 | CLANG_CXX_LIBRARY = "libc++"; 229 | CLANG_ENABLE_MODULES = YES; 230 | CLANG_ENABLE_OBJC_ARC = YES; 231 | CLANG_WARN_BOOL_CONVERSION = YES; 232 | CLANG_WARN_CONSTANT_CONVERSION = YES; 233 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 234 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 235 | CLANG_WARN_EMPTY_BODY = YES; 236 | CLANG_WARN_ENUM_CONVERSION = YES; 237 | CLANG_WARN_INFINITE_RECURSION = YES; 238 | CLANG_WARN_INT_CONVERSION = YES; 239 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 240 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 241 | CLANG_WARN_UNREACHABLE_CODE = YES; 242 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 243 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 244 | COPY_PHASE_STRIP = NO; 245 | DEBUG_INFORMATION_FORMAT = dwarf; 246 | ENABLE_STRICT_OBJC_MSGSEND = YES; 247 | ENABLE_TESTABILITY = YES; 248 | GCC_C_LANGUAGE_STANDARD = gnu99; 249 | GCC_DYNAMIC_NO_PIC = NO; 250 | GCC_NO_COMMON_BLOCKS = YES; 251 | GCC_OPTIMIZATION_LEVEL = 0; 252 | GCC_PREPROCESSOR_DEFINITIONS = ( 253 | "DEBUG=1", 254 | "$(inherited)", 255 | ); 256 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 257 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 258 | GCC_WARN_UNDECLARED_SELECTOR = YES; 259 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 260 | GCC_WARN_UNUSED_FUNCTION = YES; 261 | GCC_WARN_UNUSED_VARIABLE = YES; 262 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 263 | MTL_ENABLE_DEBUG_INFO = YES; 264 | ONLY_ACTIVE_ARCH = YES; 265 | SDKROOT = iphoneos; 266 | TARGETED_DEVICE_FAMILY = "1,2"; 267 | }; 268 | name = Debug; 269 | }; 270 | 524DFC931E114A6E0026199B /* Release */ = { 271 | isa = XCBuildConfiguration; 272 | buildSettings = { 273 | ALWAYS_SEARCH_USER_PATHS = NO; 274 | CLANG_ANALYZER_NONNULL = YES; 275 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 276 | CLANG_CXX_LIBRARY = "libc++"; 277 | CLANG_ENABLE_MODULES = YES; 278 | CLANG_ENABLE_OBJC_ARC = YES; 279 | CLANG_WARN_BOOL_CONVERSION = YES; 280 | CLANG_WARN_CONSTANT_CONVERSION = YES; 281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 282 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 283 | CLANG_WARN_EMPTY_BODY = YES; 284 | CLANG_WARN_ENUM_CONVERSION = YES; 285 | CLANG_WARN_INFINITE_RECURSION = YES; 286 | CLANG_WARN_INT_CONVERSION = YES; 287 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 288 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 289 | CLANG_WARN_UNREACHABLE_CODE = YES; 290 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 291 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 292 | COPY_PHASE_STRIP = NO; 293 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 294 | ENABLE_NS_ASSERTIONS = NO; 295 | ENABLE_STRICT_OBJC_MSGSEND = YES; 296 | GCC_C_LANGUAGE_STANDARD = gnu99; 297 | GCC_NO_COMMON_BLOCKS = YES; 298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 300 | GCC_WARN_UNDECLARED_SELECTOR = YES; 301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 302 | GCC_WARN_UNUSED_FUNCTION = YES; 303 | GCC_WARN_UNUSED_VARIABLE = YES; 304 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 305 | MTL_ENABLE_DEBUG_INFO = NO; 306 | SDKROOT = iphoneos; 307 | TARGETED_DEVICE_FAMILY = "1,2"; 308 | VALIDATE_PRODUCT = YES; 309 | }; 310 | name = Release; 311 | }; 312 | 524DFC951E114A6E0026199B /* Debug */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 316 | DEVELOPMENT_TEAM = Q57M6S9CWQ; 317 | INFOPLIST_FILE = LHPerformanceStatusBar/Info.plist; 318 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 319 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 320 | PRODUCT_BUNDLE_IDENTIFIER = Leo.LHPerformanceStatusBar; 321 | PRODUCT_NAME = "$(TARGET_NAME)"; 322 | }; 323 | name = Debug; 324 | }; 325 | 524DFC961E114A6E0026199B /* Release */ = { 326 | isa = XCBuildConfiguration; 327 | buildSettings = { 328 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 329 | DEVELOPMENT_TEAM = Q57M6S9CWQ; 330 | INFOPLIST_FILE = LHPerformanceStatusBar/Info.plist; 331 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 332 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 333 | PRODUCT_BUNDLE_IDENTIFIER = Leo.LHPerformanceStatusBar; 334 | PRODUCT_NAME = "$(TARGET_NAME)"; 335 | }; 336 | name = Release; 337 | }; 338 | /* End XCBuildConfiguration section */ 339 | 340 | /* Begin XCConfigurationList section */ 341 | 524DFC781E114A6E0026199B /* Build configuration list for PBXProject "LHPerformanceStatusBar" */ = { 342 | isa = XCConfigurationList; 343 | buildConfigurations = ( 344 | 524DFC921E114A6E0026199B /* Debug */, 345 | 524DFC931E114A6E0026199B /* Release */, 346 | ); 347 | defaultConfigurationIsVisible = 0; 348 | defaultConfigurationName = Release; 349 | }; 350 | 524DFC941E114A6E0026199B /* Build configuration list for PBXNativeTarget "LHPerformanceStatusBar" */ = { 351 | isa = XCConfigurationList; 352 | buildConfigurations = ( 353 | 524DFC951E114A6E0026199B /* Debug */, 354 | 524DFC961E114A6E0026199B /* Release */, 355 | ); 356 | defaultConfigurationIsVisible = 0; 357 | defaultConfigurationName = Release; 358 | }; 359 | /* End XCConfigurationList section */ 360 | }; 361 | rootObject = 524DFC751E114A6E0026199B /* Project object */; 362 | } 363 | --------------------------------------------------------------------------------