]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/include/rocksdb/utilities/memory_util.h
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
12 #include <unordered_set>
15 #include "rocksdb/cache.h"
16 #include "rocksdb/db.h"
20 // Returns the current memory usage of the specified DB instances.
23 enum UsageType
: int {
24 // Memory usage of all the mem-tables.
26 // Memory usage of those un-flushed mem-tables.
27 kMemTableUnFlushed
= 1,
28 // Memory usage of all the table readers.
29 kTableReadersTotal
= 2,
30 // Memory usage by Cache.
35 // Returns the approximate memory usage of different types in the input
36 // list of DBs and Cache set. For instance, in the output map
37 // usage_by_type, usage_by_type[kMemTableTotal] will store the memory
38 // usage of all the mem-tables from all the input rocksdb instances.
40 // Note that for memory usage inside Cache class, we will
41 // only report the usage of the input "cache_set" without
42 // including those Cache usage inside the input list "dbs"
44 static Status
GetApproximateMemoryUsageByType(
45 const std::vector
<DB
*>& dbs
,
46 const std::unordered_set
<const Cache
*> cache_set
,
47 std::map
<MemoryUtil::UsageType
, uint64_t>* usage_by_type
);
49 } // namespace rocksdb
50 #endif // !ROCKSDB_LITE