• Michael Hanselmann's avatar
    Add lock performance utility · e4d452b4
    Michael Hanselmann authored
    
    
    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: default avatarMichael Hanselmann <hansmi@google.com>
    Reviewed-by: default avatarIustin Pop <iustin@google.com>
    e4d452b4
lockperf.py 3.53 KB