Skip to content

Commit

Permalink
Fix integer types
Browse files Browse the repository at this point in the history
  • Loading branch information
nicovank committed Oct 23, 2023
1 parent 6e399a9 commit 54d135c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace {
static std::atomic_bool ready{false};
static thread_local int busy{0};

static std::vector<std::atomic_int> bins(PAGE_SIZE);
static std::vector<std::atomic_uint64_t> bins(PAGE_SIZE);

static std::atomic_uint64_t nAllocations{0};
static std::atomic<double> average{0};
Expand Down
12 changes: 6 additions & 6 deletions src/litterer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ void partial_shuffle(std::vector<T>& v, std::size_t n, Generator& g) {
}
}

std::vector<size_t> cumulative_sum(const std::vector<size_t>& bins) {
std::vector<size_t> cumsum(bins.size());
std::vector<std::uint64_t> cumulative_sum(const std::vector<std::uint64_t>& bins) {
std::vector<std::uint64_t> cumsum(bins.size());
std::partial_sum(bins.begin(), bins.end(), cumsum.begin());
return cumsum;
}
Expand Down Expand Up @@ -119,9 +119,9 @@ void runLitterer() {
const std::string mallocSourceObject = mallocInfo.dli_fname;
#endif

const auto bins = data["Bins"].get<std::vector<std::size_t>>();
const auto nAllocations = data["NAllocations"].get<std::size_t>();
const auto maxLiveAllocations = data["MaxLiveAllocations"].get<std::size_t>();
const auto bins = data["Bins"].get<std::vector<std::uint64_t>>();
const auto nAllocations = data["NAllocations"].get<std::uint64_t>();
const auto maxLiveAllocations = data["MaxLiveAllocations"].get<std::int64_t>();
const std::size_t nAllocationsLitter = maxLiveAllocations * multiplier;

fprintf(log, "==================================== Litterer ====================================\n");
Expand All @@ -135,7 +135,7 @@ void runLitterer() {
fprintf(log, "==================================================================================\n");

assert(std::accumulate(bins.begin(), bins.end(), 0zu) == nAllocations);
const std::vector<std::size_t> binsCumSum = cumulative_sum(bins);
const std::vector<std::uint64_t> binsCumSum = cumulative_sum(bins);

const auto litterStart = std::chrono::high_resolution_clock::now();

Expand Down

0 comments on commit 54d135c

Please sign in to comment.