I need the "perf" utility to monitor the program on my Mac. I know linux comes with it, but is it available on Mac?
I am working on a OSX 10.9 Mavericks and tried "port search" for perf or linux-tools, but I couldn't get any results.
Perf is a powerful Linux tool - it can instrument CPU performance and is capable of lightweight profiling. You can get more context about what perf can do here. It is usually included in the Linux kernel, but there's no way install it on a Mac.
As @Sami Laine said in his comment, the Linux perf
tool is dependent on Linux specific code. It relies on the perf_event_open system call which is not standardized.
Note: Maybe you could search how MacOSX users are using recent hardware performance counters.
On macOS you can use the Instruments application to profile your code.
I like to use the "Time Profiler" which will show you how much time your application is its various parts during execution. I haven't used perf myself, but from talks/videos that I've seen this seems to be the most common use.
To use the "Time Profiler":
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With