]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/include/rocksdb/iostats_context.h
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
10 #include "rocksdb/perf_level.h"
12 // A thread local context for gathering io-stats efficiently and transparently.
13 // Use SetPerfLevel(PerfLevel::kEnableTime) to enable time stats.
17 struct IOStatsContext
{
18 // reset all io-stats counter to zero
21 std::string
ToString(bool exclude_zero_counters
= false) const;
24 uint64_t thread_pool_id
;
26 // number of bytes that has been written.
27 uint64_t bytes_written
;
28 // number of bytes that has been read.
31 // time spent in open() and fopen().
33 // time spent in fallocate().
34 uint64_t allocate_nanos
;
35 // time spent in write() and pwrite().
37 // time spent in read() and pread()
39 // time spent in sync_file_range().
40 uint64_t range_sync_nanos
;
41 // time spent in fsync
43 // time spent in preparing write (fallocate etc).
44 uint64_t prepare_write_nanos
;
45 // time spent in Logger::Logv().
46 uint64_t logger_nanos
;
47 // CPU time spent in write() and pwrite()
48 uint64_t cpu_write_nanos
;
49 // CPU time spent in read() and pread()
50 uint64_t cpu_read_nanos
;
53 // Get Thread-local IOStatsContext object pointer
54 IOStatsContext
* get_iostats_context();
56 } // namespace rocksdb