-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
170 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, S.A. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package rocksdb | ||
|
||
// #include "extended.h" | ||
import ( | ||
"C" | ||
) | ||
|
||
type HistogramData struct { | ||
c *C.rocksdb_histogram_data_t | ||
} | ||
|
||
// NewHistogramData constructs a HistogramData object. | ||
func NewHistogramData() *HistogramData { | ||
return &HistogramData{c: C.rocksdb_histogram_create_data()} | ||
} | ||
|
||
// GetAverage returns the average value. | ||
func (d *HistogramData) GetAverage() float64 { | ||
return float64(C.rocksdb_histogram_get_average(d.c)) | ||
} | ||
|
||
// GetMedian returns the median value. | ||
func (d *HistogramData) GetMedian() float64 { | ||
return float64(C.rocksdb_histogram_get_median(d.c)) | ||
} | ||
|
||
// GetPercentile95 returns the value of the percentile 95. | ||
func (d *HistogramData) GetPercentile95() float64 { | ||
return float64(C.rocksdb_histogram_get_percentile95(d.c)) | ||
} | ||
|
||
// GetPercentile99 returns the value of the percentile 99. | ||
func (d *HistogramData) GetPercentile99() float64 { | ||
return float64(C.rocksdb_histogram_get_percentile99(d.c)) | ||
} | ||
|
||
// GetStandardDeviation returns the value of the standard deviation. | ||
func (d *HistogramData) GetStandardDeviation() float64 { | ||
return float64(C.rocksdb_histogram_get_stdev(d.c)) | ||
} | ||
|
||
// GetMax returns the max value. | ||
func (d *HistogramData) GetMax() float64 { | ||
return float64(C.rocksdb_histogram_get_max(d.c)) | ||
} | ||
|
||
// GetCount returns the total number of measure. | ||
func (d *HistogramData) GetCount() uint64 { | ||
return uint64(C.rocksdb_histogram_get_count(d.c)) | ||
} | ||
|
||
// GetSum returns the sum of all measures. | ||
func (d *HistogramData) GetSum() uint64 { | ||
return uint64(C.rocksdb_histogram_get_sum(d.c)) | ||
} | ||
|
||
// GetMin returns the min value. | ||
func (d *HistogramData) GetMin() float64 { | ||
return float64(C.rocksdb_histogram_get_min(d.c)) | ||
} | ||
|
||
// Destroy deallocates the HistogramData object. | ||
func (d *HistogramData) Destroy() { | ||
C.rocksdb_histogram_data_destroy(d.c) | ||
d.c = nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, S.A. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package rocksdb | ||
|
||
// #include "extended.h" | ||
import ( | ||
"C" | ||
) | ||
|
||
// HistogramType is the logical mapping of histograms defined in rocksdb:Histogram. | ||
type HistogramType uint32 | ||
|
||
const ( | ||
// HistogramBytesPerRead is value size distribution in read operations. | ||
HistogramBytesPerRead = HistogramType(C.BYTES_PER_READ) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, S.A. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package rocksdb | ||
|
||
// #include "extended.h" | ||
import ( | ||
"C" | ||
) | ||
|
||
// TickerType is the logical mapping of tickers defined in rocksdb::Tickers. | ||
type TickerType uint32 | ||
|
||
const ( | ||
// TickerBytesWritten is the number of uncompressed bytes issued by db.Put(), | ||
// db.Delete(), db.Merge(), and db.Write(). | ||
TickerBytesWritten = TickerType(C.BYTES_WRITTEN) | ||
// TickerBytesRead is the number of uncompressed bytes read from db.Get(). | ||
// It could be either from memtables, cache, or table files. | ||
// For the number of logical bytes read from db.MultiGet(), | ||
// please use NumberMultiGetBytesRead. | ||
TickerBytesRead = TickerType(C.BYTES_READ) | ||
) |