Skip to content

Commit 99a317d

Browse files
committed
remainder of comments
1 parent 2041678 commit 99a317d

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

cachelib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ set(PACKAGE_BUGREPORT "https://github.com/facebook/TBD")
4343
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
4444

4545
option(BUILD_TESTS "If enabled, compile the tests." ON)
46-
option(WITH_DTO "If enabled, build with DSA transparent offloading." OFF)
46+
option(BUILD_WITH_DTO "If enabled, build with DSA transparent offloading." OFF)
4747

4848

4949
set(BIN_INSTALL_DIR bin CACHE STRING

cachelib/allocator/BackgroundMover-inl.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@ BackgroundMover<CacheT>::BackgroundMover(
3232

3333
template <typename CacheT>
3434
void BackgroundMover<CacheT>::TraversalStats::recordTraversalTime(uint64_t nsTaken) {
35-
lastTraversalTimeNs_.store(nsTaken, std::memory_order_relaxed);
36-
minTraversalTimeNs_.store(std::min(minTraversalTimeNs_.load(), nsTaken),
37-
std::memory_order_relaxed);
38-
maxTraversalTimeNs_.store(std::max(maxTraversalTimeNs_.load(), nsTaken),
39-
std::memory_order_relaxed);
40-
totalTraversalTimeNs_.fetch_add(nsTaken, std::memory_order_relaxed);
35+
lastTraversalTimeNs_ = nsTaken;
36+
minTraversalTimeNs_ = std::min(minTraversalTimeNs_, nsTaken);
37+
maxTraversalTimeNs_ = std::max(maxTraversalTimeNs_, nsTaken);
38+
totalTraversalTimeNs_ += nsTaken;
4139
}
4240

4341
template <typename CacheT>
@@ -100,8 +98,8 @@ void BackgroundMover<CacheT>::checkAndRun() {
10098
auto end = util::getCurrentTimeNs();
10199
if (moves > 0) {
102100
traversalStats_.recordTraversalTime(end > begin ? end - begin : 0);
103-
numMovedItems.add(moves);
104-
numTraversals.inc();
101+
numMovedItems += moves;
102+
numTraversals++;
105103
}
106104

107105
//we didn't move any objects done with this run
@@ -114,12 +112,12 @@ void BackgroundMover<CacheT>::checkAndRun() {
114112
template <typename CacheT>
115113
BackgroundMoverStats BackgroundMover<CacheT>::getStats() const noexcept {
116114
BackgroundMoverStats stats;
117-
stats.numMovedItems = numMovedItems.get();
118-
stats.totalBytesMoved = totalBytesMoved.get();
119-
stats.totalClasses = totalClasses.get();
115+
stats.numMovedItems = numMovedItems;
116+
stats.totalBytesMoved = totalBytesMoved;
117+
stats.totalClasses = totalClasses;
120118
auto runCount = getRunCount();
121119
stats.runCount = runCount;
122-
stats.numTraversals = numTraversals.get();
120+
stats.numTraversals = numTraversals;
123121
stats.avgItemsMoved = (double) stats.numMovedItems / (double)runCount;
124122
stats.lastTraversalTimeNs = traversalStats_.getLastTraversalTimeNs();
125123
stats.avgTraversalTimeNs = traversalStats_.getAvgTraversalTimeNs(runCount);

cachelib/allocator/BackgroundMover.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ class BackgroundMover : public PeriodicWorker {
8686

8787
private:
8888
// time it took us the last time to traverse the cache.
89-
std::atomic<uint64_t> lastTraversalTimeNs_{0};
90-
std::atomic<uint64_t> minTraversalTimeNs_{
89+
uint64_t lastTraversalTimeNs_{0};
90+
uint64_t minTraversalTimeNs_{
9191
std::numeric_limits<uint64_t>::max()};
92-
std::atomic<uint64_t> maxTraversalTimeNs_{0};
93-
std::atomic<uint64_t> totalTraversalTimeNs_{0};
94-
std::atomic<uint64_t> numTraversals_{0};
92+
uint64_t maxTraversalTimeNs_{0};
93+
uint64_t totalTraversalTimeNs_{0};
94+
uint64_t numTraversals_{0};
9595
};
9696

9797
TraversalStats traversalStats_;
@@ -110,10 +110,10 @@ class BackgroundMover : public PeriodicWorker {
110110
void work() override final;
111111
void checkAndRun();
112112

113-
AtomicCounter numMovedItems{0};
114-
AtomicCounter numTraversals{0};
115-
AtomicCounter totalClasses{0};
116-
AtomicCounter totalBytesMoved{0};
113+
uint64_t numMovedItems{0};
114+
uint64_t numTraversals{0};
115+
uint64_t totalClasses{0};
116+
uint64_t totalBytesMoved{0};
117117

118118
std::vector<MemoryDescriptorType> assignedMemory_;
119119
folly::DistributedMutex mutex;

cachelib/cachebench/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ endif()
4949
add_executable (cachebench main.cpp)
5050
target_link_libraries(cachebench cachelib_cachebench)
5151

52-
if (WITH_DTO)
52+
if (BUILD_WITH_DTO)
5353
target_link_libraries(cachebench accel-config dto)
5454
endif ()
5555

0 commit comments

Comments
 (0)