6

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.

William R
  • 185
  • 1
  • 10

2 Answers2

5

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!

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • 1
    Thank you for your reply. I looked at the links and pushed the code into my application. It confirms what I was pretty sure: there is no way to have _detailed_ information about the programs. I can retrieve the process names and priority but not their CPU usage (at least for a normal iPhone). For the current task, I can get some detailed information, sure I can do this globally too (how many memory still there) but not process by process. I suppose this is related to the _sandbox_ application space and to avoid to spy the performances of the other applications. – William R Mar 28 '12 at 13:16
  • before I attempt to answer your question further, is this for an in-house app, a jailbroken app, or an app you want to sell on the app store? – Michael Dautermann Mar 29 '12 at 21:00
  • As explained, it is for a non-jailbroken iPhone. And, at the end for an In-House application (not be sold in the App Store). – William R Mar 30 '12 at 11:05
  • Even not answering my question, this response is very complete. As I tested and understood, the applications are sandboxed and then it is not possible to observe the CPU usage of other applications running on the iPhone. – William R Apr 11 '12 at 11:41
0

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.

Colin Godsey
  • 1,293
  • 9
  • 14
  • Sure. But my question was: how to get this stuff inside an iPhone application (watching for other applications running on the same device). – William R Apr 05 '12 at 10:07