English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i have to calculate the time difference in microsoconds for a particular operation, say for calling a function, how do i do with.
it is better if you list some functions related to this

2006-11-05 17:21:40 · 4 answers · asked by *yPrabin 2 in Computers & Internet Programming & Design

4 answers

Go to download.com and type in unit converter professional. This is a free program and its fantastic for converting anything, and so simple

2006-11-05 17:35:57 · answer #1 · answered by ann.inspain 4 · 0 1

FOR UNIX ONLY::::::::::
SYNOPSIS
#include
int gettimeofday(struct timeval *restrict tp, void *restrict tzp);
DESCRIPTION

The gettimeofday() function shall obtain the current time, expressed as seconds and microseconds since the Epoch, and store it in the timeval structure pointed to by tp. The resolution of the system clock is unspecified.

If tzp is not a null pointer, the behavior is unspecified.

2006-11-05 17:54:19 · answer #2 · answered by Rajesh G 2 · 0 0

in time.h, that functions r defined. go and get knw abt those function.

Return number of clock ticks since process start.
Returns the number of clock ticks elapsed.
A macro constant called CLK_TCK defines the relation betwen clock tick and second (clock ticks per second).

Parameters.

(none)
Return Value.
The number of clock ticks elapsed since start.
clock_t type is defined by default as long int by most compilers.

Portability.
Defined in ANSI-C.


Example.


/* clock example: countdown */
#include
#include

void wait ( int seconds )
{
clock_t endwait;
endwait = clock () + seconds * CLK_TCK ;
while (clock() < endwait) {}
}

int main ()
{
int n;
printf ("Starting countdown...\n");
for (n=10; n>0; n--)
{
printf ("%d\n",n);
wait (1);
}
printf ("FIRE!!!\n");
return 0;
}

2006-11-05 17:40:06 · answer #3 · answered by nataraajc 2 · 1 0

I doubt if you can do it in microseconds. Till my information, only in kernel level you can do at microsecond level. In application level only available is upto seconds.

2006-11-05 18:30:57 · answer #4 · answered by manoj Ransing 3 · 0 1

fedest.com, questions and answers