|
|
@ -13,6 +13,7 @@ |
|
|
|
#include "include/org_rocksdb_Statistics.h" |
|
|
|
#include "include/org_rocksdb_Statistics.h" |
|
|
|
#include "rocksjni/portal.h" |
|
|
|
#include "rocksjni/portal.h" |
|
|
|
#include "rocksdb/statistics.h" |
|
|
|
#include "rocksdb/statistics.h" |
|
|
|
|
|
|
|
#include <iostream> |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Class: org_rocksdb_Statistics |
|
|
|
* Class: org_rocksdb_Statistics |
|
|
@ -20,9 +21,26 @@ |
|
|
|
* Signature: (IJ)J |
|
|
|
* Signature: (IJ)J |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
jlong Java_org_rocksdb_Statistics_getTickerCount0( |
|
|
|
jlong Java_org_rocksdb_Statistics_getTickerCount0( |
|
|
|
JNIEnv* env, jobject jobj, int ticker, jlong handle) { |
|
|
|
JNIEnv* env, jobject jobj, int tickerType, jlong handle) { |
|
|
|
auto st = reinterpret_cast<rocksdb::Statistics*>(handle); |
|
|
|
auto st = reinterpret_cast<rocksdb::Statistics*>(handle); |
|
|
|
assert(st != nullptr); |
|
|
|
assert(st != nullptr); |
|
|
|
|
|
|
|
|
|
|
|
return st->getTickerCount(static_cast<rocksdb::Tickers>(ticker)); |
|
|
|
return st->getTickerCount(static_cast<rocksdb::Tickers>(tickerType)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jobject Java_org_rocksdb_Statistics_geHistogramData0( |
|
|
|
|
|
|
|
JNIEnv* env, jobject jobj, int histogramType, jlong handle) { |
|
|
|
|
|
|
|
auto st = reinterpret_cast<rocksdb::Statistics*>(handle); |
|
|
|
|
|
|
|
assert(st != nullptr); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rocksdb::HistogramData data; |
|
|
|
|
|
|
|
st->histogramData(static_cast<rocksdb::Histograms>(histogramType), |
|
|
|
|
|
|
|
&data); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Don't reuse class pointer
|
|
|
|
|
|
|
|
jclass jclazz = env->FindClass("org/rocksdb/HistogramData"); |
|
|
|
|
|
|
|
jmethodID mid = rocksdb::HistogramDataJni::getConstructorMethodId( |
|
|
|
|
|
|
|
env, jclazz); |
|
|
|
|
|
|
|
return env->NewObject(jclazz, mid, data.median, data.percentile95, |
|
|
|
|
|
|
|
data.percentile99, data.average, data.standard_deviation); |
|
|
|
} |
|
|
|
} |
|
|
|