fdf882ded2
Summary: When dynamically linking two binaries together, different builds of RocksDB from two sources might cause errors. To provide a tool for user to solve the problem, the RocksDB namespace is changed to a flag which can be overridden in build time. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6433 Test Plan: Build release, all and jtest. Try to build with ROCKSDB_NAMESPACE with another flag. Differential Revision: D19977691 fbshipit-source-id: aa7f2d0972e1c31d75339ac48478f34f6cfcfb3e
57 lines
1.6 KiB
C++
57 lines
1.6 KiB
C++
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <string>
|
|
|
|
#include "rocksdb/perf_level.h"
|
|
|
|
// A thread local context for gathering io-stats efficiently and transparently.
|
|
// Use SetPerfLevel(PerfLevel::kEnableTime) to enable time stats.
|
|
|
|
namespace ROCKSDB_NAMESPACE {
|
|
|
|
struct IOStatsContext {
|
|
// reset all io-stats counter to zero
|
|
void Reset();
|
|
|
|
std::string ToString(bool exclude_zero_counters = false) const;
|
|
|
|
// the thread pool id
|
|
uint64_t thread_pool_id;
|
|
|
|
// number of bytes that has been written.
|
|
uint64_t bytes_written;
|
|
// number of bytes that has been read.
|
|
uint64_t bytes_read;
|
|
|
|
// time spent in open() and fopen().
|
|
uint64_t open_nanos;
|
|
// time spent in fallocate().
|
|
uint64_t allocate_nanos;
|
|
// time spent in write() and pwrite().
|
|
uint64_t write_nanos;
|
|
// time spent in read() and pread()
|
|
uint64_t read_nanos;
|
|
// time spent in sync_file_range().
|
|
uint64_t range_sync_nanos;
|
|
// time spent in fsync
|
|
uint64_t fsync_nanos;
|
|
// time spent in preparing write (fallocate etc).
|
|
uint64_t prepare_write_nanos;
|
|
// time spent in Logger::Logv().
|
|
uint64_t logger_nanos;
|
|
// CPU time spent in write() and pwrite()
|
|
uint64_t cpu_write_nanos;
|
|
// CPU time spent in read() and pread()
|
|
uint64_t cpu_read_nanos;
|
|
};
|
|
|
|
// Get Thread-local IOStatsContext object pointer
|
|
IOStatsContext* get_iostats_context();
|
|
|
|
} // namespace ROCKSDB_NAMESPACE
|