diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2014-03-24 18:54:20 +0000 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2014-03-24 18:54:20 +0000 |
| commit | d23118c3b20c09c073cf3dab8a93382519bf513c (patch) | |
| tree | 8449d4c36a77b7cebfb1cab998a79960959d576b /compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc | |
| parent | f49921ba53a4526c1f47a1de6529b4f6f15136a6 (diff) | |
| download | bcm5719-llvm-d23118c3b20c09c073cf3dab8a93382519bf513c.tar.gz bcm5719-llvm-d23118c3b20c09c073cf3dab8a93382519bf513c.zip | |
tsan: optimize vector clock operations
Make vector clock operations O(1) for several important classes of use cases.
See comments for details.
Below are stats from a large server app, 77% of all clock operations are handled as O(1).
Clock acquire : 25983645
empty clock : 6288080
fast from release-store : 14917504
contains my tid : 4515743
repeated (fast) : 2141428
full (slow) : 2636633
acquired something : 1426863
Clock release : 2544216
resize : 6241
fast1 : 197693
fast2 : 1016293
fast3 : 2007
full (slow) : 1797488
was acquired : 709227
clear tail : 1
last overflow : 0
Clock release store : 3446946
resize : 200516
fast : 469265
slow : 2977681
clear tail : 0
Clock acquire-release : 820028
llvm-svn: 204656
Diffstat (limited to 'compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc')
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc index 73c5daf5957..e26e142368f 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc @@ -376,7 +376,7 @@ void AfterSleep(ThreadState *thr, uptr pc) { void AcquireImpl(ThreadState *thr, uptr pc, SyncClock *c) { if (thr->ignore_sync) return; - thr->clock.set(thr->tid, thr->fast_state.epoch()); + thr->clock.set(thr->fast_state.epoch()); thr->clock.acquire(c); StatInc(thr, StatSyncAcquire); } @@ -384,7 +384,7 @@ void AcquireImpl(ThreadState *thr, uptr pc, SyncClock *c) { void ReleaseImpl(ThreadState *thr, uptr pc, SyncClock *c) { if (thr->ignore_sync) return; - thr->clock.set(thr->tid, thr->fast_state.epoch()); + thr->clock.set(thr->fast_state.epoch()); thr->fast_synch_epoch = thr->fast_state.epoch(); thr->clock.release(c); StatInc(thr, StatSyncRelease); @@ -393,7 +393,7 @@ void ReleaseImpl(ThreadState *thr, uptr pc, SyncClock *c) { void ReleaseStoreImpl(ThreadState *thr, uptr pc, SyncClock *c) { if (thr->ignore_sync) return; - thr->clock.set(thr->tid, thr->fast_state.epoch()); + thr->clock.set(thr->fast_state.epoch()); thr->fast_synch_epoch = thr->fast_state.epoch(); thr->clock.ReleaseStore(c); StatInc(thr, StatSyncRelease); @@ -402,7 +402,7 @@ void ReleaseStoreImpl(ThreadState *thr, uptr pc, SyncClock *c) { void AcquireReleaseImpl(ThreadState *thr, uptr pc, SyncClock *c) { if (thr->ignore_sync) return; - thr->clock.set(thr->tid, thr->fast_state.epoch()); + thr->clock.set(thr->fast_state.epoch()); thr->fast_synch_epoch = thr->fast_state.epoch(); thr->clock.acq_rel(c); StatInc(thr, StatSyncAcquire); |

