Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation under MSVC VS2015 #6081

Closed
Closed
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
17 changes: 9 additions & 8 deletions tools/block_cache_analyzer/block_cache_trace_analyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <fstream>
#include <iomanip>
#include <iostream>
#include <memory>
#include <random>
#include <sstream>

Expand Down Expand Up @@ -650,7 +651,7 @@ void BlockCacheTraceAnalyzer::WriteCorrelationFeaturesToFile(
const std::map<std::string, Features>& label_features,
const std::map<std::string, Predictions>& label_predictions,
uint32_t max_number_of_values) const {
std::default_random_engine rand_engine(static_cast<unsigned int>(env_->NowMicros()));
std::default_random_engine rand_engine(static_cast<std::default_random_engine::result_type>(env_->NowMicros()));
for (auto const& label_feature_vectors : label_features) {
const Features& past = label_feature_vectors.second;
auto it = label_predictions.find(label_feature_vectors.first);
Expand Down Expand Up @@ -1170,7 +1171,7 @@ void BlockCacheTraceAnalyzer::WriteReuseLifetime(
}

void BlockCacheTraceAnalyzer::WriteBlockReuseTimeline(
uint64_t reuse_window, bool user_access_only, TraceType block_type) const {
const uint64_t reuse_window, bool user_access_only, TraceType block_type) const {
// A map from block key to an array of bools that states whether a block is
// accessed in a time window.
std::map<uint64_t, std::vector<bool>> block_accessed;
Expand Down Expand Up @@ -1209,11 +1210,11 @@ void BlockCacheTraceAnalyzer::WriteBlockReuseTimeline(
TraverseBlocks(block_callback);

// A cell is the number of blocks accessed in a reuse window.
uint64_t reuse_table[reuse_vector_size][reuse_vector_size];
std::unique_ptr<uint64_t[]> reuse_table(new uint64_t[reuse_vector_size * reuse_vector_size]);
for (uint64_t start_time = 0; start_time < reuse_vector_size; start_time++) {
// Initialize the reuse_table.
for (uint64_t i = 0; i < reuse_vector_size; i++) {
reuse_table[start_time][i] = 0;
reuse_table[start_time * reuse_vector_size + i] = 0;
}
// Examine all blocks.
for (auto const& block : block_accessed) {
Expand All @@ -1222,7 +1223,7 @@ void BlockCacheTraceAnalyzer::WriteBlockReuseTimeline(
// This block is accessed at start time and at the current time. We
// increment reuse_table[start_time][i] since it is reused at the ith
// window.
reuse_table[start_time][i]++;
reuse_table[start_time * reuse_vector_size + i]++;
}
}
}
Expand Down Expand Up @@ -1250,8 +1251,8 @@ void BlockCacheTraceAnalyzer::WriteBlockReuseTimeline(
if (j < start_time) {
row += "100.0";
} else {
row += std::to_string(percent(reuse_table[start_time][j],
reuse_table[start_time][start_time]));
row += std::to_string(percent(reuse_table[start_time * reuse_vector_size + j],
reuse_table[start_time * reuse_vector_size + start_time]));
}
}
out << row << std::endl;
Expand Down Expand Up @@ -1673,7 +1674,7 @@ void BlockCacheTraceAnalyzer::PrintAccessCountStats(bool user_access_only,
if (bottom_k_index >= bottom_k) {
break;
}
std::map<TableReaderCaller, uint32_t> caller_naccesses;
std::map<TableReaderCaller, uint64_t> caller_naccesses;
uint64_t naccesses = 0;
for (auto const& block_id : naccess_it->second) {
BlockAccessInfo* block = block_info_map_.find(block_id)->second;
Expand Down
2 changes: 1 addition & 1 deletion tools/block_cache_analyzer/block_cache_trace_analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class BlockCacheTraceAnalyzer {
// The file is named
// "block_type_user_access_only_reuse_window_reuse_timeline". The file format
// is start_time,0,1,...,N where N equals trace_duration / reuse_window.
void WriteBlockReuseTimeline(uint64_t reuse_window, bool user_access_only,
void WriteBlockReuseTimeline(const uint64_t reuse_window, bool user_access_only,
TraceType block_type) const;

// Write the Get spatical locality into csv files saved in 'output_dir'.
Expand Down
2 changes: 1 addition & 1 deletion utilities/transactions/transaction_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ void TransactionBaseImpl::MultiGet(const ReadOptions& read_options,
ColumnFamilyHandle* column_family,
const size_t num_keys, const Slice* keys,
PinnableSlice* values, Status* statuses,
bool sorted_input) {
const bool sorted_input) {
write_batch_.MultiGetFromBatchAndDB(db_, read_options, column_family,
num_keys, keys, values, statuses,
sorted_input);
Expand Down
2 changes: 1 addition & 1 deletion utilities/transactions/transaction_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class TransactionBaseImpl : public Transaction {

void MultiGet(const ReadOptions& options, ColumnFamilyHandle* column_family,
const size_t num_keys, const Slice* keys, PinnableSlice* values,
Status* statuses, bool sorted_input = false) override;
Status* statuses, const bool sorted_input = false) override;

using Transaction::MultiGetForUpdate;
std::vector<Status> MultiGetForUpdate(
Expand Down
2 changes: 1 addition & 1 deletion utilities/transactions/write_prepared_txn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void WritePreparedTxn::MultiGet(const ReadOptions& options,
ColumnFamilyHandle* column_family,
const size_t num_keys, const Slice* keys,
PinnableSlice* values, Status* statuses,
bool sorted_input) {
const bool sorted_input) {
SequenceNumber min_uncommitted, snap_seq;
const SnapshotBackup backed_by_snapshot =
wpt_db_->AssignMinMaxSeqs(options.snapshot, &min_uncommitted, &snap_seq);
Expand Down
2 changes: 1 addition & 1 deletion utilities/transactions/write_prepared_txn.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class WritePreparedTxn : public PessimisticTransaction {
ColumnFamilyHandle* column_family,
const size_t num_keys, const Slice* keys,
PinnableSlice* values, Status* statuses,
bool sorted_input = false) override;
const bool sorted_input = false) override;

// Note: The behavior is undefined in presence of interleaved writes to the
// same transaction.
Expand Down
2 changes: 1 addition & 1 deletion utilities/transactions/write_unprepared_txn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ void WriteUnpreparedTxn::MultiGet(const ReadOptions& options,
ColumnFamilyHandle* column_family,
const size_t num_keys, const Slice* keys,
PinnableSlice* values, Status* statuses,
bool sorted_input) {
const bool sorted_input) {
SequenceNumber min_uncommitted, snap_seq;
const SnapshotBackup backed_by_snapshot =
wupt_db_->AssignMinMaxSeqs(options.snapshot, &min_uncommitted, &snap_seq);
Expand Down
2 changes: 1 addition & 1 deletion utilities/transactions/write_unprepared_txn.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class WriteUnpreparedTxn : public WritePreparedTxn {
ColumnFamilyHandle* column_family,
const size_t num_keys, const Slice* keys,
PinnableSlice* values, Status* statuses,
bool sorted_input = false) override;
const bool sorted_input = false) override;

using Transaction::GetIterator;
virtual Iterator* GetIterator(const ReadOptions& options) override;
Expand Down