amd64 port: mainly on the pmap headers, identify_cpu and initcpu
[dragonfly/port-amd64.git] / test / cpuperf / cputest.c
blobeed20ac284aa62241bba96060d36b2147d01ff16
1 /*
2 * cputest.c
4 * WARNING! Always test on a 100% idle system. Note that some tests
5 * may return 0 or negative results, due to pipeline effects.
7 * $DragonFly: src/test/cpuperf/cputest.c,v 1.1 2004/02/09 18:08:54 dillon Exp $
8 */
10 #include "blib.h"
12 extern char test_str[];
14 int junk;
16 int
17 main(int ac, char **av)
19 int i;
20 int ttl;
21 int us1;
22 int us2;
24 printf("CPUTEST %s\n", test_str);
25 start_timing();
26 for (i = 0; ; ++i) {
27 test_load(&junk);
28 if ((i & 65535) == 0 && get_timing() > 1000000)
29 break;
31 ttl = i * 4;
32 start_timing();
33 for (i = 0; i < ttl; ++i) {
34 test_dummy(&junk);
36 us1 = get_timing();
37 start_timing();
38 for (i = 0; i < ttl; ++i) {
39 test_load(&junk);
41 us2 = get_timing();
42 stop_timing2(ttl, us2 - us1, "instruction overhead:");
43 return(0);