Remove %z Format Specifier and Fix Windows Build of sim_cache.cc (#1224)
* Replace %zu format specifier with Windows-compatible macro 'ROCKSDB_PRIszt'
* Added "port/port.h" include to sim_cache.cc for call to snprintf().
* Applied cleaner fix to windows build, reverting part of 7bedd94
This commit is contained in:
parent
08ab1d83ac
commit
9ab38c45ad
@ -11,6 +11,7 @@
|
|||||||
#include "port/stack_trace.h"
|
#include "port/stack_trace.h"
|
||||||
#include "rocksdb/iostats_context.h"
|
#include "rocksdb/iostats_context.h"
|
||||||
#include "rocksdb/perf_context.h"
|
#include "rocksdb/perf_context.h"
|
||||||
|
#include "port/port.h"
|
||||||
|
|
||||||
namespace rocksdb {
|
namespace rocksdb {
|
||||||
|
|
||||||
@ -979,7 +980,7 @@ TEST_F(DBIteratorTest, PinnedDataIteratorRandomized) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
// Test Seek to random keys
|
// Test Seek to random keys
|
||||||
printf("Testing seek on %zu keys\n", random_keys.size());
|
printf("Testing seek on %" ROCKSDB_PRIszt " keys\n", random_keys.size());
|
||||||
std::vector<Slice> keys_slices;
|
std::vector<Slice> keys_slices;
|
||||||
std::vector<std::string> true_keys;
|
std::vector<std::string> true_keys;
|
||||||
for (auto& k : random_keys) {
|
for (auto& k : random_keys) {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "rocksdb/sst_file_manager.h"
|
#include "rocksdb/sst_file_manager.h"
|
||||||
#include "rocksdb/sst_file_writer.h"
|
#include "rocksdb/sst_file_writer.h"
|
||||||
#include "util/sst_file_manager_impl.h"
|
#include "util/sst_file_manager_impl.h"
|
||||||
|
#include "port/port.h"
|
||||||
|
|
||||||
namespace rocksdb {
|
namespace rocksdb {
|
||||||
|
|
||||||
@ -1455,7 +1456,7 @@ TEST_F(DBSSTTest, AddExternalSstFileOverlappingRanges) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
"Total: %zu ranges\n"
|
"Total: %" ROCKSDB_PRIszt " ranges\n"
|
||||||
"AddFile()|Success: %d ranges\n"
|
"AddFile()|Success: %d ranges\n"
|
||||||
"AddFile()|RangeConflict: %d ranges\n"
|
"AddFile()|RangeConflict: %d ranges\n"
|
||||||
"Put(): %d ranges\n",
|
"Put(): %d ranges\n",
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "rocksdb/utilities/sim_cache.h"
|
#include "rocksdb/utilities/sim_cache.h"
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include "port/port.h"
|
||||||
|
|
||||||
namespace rocksdb {
|
namespace rocksdb {
|
||||||
|
|
||||||
@ -133,13 +134,8 @@ class SimCacheImpl : public SimCache {
|
|||||||
"\n");
|
"\n");
|
||||||
res.append("SimCache HITs: " + std::to_string(get_hit_counter()) + "\n");
|
res.append("SimCache HITs: " + std::to_string(get_hit_counter()) + "\n");
|
||||||
char buff[100];
|
char buff[100];
|
||||||
#ifdef OS_WIN
|
|
||||||
_snprintf(buff, sizeof(buff), "SimCache HITRATE: %.2f%%\n",
|
|
||||||
get_hit_rate() * 100);
|
|
||||||
#else
|
|
||||||
snprintf(buff, sizeof(buff), "SimCache HITRATE: %.2f%%\n",
|
snprintf(buff, sizeof(buff), "SimCache HITRATE: %.2f%%\n",
|
||||||
get_hit_rate() * 100);
|
get_hit_rate() * 100);
|
||||||
#endif
|
|
||||||
res.append(buff);
|
res.append(buff);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user