Software Archive
Read-only legacy content
17061 Discussions

Time-stamp counter on IA-64

vsiu
Beginner
1,099 Views

Hi,

There is rdtsc to read processor time-stamp counter on x64. Could someone tell me how to read time-stamp counter on IA-64 platform.

Thanks,

Victor

0 Kudos
5 Replies
TimP
Honored Contributor III
1,099 Views
        unsigned long result;
/* gcc-IA64 version */
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");
while (__builtin_expect ((int) result == -1, 0))
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) ::
"memory");
return result;

Not tested on any current IA-64 platform.
If you use Microsoft or Intel C++, simply use the __rdtsc() built-in.

There is no guarantee of consistent results among nodes of a NUMA platform.
0 Kudos
vsiu
Beginner
1,099 Views

I used Microsoft Visual Studio .NET 2003 compiler and linker to build a UEFI driver. The link failed because of

unresolved external symbol .__rdtsc referenced in function ....

I have searched on web on rdtsc support with IA64 platform before I submitted my original request. What I have found was that there is a AR44 register on IA64 to replace rdtsc call to read the time-stamp count. Is that the case? If so, could you give me a sample code to access that register.

Thanks a lot,

Victor

0 Kudos
vsiu
Beginner
1,099 Views

Hi,

I forgot to mention, I have a #pragma statement

#pragma intrinsic(__rdtsc)

and my calling function is

ts_expire = __rdtsc() + (u64_t)(cnt) * cycle_per_us;

and this leads to the unresolved external symbol .__rdtsc.

Thanks,

Victor

0 Kudos
TimP
Honored Contributor III
1,099 Views
You would find MSVC equivalents of the gcc code I posted, if you did a web search. Did they fail you? e.g.
http://www.sfr-fresh.com/unix/privat/iometer-2008-06-22-rc1.tgz:a/iometer-2008-06-22-rc1/src/IOTime.cpp

You didn't say in the original post which compiler or OS you wanted to use, nor have I tried this on Windows.
0 Kudos
TimP
Honored Contributor III
1,099 Views
I don't have a Windows installation on IA64; Microsoft announced they would no longer support technical applications on IA64 when AMD64 development began. Did you try suggestions on the web, such as
http://www.sfr-fresh.com/unix/privat/iometer-2008-06-22-rc1.tgz:a/iometer-2008-06-22-rc1/src/IOTime.cpp
0 Kudos
Reply