0

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.

dkoch
  • 474
  • 1
  • 3
  • 15

1 Answers1

2

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.

Community
  • 1
  • 1
Dietrich Epp
  • 205,541
  • 37
  • 345
  • 415