Is there a useful command line profiling tool in OS X?

I want to use something like gprof to profile C / C ++ programs on the command line. But, unfortunately, gprof for some reason does not work on OS X (this is a known issue).

When I search for this topic on the Internet, almost everyone recommends Instructions.app. Since my workflow is completely in the command line environment, I really don't want to switch to the GUI just for some profiling.

So, is there currently a useful gprof alternative for OS X that is purely a command line?

Change More specifically, I want to use a tool to analyze the execution time of each function in my program to find out the hot spots.

+5
source share
1 answer

Here is a tool command line tool tool: instruments . Typically, you will want to use Tools.app to view the resulting trace.

In addition, there are many different tools. There sample for simple temporary profiling. There is a spindump . There DTrace and a whole set of ready-made tools based on DTrace. (See man -k dtrace for a list.)

You need to be more specific about what exactly you hope to research about your programs in order to get a more specific offer.

+2
source

All Articles