]> git.proxmox.com Git - ceph.git/blob - ceph/src/kv/KeyValueHistogram.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / kv / KeyValueHistogram.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 #ifndef KeyValueHistogram_H
4 #define KeyValueHistogram_H
5
6 #include <map>
7 #include <string>
8 #include "common/Formatter.h"
9
10 /**
11 *
12 * Key Value DB Histogram generator
13 *
14 */
15 struct KeyValueHistogram {
16 struct value_dist {
17 uint64_t count;
18 uint32_t max_len;
19 };
20
21 struct key_dist {
22 uint64_t count;
23 uint32_t max_len;
24 std::map<int, struct value_dist> val_map; ///< slab id to count, max length of value and key
25 };
26
27 std::map<std::string, std::map<int, struct key_dist> > key_hist;
28 std::map<int, uint64_t> value_hist;
29 int get_key_slab(size_t sz);
30 std::string get_key_slab_to_range(int slab);
31 int get_value_slab(size_t sz);
32 std::string get_value_slab_to_range(int slab);
33 void update_hist_entry(std::map<std::string, std::map<int, struct key_dist> >& key_hist,
34 const std::string& prefix, size_t key_size, size_t value_size);
35 void dump(ceph::Formatter* f);
36 };
37
38 #endif