4 * $DragonFly: src/test/sysperf/mutex2.c,v 1.2 2006/04/22 22:32:52 dillon Exp $
12 main(int ac, char **av)
20 printf("Test simple locked bus cycle mutex latency\n");
21 printf("auto-forks two processes for the test with shared memory\n");
22 printf("This test is only useful on a SMP box\n");
25 mtx = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANON, -1, 0);
27 while (stop_timing(0, NULL) == 0) {
28 for (j = 0; j < 100; ++j) {
38 for (count = 0; count < max; count += 100) {
39 for (j = 0; j < 100; ++j) {
41 rel_mtx(); /* release */
45 stop_timing(count, "complex_mtx(uncontested/1cpu)");
47 if ((pid = fork()) == 0) {
49 for (j = 0; j < 100; ++j) {
51 rel_mtx(); /* release */
57 for (count = 0; count < max; count += 100) {
58 for (j = 0; j < 100; ++j) {
60 rel_mtx(); /* release */
64 stop_timing(count, "complex_mtx");
65 printf("proc1=%d proc2=%d\n", counter[64], counter[128]);