lock_test: output results to a file

Also tracks the number of loops performed.  Once one thread finishes,
the test is done.  On a VM with a small number of loops, some threads
won't perform any loops - in which case you're not really contending for
the lock.
Various userspace Linux compat hacks

I'd like to build some of the tests for Linux without a lot of fuss.  We
can do it for pthread_test already.  Lock_test is next.

There are a variety of hacks for compatability all over the place: the
TSC stuff, a OS-independent parts of benchutil (measure.c), and more
coming soon.  If we're going to make microbenchmarks that mostly work on
both, then we should consolidate these hacks a bit.
User spinlock speedups

Test, then test-and-set avoids everyone writing EBUSY to the cacheline
when it is already locked.  This cuts down on cache line contention.
Ports lock_test to Linux

Build from your AKAROS_ROOT directory with:

$ gcc -O2 -std=gnu99 -fno-stack-protector -g tests/lock_test.c \
  -lpthread -lm -o linux_lock_test

Linux only has the spin and mcs/mcscas available, so the others are
stubs.  It will attempt to pin the worker threads to physical cores
0..n.  If you do your own tasksetting after the program is running, you
can override that.  That might be useful if you want to fake preemption.

The ugliest thing is #including the lock source code in a .h file.
Doing it with measure.c is only slightly less nastry.  Maybe we can get
some linux make targets or something, and put this compat stuff in one
place.
Helpful program, added by popular request

If you want to make your own, use jp2a, cut and paste into vi, and add
the printf(" and \n"); from block mode.