fork of https://github.com/oxigraph/rocksdb and https://github.com/facebook/rocksdb for nextgraph and oxigraph
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.6 KiB
50 lines
1.6 KiB
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under the BSD-style license found in the
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
#ifndef ROCKSDB_LITE
|
|
|
|
#pragma once
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <unordered_set>
|
|
#include <vector>
|
|
|
|
#include "rocksdb/cache.h"
|
|
#include "rocksdb/db.h"
|
|
|
|
namespace rocksdb {
|
|
|
|
// Returns the current memory usage of the specified DB instances.
|
|
class MemoryUtil {
|
|
public:
|
|
enum UsageType : int {
|
|
// Memory usage of all the mem-tables.
|
|
kMemTableTotal = 0,
|
|
// Memory usage of those un-flushed mem-tables.
|
|
kMemTableUnFlushed = 1,
|
|
// Memory usage of all the table readers.
|
|
kTableReadersTotal = 2,
|
|
// Memory usage by Cache.
|
|
kCacheTotal = 3,
|
|
kNumUsageTypes = 4
|
|
};
|
|
|
|
// Returns the approximate memory usage of different types in the input
|
|
// list of DBs and Cache set. For instance, in the output map
|
|
// usage_by_type, usage_by_type[kMemTableTotal] will store the memory
|
|
// usage of all the mem-tables from all the input rocksdb instances.
|
|
//
|
|
// Note that for memory usage inside Cache class, we will
|
|
// only report the usage of the input "cache_set" without
|
|
// including those Cache usage inside the input list "dbs"
|
|
// of DBs.
|
|
static Status GetApproximateMemoryUsageByType(
|
|
const std::vector<DB*>& dbs,
|
|
const std::unordered_set<const Cache*> cache_set,
|
|
std::map<MemoryUtil::UsageType, uint64_t>* usage_by_type);
|
|
};
|
|
} // namespace rocksdb
|
|
#endif // !ROCKSDB_LITE
|
|
|