diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/kv/KeyValueHistogram.h | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/kv/KeyValueHistogram.h')
-rw-r--r-- | src/kv/KeyValueHistogram.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/kv/KeyValueHistogram.h b/src/kv/KeyValueHistogram.h new file mode 100644 index 000000000..2da44bd4e --- /dev/null +++ b/src/kv/KeyValueHistogram.h @@ -0,0 +1,38 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +#ifndef KeyValueHistogram_H +#define KeyValueHistogram_H + +#include <map> +#include <string> +#include "common/Formatter.h" + +/** + * + * Key Value DB Histogram generator + * + */ +struct KeyValueHistogram { + struct value_dist { + uint64_t count; + uint32_t max_len; + }; + + struct key_dist { + uint64_t count; + uint32_t max_len; + std::map<int, struct value_dist> val_map; ///< slab id to count, max length of value and key + }; + + std::map<std::string, std::map<int, struct key_dist> > key_hist; + std::map<int, uint64_t> value_hist; + int get_key_slab(size_t sz); + std::string get_key_slab_to_range(int slab); + int get_value_slab(size_t sz); + std::string get_value_slab_to_range(int slab); + void update_hist_entry(std::map<std::string, std::map<int, struct key_dist> >& key_hist, + const std::string& prefix, size_t key_size, size_t value_size); + void dump(ceph::Formatter* f); +}; + +#endif |