Measuring time for execution of commands.

Hi All,
I want to measure time taken by a command to execute. Or time taken by a
group of commands to execute. Can anyone suggest a GOOD way to do this?
I am doing LXRT programming right now. The way I am doing this is
following:
----------------start---------------
start_time = rt_get_cpu_time_ns();
//command or group of commands
end_time = rt_get_cpu_time_ns();
difference[i] = end_time - start_time;
-----------------end----------------
But I am skeptical about the working. Because if I put this command
group in a loop, I get varying time differences.

Any help is appreciated.
Thank you,
Ajit

Received on 2004-04-15Z00:50:11