Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cc/oze/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void init(int32_t table_num) {
for (unsigned int i = 0; i < TotalThreadNum; ++i) {
ThManagementTable[i] = new ThreadManagementEntry(1, FLAGS_cc_mode);
}
for (unsigned int i = 0; i < table_num * 2; ++i) {
for (unsigned int i = 0; i < static_cast<unsigned int>(table_num) * 2; ++i) {
ScanHistory[i].store(nullptr);
}
}
Expand Down
3 changes: 2 additions & 1 deletion cmake/ProtocolHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ function(ccbench_add_protocol name)
-Werror=unused-parameter
-Werror=catch-value
-Werror=unused-variable
-Werror=ignored-qualifiers)
-Werror=ignored-qualifiers
-Werror=sign-compare)

set_property(TARGET ${target} PROPERTY CCBENCH_PROTOCOL "${name}")
set_property(TARGET ${target} PROPERTY CCBENCH_WORKLOAD "${wl}")
Expand Down
23 changes: 14 additions & 9 deletions include/bomb.hh
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public:
rnd_.init();

if (!FLAGS_bomb_mixed_mode) {
int total_threads = FLAGS_bomb_l1_thread_num
uint64_t total_threads = FLAGS_bomb_l1_thread_num
+ FLAGS_bomb_s1_thread_num
+ FLAGS_bomb_s2_thread_num
+ FLAGS_bomb_s3_thread_num
Expand Down Expand Up @@ -438,22 +438,27 @@ public:
TxArgs args;

TxType decideType(TxExecutor& tx, [[maybe_unused]] Xoroshiro128Plus& r) {
// tx.thid_ is a non-negative thread index whose underlying type varies
// between protocols (int / size_t / uint8_t / unsigned int). Cast it
// to uint32_t once so each comparison against FLAGS_bomb_*_thread_num
// (declared as uint32) is sign-clean.
const uint32_t thid = static_cast<uint32_t>(tx.thid_);
TxType txType;
if (tx.thid_ < FLAGS_bomb_l1_thread_num) {
if (thid < FLAGS_bomb_l1_thread_num) {
txType = TxType::UpdateProductCostMaster;
} else if (tx.thid_ < FLAGS_bomb_l1_thread_num
} else if (thid < FLAGS_bomb_l1_thread_num
+ FLAGS_bomb_s1_thread_num) {
txType = TxType::UpdateMaterialCostMaster;
} else if (tx.thid_ < FLAGS_bomb_l1_thread_num
} else if (thid < FLAGS_bomb_l1_thread_num
+ FLAGS_bomb_s1_thread_num
+ FLAGS_bomb_s2_thread_num) {
txType = TxType::IssueJournalVoucher;
} else if (tx.thid_ < FLAGS_bomb_l1_thread_num
} else if (thid < FLAGS_bomb_l1_thread_num
+ FLAGS_bomb_s1_thread_num
+ FLAGS_bomb_s2_thread_num
+ FLAGS_bomb_s3_thread_num) {
txType = TxType::AddNewProduct;
} else if (tx.thid_ < FLAGS_bomb_l1_thread_num
} else if (thid < FLAGS_bomb_l1_thread_num
+ FLAGS_bomb_s1_thread_num
+ FLAGS_bomb_s2_thread_num
+ FLAGS_bomb_s3_thread_num
Expand All @@ -467,7 +472,7 @@ public:
}

std::pair<TxType,timepoint> getRequest(TxExecutor& tx) {
if (tx.thid_ < FLAGS_bomb_l1_thread_num) {
if (static_cast<uint32_t>(tx.thid_) < FLAGS_bomb_l1_thread_num) {
timepoint start = std::chrono::high_resolution_clock::now();;
return make_pair(TxType::UpdateProductCostMaster, start);
} else {
Expand All @@ -487,7 +492,7 @@ public:

timepoint generate(BombWorkload* workload, TxExecutor& tx) {
timepoint start;
if (tx.thid_ < FLAGS_bomb_l1_thread_num) {
if (static_cast<uint32_t>(tx.thid_) < FLAGS_bomb_l1_thread_num) {
type = TxType::UpdateProductCostMaster;
start = std::chrono::high_resolution_clock::now();
} else if (!FLAGS_bomb_mixed_mode) {
Expand Down Expand Up @@ -1416,7 +1421,7 @@ RETRY:
while (!loadAcquire(quit)) {
for (int i = 0; i < numQueues; i++) {
auto start = std::chrono::high_resolution_clock::now();
for (int j = 0; j < FLAGS_bomb_req_batch_size; j++) {
for (uint32_t j = 0; j < FLAGS_bomb_req_batch_size; j++) {
requestQueues[i].push(make_pair(decideType(r, thresholds), start));
}
if (FLAGS_bomb_mixed_short_rate_tps) {
Expand Down
27 changes: 16 additions & 11 deletions include/bomb_pessimistic.hh
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public:
rnd_.init();

if (!FLAGS_bomb_mixed_mode) {
int total_threads = FLAGS_bomb_l1_thread_num
uint64_t total_threads = FLAGS_bomb_l1_thread_num
+ FLAGS_bomb_s1_thread_num
+ FLAGS_bomb_s2_thread_num
+ FLAGS_bomb_s3_thread_num
Expand Down Expand Up @@ -472,22 +472,27 @@ public:
TxArgs args;

TxType decideType(TxExecutor& tx, [[maybe_unused]] Xoroshiro128Plus& r) {
// tx.thid_ is a non-negative thread index whose underlying type varies
// between protocols (int / size_t / uint8_t / unsigned int). Cast it
// to uint32_t once so each comparison against FLAGS_bomb_*_thread_num
// (declared as uint32) is sign-clean.
const uint32_t thid = static_cast<uint32_t>(tx.thid_);
TxType txType;
if (tx.thid_ < FLAGS_bomb_l1_thread_num) {
if (thid < FLAGS_bomb_l1_thread_num) {
txType = TxType::UpdateProductCostMaster;
} else if (tx.thid_ < FLAGS_bomb_l1_thread_num
} else if (thid < FLAGS_bomb_l1_thread_num
+ FLAGS_bomb_s1_thread_num) {
txType = TxType::UpdateMaterialCostMaster;
} else if (tx.thid_ < FLAGS_bomb_l1_thread_num
} else if (thid < FLAGS_bomb_l1_thread_num
+ FLAGS_bomb_s1_thread_num
+ FLAGS_bomb_s2_thread_num) {
txType = TxType::IssueJournalVoucher;
} else if (tx.thid_ < FLAGS_bomb_l1_thread_num
} else if (thid < FLAGS_bomb_l1_thread_num
+ FLAGS_bomb_s1_thread_num
+ FLAGS_bomb_s2_thread_num
+ FLAGS_bomb_s3_thread_num) {
txType = TxType::AddNewProduct;
} else if (tx.thid_ < FLAGS_bomb_l1_thread_num
} else if (thid < FLAGS_bomb_l1_thread_num
+ FLAGS_bomb_s1_thread_num
+ FLAGS_bomb_s2_thread_num
+ FLAGS_bomb_s3_thread_num
Expand All @@ -501,7 +506,7 @@ public:
}

std::pair<TxType,timepoint> getRequest(TxExecutor& tx) {
if (tx.thid_ < FLAGS_bomb_l1_thread_num) {
if (static_cast<uint32_t>(tx.thid_) < FLAGS_bomb_l1_thread_num) {
timepoint start = std::chrono::high_resolution_clock::now();;
return make_pair(TxType::UpdateProductCostMaster, start);
} else {
Expand All @@ -521,7 +526,7 @@ public:

timepoint generate(BombWorkload* workload, TxExecutor& tx) {
timepoint start;
if (tx.thid_ < FLAGS_bomb_l1_thread_num) {
if (static_cast<uint32_t>(tx.thid_) < FLAGS_bomb_l1_thread_num) {
type = TxType::UpdateProductCostMaster;
start = std::chrono::high_resolution_clock::now();
} else if (!FLAGS_bomb_mixed_mode) {
Expand Down Expand Up @@ -1460,7 +1465,7 @@ RETRY:
set_tx_name(TxType::ChangeProductQuantity, "ChangeProductQuantity");

std::cout << "load factory" << std::endl;
for (int f_id = 1; f_id <= FLAGS_bomb_factory_size; f_id++) {
for (uint32_t f_id = 1; f_id <= FLAGS_bomb_factory_size; f_id++) {
insert_factory(param, f_id);
}

Expand All @@ -1475,7 +1480,7 @@ RETRY:
for (auto &th : thv) th.join();

std::cout << "load item master" << std::endl;
for (int i_id = 1; i_id <= ItemIdCounter; i_id++) {
for (uint32_t i_id = 1; i_id <= ItemIdCounter; i_id++) {
insert_item_master(param, i_id);
}

Expand Down Expand Up @@ -1540,7 +1545,7 @@ RETRY:
while (!loadAcquire(quit)) {
for (int i = 0; i < numQueues; i++) {
auto start = std::chrono::high_resolution_clock::now();
for (int j = 0; j < FLAGS_bomb_req_batch_size; j++) {
for (uint32_t j = 0; j < FLAGS_bomb_req_batch_size; j++) {
requestQueues[i].push(make_pair(decideType(r, thresholds), start));
}
if (FLAGS_bomb_mixed_short_rate_tps) {
Expand Down
3 changes: 2 additions & 1 deletion include/masstree_wrapper.hh
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ class MasstreeWrapper<T>::SearchRangeScanner {
}

bool visit_value(const Str key, T *val, threadinfo &) {
if (max_scan_num_ >= 0 && scan_buffer_->size() >= max_scan_num_) {
if (max_scan_num_ >= 0 &&
scan_buffer_->size() >= static_cast<std::size_t>(max_scan_num_)) {
return false;
}

Expand Down
Loading