Sun Studio 12 Update 1: Debugging a Program With dbx

Determining the Number of Instructions Executed by a Source Line

To count how many instructions a line of code executes, type:

(dbx) ...                        # get to the line in question
(dbx) stop step -instr -count infinity
(dbx) step ...
(dbx) status
(3) stop step -count 48/infinity # 48 instructions were executed

If the line you are stepping over makes a function call, the lines in the function are counted as well. You can use the next event instead of step to count instructions, excluding called functions.