Darwin offers several tools for measuring the CPU usage. These are
especially convenient when attempting to optimize your code and make
projections about the necessary time required to complete a long
computation. Programs written in Darwin code can sometime run much
slower than written in another language such as C.
Unfortunately, writing programs in C can be a non-trivial
exercise. This trade-off leads to questions about when Darwin code
will suffice for the task at hand and when another language must be
used. Measuring the performance of your Darwin prototypes is a
necessary step towards resolving this issue.
Chapter
contains a working example of how to go about this. This section
explores some of the primitive functions Darwin offers.