Add lock performance utility
authorMichael Hanselmann <hansmi@google.com>
Thu, 22 Dec 2011 13:16:57 +0000 (14:16 +0100)
committerMichael Hanselmann <hansmi@google.com>
Thu, 22 Dec 2011 13:25:40 +0000 (14:25 +0100)
commite4d452b4f896b0b7eb87dae696fdf0796e481525
treee5b095a89c2874f2056c3533ca5fba68e6e45bab
parenteea3b5723dc62fa06942cde174e7462b31a78ae1
Add lock performance utility

I had an idea for improving locking performance. To see if it worked I
wrote this tool. Unfortunately the idea didn't quite work (broke
unittests left and right), but the tool is still handy for evaluating
future changes to the “SharedLock” class.

It is not installed or run at build/test time. In its current form it is
intended for manual use. Example output:

---
Total number of acquisitions: 32642
Per-thread acquisitions:
  Thread 0: 6536 (20.0%)
  Thread 1: 6488 (19.9%)
  Thread 2: 6536 (20.0%)
  Thread 3: 6529 (20.0%)
  Thread 4: 6553 (20.1%)
Benchmark CPU time: 5.010s
Average time per lock acquisition: 0.15348ms
Process:
  User time: 4.160s
  System time: 1.030s
  Total time: 5.190s
---

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Makefile.am
test/lockperf.py [new file with mode: 0755]