Re: [Linux-ia64] Performance Monitor Internals:

From: David Mosberger <davidm_at_hpl.hp.com>
Date: 2000-11-10 02:56:23
>>>>> On Thu, 9 Nov 2000 10:40:32 -0500, "Ross Ridge" <ross@sitraka.com> said:

  Ross> I'm also interested in using the performance monitor, but my
  Ross> only concern is if user processes will able to access the
  Ross> performance counters directly with a "mov 1,PMD[r2]"
  Ross> instruction, instead of having to use some sort of kernel
  Ross> service to access the counter.  Essentially, all I'm looking
  Ross> for is a replacement for the IA-32's "RDTSC" instruction in
  Ross> the code I'm porting.

You can use the attached code.

	--david

static __inline__ unsigned long
ia64_get_itc (void)
{
	unsigned long result;

	__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;
}
Received on Thu Nov 09 07:56:37 2000

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:00 EST