diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-01-12 17:03:45 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-01-13 10:15:21 +0100 |
commit | e695db0f2d97cbba2832e0f3dc25af5add1f16ac (patch) | |
tree | 7c03822a83a0b16ae513b22659b9ac43068b0411 /plugin | |
parent | 1f0ad6c6b3421a815ea6373c66aaf693852342cf (diff) | |
download | mariadb-git-e695db0f2d97cbba2832e0f3dc25af5add1f16ac.tar.gz |
MDEV-7437 remove suport for "atomics" with rwlocks
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/query_response_time/query_response_time.cc | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/plugin/query_response_time/query_response_time.cc b/plugin/query_response_time/query_response_time.cc index 2c426b0ce5c..10b9391d9da 100644 --- a/plugin/query_response_time/query_response_time.cc +++ b/plugin/query_response_time/query_response_time.cc @@ -149,34 +149,22 @@ class time_collector { public: time_collector(utility& u) : m_utility(&u) - { - my_atomic_rwlock_init(&time_collector_lock); - } + { } ~time_collector() - { - my_atomic_rwlock_destroy(&time_collector_lock); - } + { } uint32 count(uint index) { - my_atomic_rwlock_rdlock(&time_collector_lock); - uint32 result= my_atomic_load32((int32*)&m_count[index]); - my_atomic_rwlock_rdunlock(&time_collector_lock); - return result; + return my_atomic_load32((int32*)&m_count[index]); } uint64 total(uint index) { - my_atomic_rwlock_rdlock(&time_collector_lock); - uint64 result= my_atomic_load64((int64*)&m_total[index]); - my_atomic_rwlock_rdunlock(&time_collector_lock); - return result; + return my_atomic_load64((int64*)&m_total[index]); } public: void flush() { - my_atomic_rwlock_wrlock(&time_collector_lock); memset((void*)&m_count,0,sizeof(m_count)); memset((void*)&m_total,0,sizeof(m_total)); - my_atomic_rwlock_wrunlock(&time_collector_lock); } void collect(uint64 time) { @@ -185,20 +173,14 @@ public: { if(m_utility->bound(i) > time) { - my_atomic_rwlock_wrlock(&time_collector_lock); my_atomic_add32((int32*)(&m_count[i]), 1); my_atomic_add64((int64*)(&m_total[i]), time); - my_atomic_rwlock_wrunlock(&time_collector_lock); break; } } } private: utility* m_utility; - /* The lock for atomic operations on m_count and m_total. Only actually - used on architectures that do not have atomic implementation of atomic - operations. */ - my_atomic_rwlock_t time_collector_lock; uint32 m_count[OVERALL_POWER_COUNT + 1]; uint64 m_total[OVERALL_POWER_COUNT + 1]; }; |