You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2024/06/12 17:30:55 UTC
(kudu) 01/02: [util] remove last vestiges of chromium Atomics from metrics
This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 6bdd0c3d8b747169f09150874cd8751debaf2ed1
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Tue Jun 11 12:06:42 2024 -0700
[util] remove last vestiges of chromium Atomics from metrics
Change-Id: I5feaeffa7912ef93479e2675ea6b27d694c1c5ee
Reviewed-on: http://gerrit.cloudera.org:8080/21505
Tested-by: Alexey Serbin <al...@apache.org>
Reviewed-by: Yingchun Lai <la...@apache.org>
---
src/kudu/util/metrics.h | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/kudu/util/metrics.h b/src/kudu/util/metrics.h
index 7efc7e471..b53fd8a13 100644
--- a/src/kudu/util/metrics.h
+++ b/src/kudu/util/metrics.h
@@ -250,7 +250,6 @@
#include "kudu/gutil/port.h"
#include "kudu/gutil/ref_counted.h"
#include "kudu/gutil/strings/substitute.h"
-#include "kudu/util/atomic.h"
#include "kudu/util/hdr_histogram.h"
#include "kudu/util/jsonwriter.h" // IWYU pragma: keep
#include "kudu/util/locks.h"
@@ -1141,19 +1140,19 @@ class AtomicGauge : public Gauge {
return scoped_refptr<Metric>(p);
}
T value() const {
- return static_cast<T>(value_.Load(kMemOrderRelease));
+ return static_cast<T>(value_.load(std::memory_order_acquire));
}
void set_value(const T& value) {
UpdateModificationEpoch();
- value_.Store(static_cast<int64_t>(value), kMemOrderNoBarrier);
+ value_.store(static_cast<int64_t>(value), std::memory_order_relaxed);
}
void Increment() {
UpdateModificationEpoch();
- value_.IncrementBy(1, kMemOrderNoBarrier);
+ value_.fetch_add(1, std::memory_order_relaxed);
}
void IncrementBy(int64_t amount) {
UpdateModificationEpoch();
- value_.IncrementBy(amount, kMemOrderNoBarrier);
+ value_.fetch_add(amount, std::memory_order_relaxed);
}
void Decrement() {
IncrementBy(-1);
@@ -1201,7 +1200,7 @@ class AtomicGauge : public Gauge {
value());
}
private:
- AtomicInt<int64_t> value_;
+ std::atomic<int64_t> value_;
MergeType type_;
DISALLOW_COPY_AND_ASSIGN(AtomicGauge);