Fix ios compile

Summary: No __thread for ios.

Test Plan: compile works for ios now

Reviewers: ljin, dhruba

Reviewed By: dhruba

Subscribers: leveldb

Differential Revision: https://reviews.facebook.net/D22491
This commit is contained in:
Igor Canadi 2014-08-28 12:46:05 -04:00
parent 6b46f78434
commit d5bd6c772b
5 changed files with 23 additions and 1 deletions

View File

@ -1979,7 +1979,7 @@ void DBImpl::MaybeScheduleFlushOrCompaction() {
}
void DBImpl::RecordFlushIOStats() {
RecordTick(stats_, FLUSH_WRITE_BYTES, iostats_context.bytes_written);
RecordTick(stats_, FLUSH_WRITE_BYTES, IOSTATS(bytes_written));
IOSTATS_RESET(bytes_written);
}

View File

@ -74,6 +74,8 @@ class DBImplReadOnly : public DBImpl {
uint32_t target_path_id = 0) override {
return Status::NotSupported("Not supported operation in read only mode.");
}
#ifndef ROCKSDB_LITE
virtual Status DisableFileDeletions() override {
return Status::NotSupported("Not supported operation in read only mode.");
}
@ -85,6 +87,8 @@ class DBImplReadOnly : public DBImpl {
bool flush_memtable = true) override {
return Status::NotSupported("Not supported operation in read only mode.");
}
#endif // ROCKSDB_LITE
using DBImpl::Flush;
virtual Status Flush(const FlushOptions& options,
ColumnFamilyHandle* column_family) override {

View File

@ -27,7 +27,9 @@ struct IOStatsContext {
uint64_t bytes_read;
};
#ifndef IOS_CROSS_COMPILE
extern __thread IOStatsContext iostats_context;
#endif // IOS_CROSS_COMPILE
} // namespace rocksdb

View File

@ -9,7 +9,9 @@
namespace rocksdb {
#ifndef IOS_CROSS_COMPILE
__thread IOStatsContext iostats_context;
#endif // IOS_CROSS_COMPILE
void IOStatsContext::Reset() {
thread_pool_id = Env::Priority::TOTAL;

View File

@ -6,6 +6,8 @@
#pragma once
#include "rocksdb/iostats_context.h"
#ifndef IOS_CROSS_COMPILE
// increment a specific counter by the specified value
#define IOSTATS_ADD(metric, value) \
(iostats_context.metric += value)
@ -30,3 +32,15 @@
#define IOSTATS(metric) \
(iostats_context.metric)
#else // IOS_CROSS_COMPILE
#define IOSTATS_ADD(metric, value)
#define IOSTATS_ADD_IF_POSITIVE(metric, value)
#define IOSTATS_RESET(metric)
#define IOSTATS_RESET_ALL()
#define IOSTATS_SET_THREAD_POOL_ID(value)
#define IOSTATS_THREAD_POOL_ID()
#define IOSTATS(metric) 0
#endif // IOS_CROSS_COMPILE