Reputation: 474
I need to start a external program and wait until it ends. After it was running I nead peak memory usage and CPU time oder CPU tiks.
How can I do this in C / Objective-C on OSX 10.11?
I looked at NSTask, but I have no idea how to get peak memory usage and CPU time.
Upvotes: 0
Views: 710
Reputation: 213338
You can get the PID by calling -processIdentifier
and then use Mach's task_info()
function to get the information you seek. See: Memory used by a process under mac os x
I believe task info should be available until the process is waited, so just be sure to do that after the process finishes.
Upvotes: 2