This question already has an answer here:
iphone: what libraries or APIs need to be used for CPU , RAM usage in iPhone
(1 answer)
Closed 8 years ago.
I would like to see what my app is doing with system resource while users are using it. Ideally on the view I can print real time CPU and Ram stats and then have the user report back to me the max or min etc.. of these values. My feeling is that this will help us test the nuances of some advanced UI things.
Any ideas on how to make this happen?
Thanks in advance
I don't think there is a way to get that information about your App from the iPhone SDK. It shows you this info in Instruments but that won't be available on your App.
Related
This question already has answers here:
Is there any way to detect iOS 9 low power mode programmatically?
(4 answers)
Closed 7 years ago.
I need to get low power mode status, weather low power mode is on or off alert in my app when iPhone change its power mode.
Please help me by getting the solution.
Thank you
There are two ways for that.
You can register for Power State Notifications.
[NSNotificationCenter defaultCenter] addObserver:self selector: #selector(yourMethodName:) name:NSProcessInfoPowerStateDidChangeNotification object: nil];
Or you can determine the current state.
[[NSProcessInfo processInfo] isLowPowerModeEnabled]
The best thing what i think its really great for user experience point of view as per the Apple documentation is: Your app should take additional steps to help the system save energy when Low Power Mode is active. For example, your app could reduce the use of animations, lower frame rates, stop location updates, disable syncs and backups, and so on
I know there is already an answer for this (as per the comment dandan78) with links only no description, so posting bcoz it will be good if we have something here as well.
Hoping someone can confirm or refute the fact that it appears that achievements don't show when they are achieved. When run on an iOS 6 device the achievement shows up but when run on the iOS 7 it doesn't show up.
Using showsCompletionBanner set to YES. https://developer.apple.com/library/ios/documentation/GameKit/Reference/GKAchievement_Ref/Reference/Reference.html#//apple_ref/occ/instp/GKAchievement/showsCompletionBanner
Atm I assume it's a bug in iOS7 and it will be fixed (who knows) so I'm not touching any code.
So with this question having no real answer for some time.
In the end, completion banners really do show in live apps, I guess, most of the time... eventually. While developing they don't seem to appear a lot of the times though but this should not affect the live version. I guess for various reasons a lot of these network related features don't always work 100% on sandbox servers, be it Game Center, or IAP related. This is my experience working a few years on iOS apps (above 60) anyway. I haven't done a lot of iCloud enabled apps so can't answer for that.
Of course, I haven't been doing GC achievements lately (like in the last month) so it is possible that responsiveness is better now for sandbox also.
I can only partially confirm that:
achievements obtained in iOS 7 do show up in Game Center (on the same iOS 7 device);
achievements obtained in iOS 6 do show up in Game Center (on the same iOS 6 device);
however, achievements obtained on an iOS 6 device DON'T show up in Game Center on an iOS 7 device (and vice versa), even though they're logged in with the same user.
It's like iOS 6 and iOS 7 use different repositories and are not synchronized.
This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
iphone: Calculating battery life
I would like to know if its possible to calculate the battery lifetime on iOS. So, for how much time I can use my device until it is 0% of battery percentage.
Thank you all! :)
In short, you can't. At least not with any accuracy.
Or, really, you can't unless the user is going to continue doing exactly what they are doing right now without any changes in network, signal strength, ambient light, etc... As well, receiving push notifications and/or taking phone calls can impact battery life. So can media playback, including -- even -- the encoding format used within the media.
I want to read how much data from 3G every app uses. Is this is possible in iOS 5.x ? And in iOS 4.x? My goal is for example:
Maps consumed 3 MB from your data plan
Mail consumed 420 kB from your data plan
etc, etc. Is this possible?
EDIT:
I just found app doing that: Data Man Pro
EDIT 2:
I'm starting a bounty. Extra points goes to the answer that make this clear. I know it is possible (screen from Data Man Pro) and i'm sure the solution is limited. But what is the solution and how to implement this.
These are just hints not a solution. I thought about this many times, but never really started implementing the whole thing.
first of all, you can calculate transferred bytes querying network interfaces, take a look to this SO answer for code and a nice explanation about network interfaces on iOS;
use sysctl or similar system functions to detect which apps are currently running (and for running I mean the process state is set to RUNNING, like the ps or top commands do on OSX. Never tried I just suppose this to be possible on iOS, hoping there are no problems with app running as unprivileged user) so you can deduce which apps are running and save the traffic stats for those apps. Obviously, given the possibility to have applications runnning in background it is hard to determine which app is transferring data.
It also could be possible to retrieve informations about network activity per process/app like nettop does on OSX Lion, unfortunately nettop uses the private framework NetworkStatistics.framework so you can't dig something out it's implementation;
take into account time;
My 2 cents
No, all applications in iOS are sandboxed, meaning you cannot access anything outside of the application. I do not believe this is possible. Neither do I believe data-traffic is saved on this level on the device, hence apple would have implemented it in either the network page or the usage page in Settings.app.
Besides that, not everybody has a "data-plan". E.g. in Sweden its common that data-traffic is free of charge without limit in either size or speed.
I am looking for an API to monitor the tasks running on a plain iPhone (no jailbreak). Those are about:
look for CPU usage (my main concern).
look for memory usage.
look for disk usage (how many read/write)
look for network usage (how many bytes sent and received by network: 3G, Wifi, GSM).
is it possible to rely on the IOS simulator running on a Mac (or should I test my application directly on the device)?
I think I can look into the system C libraries (sigint, etc.) but I am not sure to be able to retrieve this information except for the current applications running. I know some monitor applications run on the global usage but I would like to be able to find the information process by process.
If someone can provide some links or something useful, I will start a deeper investigation then.
CPU usage can be found by looking at the code from this related question:
iOS - Get CPU usage from application
Memory usage:
Available memory for iPhone OS app
And here are a couple threads that talk about how to find out about the applications or tasks currently running:
Can we retrieve the applications currently running in iPhone and iPad
How to get information about free memory and running processes in an App Store approved app? (Yes, there is one!)
How to get the active processes running in iOS
The answers to these questions may point you in the direction you'd like to head towards.
Good luck!
The Activity Monitor should get you what you're looking for. You should be able to observe RAM, CPU, and VRAM usage for each iOS process. This is a default tool installed with xCode. Very handy.