Skip to content

Commit

Permalink
Add statistics class
Browse files Browse the repository at this point in the history
  • Loading branch information
mharshe committed Dec 2, 2021
1 parent 2e97d76 commit 29f2a90
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions rocksdb/options.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ from .slice_ cimport Slice
from .snapshot cimport Snapshot
from .slice_transform cimport SliceTransform
from .table_factory cimport TableFactory
from .statistics cimport Statistics
from .memtablerep cimport MemTableRepFactory
from .universal_compaction cimport CompactionOptionsUniversal
from .cache cimport Cache
Expand Down
35 changes: 33 additions & 2 deletions rocksdb/statistics.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from libc.stdint cimport uint32_t, uint8_t
from .std_memory cimport shared_ptr
from libc.stdint cimport uint32_t, uint8_t, uint64_t
from libcpp.memory cimport shared_ptr
from libcpp.string cimport string
from libcpp cimport bool as cpp_bool
from libcpp.map cimport map
from .status cimport Status

cdef extern from "rocksdb/statistics.h" namespace "rocksdb":
ctypedef enum StatsLevel:
Expand All @@ -9,5 +13,32 @@ cdef extern from "rocksdb/statistics.h" namespace "rocksdb":
kExceptTimeForMutex
kAll

cdef cppclass HistogramData:
double median
double percentile95
double percentile99
double average
double standard_deviation
double max
uint64_t count
uint64_t sum
double min

cdef cppclass Statistics:
const char* Type() nogil except+
uint64_t getTickerCount(uint32_t) nogil except+
void histogramData(uint32_t type,
HistogramData* const) nogil except+
string getHistogramString(uint32_t) nogil except+
void recordTick(uint32_t, uint64_t) nogil except+
void setTickerCount(uint32_t tickerType, uint64_t count) nogil except+
uint64_t getAndResetTickerCount(uint32_t) nogil except+
void reportTimeToHistogram(uint32_t, uint64_t) nogil except+
void measureTime(uint32_t, uint64_t) nogil except+
void recordInHistogram(uint32_t, uint64_t) nogil except+
Status Reset() nogil except+
string ToString() nogil except+
cpp_bool getTickerMap(map[string, uint64_t]*) nogil except+
cpp_bool HistEnabledForType(uint32_t type) nogil except+
void set_stats_level(StatsLevel) nogil except+
StatsLevel get_stats_level() nogil except+

0 comments on commit 29f2a90

Please sign in to comment.