Using time.h in EDK

Mar 02, 2006 1 Replies

Hi,



I'm trying to measure program execution time in Platform Studio. I use two clock() functions from time.h before and after the code section I want to take the measurement. When I compiled the program, I received the following errors:



/cygdrive/c/EDK/gnu/powerpc-eabi/nt/bin/../lib/gcc/powerpc-eabi/3.4.1/../../../../powerpc-eabi/lib/libc.a(timer.o)(.text+0x10): In function `_times_r': /cygdrive/x/gnu_builds/halite/env/Jobs/MDT/sw/nt/gnu1/ppc_newlib_src/newlib/libc/reent/timer.c:64: undefined reference to `times' /cygdrive/c/EDK/gnu/powerpc-eabi/nt/bin/../lib/gcc/powerpc-eabi/3.4.1/../../../../powerpc-eabi/lib/libc.a(timer.o)(.text+0x68): In function `_gettimeofday_r': /cygdrive/x/gnu_builds/halite/env/Jobs/MDT/sw/nt/gnu1/ppc_newlib_src/newlib/libc/reent/timer.c:108: undefined reference to `gettimeofday' collect2: ld returned 1 exit status



Does anyone know what's wrong? Thanks plenty!


-Eric



EDK does not map the clock() function to the timers that are present in your system. Instead, you might want to use the XTime_GetTime() function that gives you access to the PowerPC Time Stamp Counter. This counter is incrememnted once on every clock tick, so it can give you the exact # of cycles for the function.

/Siva

Eric wrote:

/cygdrive/c/EDK/gnu/powerpc-eabi/nt/bin/../lib/gcc/powerpc-eabi/3.4.1/../../../../powerpc-eabi/lib/libc.a(timer.o)(.text+0x10):

/cygdrive/x/gnu_builds/halite/env/Jobs/MDT/sw/nt/gnu1/ppc_newlib_src/newlib/libc/reent/timer.c:64:

/cygdrive/c/EDK/gnu/powerpc-eabi/nt/bin/../lib/gcc/powerpc-eabi/3.4.1/../../../../powerpc-eabi/lib/libc.a(timer.o)(.text+0x68):

/cygdrive/x/gnu_builds/halite/env/Jobs/MDT/sw/nt/gnu1/ppc_newlib_src/newlib/libc/reent/timer.c:108:

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required