Commit 743193e9 authored by John Esmet's avatar John Esmet

FT-300 Use portable printf format strings in the block allocator's

tracing code
parent 138182e2
...@@ -457,8 +457,8 @@ void block_allocator::validate() const { ...@@ -457,8 +457,8 @@ void block_allocator::validate() const {
void block_allocator::_trace_create(void) { void block_allocator::_trace_create(void) {
if (ba_trace_file != nullptr) { if (ba_trace_file != nullptr) {
toku_mutex_lock(&_trace_lock); toku_mutex_lock(&_trace_lock);
fprintf(ba_trace_file, "ba_trace_create %p %lu %lu\n", this, fprintf(ba_trace_file, "ba_trace_create %p %" PRIu64 " %" PRIu64 "\n",
_reserve_at_beginning, _alignment); this, _reserve_at_beginning, _alignment);
toku_mutex_unlock(&_trace_lock); toku_mutex_unlock(&_trace_lock);
fflush(ba_trace_file); fflush(ba_trace_file);
...@@ -468,10 +468,11 @@ void block_allocator::_trace_create(void) { ...@@ -468,10 +468,11 @@ void block_allocator::_trace_create(void) {
void block_allocator::_trace_create_from_blockpairs(void) { void block_allocator::_trace_create_from_blockpairs(void) {
if (ba_trace_file != nullptr) { if (ba_trace_file != nullptr) {
toku_mutex_lock(&_trace_lock); toku_mutex_lock(&_trace_lock);
fprintf(ba_trace_file, "ba_trace_create_from_blockpairs %p %lu %lu ", this, fprintf(ba_trace_file, "ba_trace_create_from_blockpairs %p %" PRIu64 " %" PRIu64 " ",
_reserve_at_beginning, _alignment); this, _reserve_at_beginning, _alignment);
for (uint64_t i = 0; i < _n_blocks; i++) { for (uint64_t i = 0; i < _n_blocks; i++) {
fprintf(ba_trace_file, "[%lu %lu] ", _blocks_array[i].offset, _blocks_array[i].size); fprintf(ba_trace_file, "[%" PRIu64 " %" PRIu64 "] ",
_blocks_array[i].offset, _blocks_array[i].size);
} }
fprintf(ba_trace_file, "\n"); fprintf(ba_trace_file, "\n");
toku_mutex_unlock(&_trace_lock); toku_mutex_unlock(&_trace_lock);
...@@ -493,10 +494,8 @@ void block_allocator::_trace_destroy(void) { ...@@ -493,10 +494,8 @@ void block_allocator::_trace_destroy(void) {
void block_allocator::_trace_alloc(uint64_t size, uint64_t heat, uint64_t offset) { void block_allocator::_trace_alloc(uint64_t size, uint64_t heat, uint64_t offset) {
if (ba_trace_file != nullptr) { if (ba_trace_file != nullptr) {
toku_mutex_lock(&_trace_lock); toku_mutex_lock(&_trace_lock);
fprintf(ba_trace_file, "ba_trace_alloc %p %lu %lu %lu\n", this, fprintf(ba_trace_file, "ba_trace_alloc %p %" PRIu64 " %" PRIu64 " %" PRIu64 "\n",
static_cast<unsigned long>(size), this, size, heat, offset);
static_cast<unsigned long>(heat),
static_cast<unsigned long>(offset));
toku_mutex_unlock(&_trace_lock); toku_mutex_unlock(&_trace_lock);
fflush(ba_trace_file); fflush(ba_trace_file);
...@@ -506,8 +505,7 @@ void block_allocator::_trace_alloc(uint64_t size, uint64_t heat, uint64_t offset ...@@ -506,8 +505,7 @@ void block_allocator::_trace_alloc(uint64_t size, uint64_t heat, uint64_t offset
void block_allocator::_trace_free(uint64_t offset) { void block_allocator::_trace_free(uint64_t offset) {
if (ba_trace_file != nullptr) { if (ba_trace_file != nullptr) {
toku_mutex_lock(&_trace_lock); toku_mutex_lock(&_trace_lock);
fprintf(ba_trace_file, "ba_trace_free %p %lu\n", this, fprintf(ba_trace_file, "ba_trace_free %p %" PRIu64 "\n", this, offset);
static_cast<unsigned long>(offset));
toku_mutex_unlock(&_trace_lock); toku_mutex_unlock(&_trace_lock);
fflush(ba_trace_file); fflush(ba_trace_file);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment