On Mon, 18 Mar 2002, David S. Miller wrote:
> From: Cort Dougan <cort@fsmlabs.com>
> Date: Mon, 18 Mar 2002 17:36:35 -0700
>
> The structure of the program you suggested with more portable timing.
>
> Oh, just something like:
>
>
> gettimeofday(&stamp1);
> for (A MILLION TIMES) {
> TLB miss;
> }
> gettimeofday(&stamp2);
This make the measure stable on my machine :
#define rdtsc(low) \
__asm__ __volatile__("rdtsc" : "=A" (low) : )
unsigned long long start, end;
rdtsc(start);
access(buffer[i]);
rdtsc(end);
processor : 0
vendor_id : AuthenticAMD
cpu family : 6
model : 4
model name : AMD Athlon(tm) Processor
stepping : 2
cpu MHz : 999.561
cache size : 256 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov
pat pse36 mmx fxsr syscall mmxext 3dnowext 3dnow
bogomips : 1992.29
$ gcc -o tlb_test tlb_test.c
#APP
rdtsc
#NO_APP
movl %eax, -24(%ebp)
movl %edx, -20(%ebp)
movl -4(%ebp), %eax
addl -12(%ebp), %eax
movl (%eax), %eax
#APP
rdtsc
11.89: 18
4.70: 20
81.90: 23
$ gcc -O2 -o tlb_test tlb_test.c
#APP
rdtsc
#NO_APP
movl %edx, -28(%ebp)
movl -24(%ebp), %edx
movl %eax, -32(%ebp)
movl (%esi,%edx), %ecx
#APP
rdtsc
#NO_APP
87.70: 20
11.24: 25
- Davide
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Mar 23 2002 - 22:00:17 EST