Fixed paths, because mr Alex "Big Mouth" Perez was unable to get them right
[wmaker-crm.git] / wrlib / bench.h
blobda1ac504fbcffca603251d0128df67e3705d25a5
4 inline static void
5 cycle_bench(int start)
7 static volatile unsigned int start_cycle;
9 if (start) {
10 asm volatile
11 ("pushl %%edx \n\t"
12 "rdtsc \n\t"
13 "movl %%eax,%0 \n\t"
14 "cld \n\t"
15 "popl %%edx \n\t"
16 "nop \n\t"
17 "nop \n\t"
18 "nop \n\t"
19 "nop \n\t"
20 "nop \n\t"
21 "nop \n\t"
22 "nop \n\t"
23 "nop \n\t"
24 : "=m" (start_cycle) : : "eax", "edx");
25 } else {
26 volatile int end;
28 asm volatile
29 ("pushl %%edx \n\t"
30 "clc \n\t"
31 "rdtsc \n\t"
32 "movl %%eax, %0 \n\t"
33 "popl %%edx \n\t"
34 : "=m" (end) : : "eax", "edx");
36 printf("Cycle count = %u\n", end - start_cycle - 68);
42 #if 0
43 // seems linux doesnt allow user progs to exec rdpcm..
44 inline static void
45 cache_bench(int start)
47 static int start_cycle;
49 if (start) {
50 asm volatile
51 ("movl $1,%%ecx \n\t"
52 "rdpmc \n\t"
53 "movl %%eax,%0 \n\t"
54 : "=m" (start_cycle));
55 } else {
56 int end;
58 asm volatile
59 ("movl $1,%%ecx \n\t"
60 "rdpmc \n\t"
61 "movl %%eax,%0"
62 : "=m" (end));
64 printf("Cache reloads counted = %i\n", end - start_cycle);
68 #endif