Process execution time

How do we calculate the process exeution time in QNX4?

You could use the time command.

ex. time ls -l /usr/bin

This will give you the total time as well as the time that the program was
waiting on the CPU. Quite useful in debugging.

LMK

“radha krishnan” <radha.nk@geind.ge.com> wrote in message
news:d09ueu$ms5$1@inn.qnx.com

How do we calculate the process exeution time in QNX4?

radha krishnan wrote:


How do we calculate the process exeution time in QNX4?

what does real user and system meanby while using time utility.

Is there a API which helps to find out process execution time, running in
background every 10ms say,

IIRC the real user time is the actual time the program took to execute
whereas the system time is the time the program was using the CPU. This is
most useful when the program prompts the user for a response.

As for a background process that runs in ms I don’t know of any off hand.

LMK

“radha krishnan” <radha.nk@geind.ge.com> wrote in message
news:d0jges$qgt$1@inn.qnx.com

radha krishnan wrote:


How do we calculate the process exeution time in QNX4?



what does real user and system meanby while using time utility.

Is there a API which helps to find out process execution time, running in
background every 10ms say,


\

If you are running on a Pentium, and if you can instrument the source
code of your process, you can measure the elapsed real time of any
code sequence using the Pentium time stamp counter register. The
Pentium time stamp counter is a 64-bit internal, free-running conter
that counts every cpu clock cycle from the time the cpu starts
running.

Here is sample code to do this:

/------------------------------------------------------------------------------
In-line assembly code for execution timing: tsc_start reads the
Pentium Time
Stamp Counter and stores the 62-bit value in tsc_Lo and tsc_Hi.
tsc_diff
reads the Pentium Time Stamp Counter, subtracts tsc_Lo,tsc_Hi from the
new
count value and stores the difference in tsc_Diff_Lo and tsc_Diff_Hi.
-----------------------------------------------------------------------------
/
static unsigned long int tsc_Lo; /* Time Stamp Counter starting
value /
static unsigned long int tsc_Hi; /
Time Stamp Counter starting
value /
static unsigned long int tsc_Diff_Lo; /
Time Stamp Counter
difference /
static unsigned long int tsc_Diff_Hi; /
Time Stamp Counter
difference */

extern void
tsc_start( void );
#pragma aux tsc_start =
“db 0xf, 0x31”
“mov tsc_Hi, edx”
“mov tsc_Lo, eax”
modify [edx eax];

extern void
tsc_diff( void );
#pragma aux tsc_diff =
“db 0xf, 0x31”
“sub eax, tsc_Lo”
“sbb edx, tsc_Hi”
“mov tsc_Diff_Hi, edx”
“mov tsc_Diff_Lo, eax”
modify [edx eax];


/* debug / tsc_start();


/
debug / tsc_diff();
printf( "cpu counts: (2**32)
%d+%d\n",
tsc_Diff_Hi, tsc_Diff_Lo );


The strange format of the output is because the counter value is 64
bits long. This gives you elapsed time in cpu clock cycles (real
time, not just the time that your program is actually the running
process). Divide the count by the cpu clock frequency in MHz to get
the elapsed time in microseconds.

Regards,
Bill Ghrist