[openib-general] Re: Re: Userspace testing results (many kernels, many svn trees)

Michael S. Tsirkin mst at mellanox.co.il
Tue Jan 24 10:54:38 PST 2006


Quoting r. Nishanth Aravamudan <nacc at us.ibm.com>:
> Subject: Re: [openib-general] Re: Re: Userspace testing results (many kernels,many svn trees)
> 
> On 24.01.2006 [01:44:42 +0200], Michael S. Tsirkin wrote:
> > Quoting r. Nishanth Aravamudan <nacc at us.ibm.com>:
> > > > I have just uploaded a simple utility which I called clock_test which
> > > > measures a clock once a second: this way you'll know whether mtfb 
> > > > is measuring time properly.
> > > 
> > > Will it get built by running make in the perftest directory?
> > Yes.
> > 
> > > Any special usage I should know about?
> > 
> > Look at its source, you'll see.
> > 
> > You just run it for a while and it will print out the time
> > tkaen from mtfb each second.
> > Kill it with CRTL-C.
> 
> With 5169, I get:
> 
> 1 sec = 5.37731e+14 usec
> 1 sec = 5.37451e+14 usec
> 1 sec = 5.3748e+14 usec
> 1 sec = 5.37495e+14 usec
> 1 sec = 5.37483e+14 usec
> 1 sec = 5.37493e+14 usec
> 1 sec = 5.37495e+14 usec
> 1 sec = 5.37495e+14 usec
> 1 sec = 5.37493e+14 usec
> 1 sec = 5.37492e+14 usec
> 1 sec = 5.37495e+14 usec
> 1 sec = 5.37494e+14 usec
> 
> Thanks,
> Nish
> 

Hmm. First, try updating to 5174 and run clock_test.
Second, what about this patch:

Index: get_clock.h
===================================================================
--- get_clock.h	(revision 5171)
+++ get_clock.h	(working copy)
@@ -47,8 +47,7 @@ static inline cycles_t get_cycles()
 	val = (val << 32) | low;
 	return val;
 }
-#elif defined(__PPC__) || defined(__PPC64__)
-/* Note: only PPC CPUs which have mftb instruction are supported. */
+#elif defined(__PPC64__)
 /* PPC64 has mftb */
 typedef unsigned long cycles_t;
 static inline cycles_t get_cycles()
@@ -58,6 +57,16 @@ static inline cycles_t get_cycles()
 	asm volatile ("mftb %0" : "=r" (ret) : );
 	return ret;
 }
+#elif defined(__PPC__)
+/* Note: only PPC CPUs which have mftb instruction are supported. */
+typedef unsigned long cycles_t;
+static inline cycles_t get_cycles()
+{
+	cycles_t ret;
+
+	asm volatile ("mftb %0, 268" : "=r" (ret) : );
+	return ret;
+}
 #elif defined(__ia64__)
 /* Itanium2 and up has ar.itc (Itanium1 has errata) */
 typedef unsigned long cycles_t;

-- 
MST



More information about the general mailing list