Mail Archives: djgpp/2002/04/24/00:45:23
On Wed, 24 Apr 2002, Alex Vinokur wrote:
> | > So, what is alternative ?
> | > * rusage ? Does it work ?
> | > * something else ?
> |
> | It depends on what are you trying to accomplish. Can you tell some
> | more details?
>
> For instance, something like (pseudo-code) :
>
>
> void foo ()
> {
> start_time = some-get-time-function();
> // stuff
> end_time = some-get-time-function();
> assert (start_time <= end_time);
> cout << (end_time - start_time) << endl;
> }
>
> int main ()
> {
> for (int i = 0; i < TOTAL-ITERATIONS; i++)
> {
> foo ();
> }
> }
Yes, but what is this for? This is a toy program; I was interested to
hear about some real-life application which needs that.
The important question is: can you settle for the basic 54-msec
resolution of the standard PC clock? If you can, use `clock' (or
compile with -pg and use Gprof); if not, you will have to write some
inline assembly using the RDTSC (sp?) instruction. (I think someone
posted such assembly here some time ago, so searching the DJGPP archives
might find it.)
- Raw text -