@ -23,41 +23,26 @@
namespace rocksdb {
namespace rocksdb {
HistogramBucketMapper : : HistogramBucketMapper ( )
HistogramBucketMapper : : HistogramBucketMapper ( ) {
:
// Add newer bucket index here.
// Should be always added in sorted order.
// If you change this, you also need to change
// If you change this, you also need to change
// size of array buckets_ in HistogramImpl
// size of array buckets_ in HistogramImpl
bucketValues_ (
bucketValues_ = { 1 , 2 } ;
{ 1 , 2 , 3 , 4 , 5 , 6 ,
valueIndexMap_ = { { 1 , 0 } , { 2 , 1 } } ;
7 , 8 , 9 , 10 , 12 , 14 ,
double bucket_val = static_cast < double > ( bucketValues_ . back ( ) ) ;
16 , 18 , 20 , 25 , 30 , 35 ,
while ( ( bucket_val = 1.5 * bucket_val ) < = static_cast < double > ( port : : kMaxUint64 ) ) {
40 , 45 , 50 , 60 , 70 , 80 ,
bucketValues_ . push_back ( static_cast < uint64_t > ( bucket_val ) ) ;
90 , 100 , 120 , 140 , 160 , 180 ,
// Extracts two most significant digits to make histogram buckets more
200 , 250 , 300 , 350 , 400 , 450 ,
// human-readable. E.g., 172 becomes 170.
500 , 600 , 700 , 800 , 900 , 1000 ,
uint64_t pow_of_ten = 1 ;
1200 , 1400 , 1600 , 1800 , 2000 , 2500 ,
while ( bucketValues_ . back ( ) / 10 > 10 ) {
3000 , 3500 , 4000 , 4500 , 5000 , 6000 ,
bucketValues_ . back ( ) / = 10 ;
7000 , 8000 , 9000 , 10000 , 12000 , 14000 ,
pow_of_ten * = 10 ;
16000 , 18000 , 20000 , 25000 , 30000 , 35000 ,
}
40000 , 45000 , 50000 , 60000 , 70000 , 80000 ,
bucketValues_ . back ( ) * = pow_of_ten ;
90000 , 100000 , 120000 , 140000 , 160000 , 180000 ,
valueIndexMap_ [ bucketValues_ . back ( ) ] = bucketValues_ . size ( ) - 1 ;
200000 , 250000 , 300000 , 350000 , 400000 , 450000 ,
}
500000 , 600000 , 700000 , 800000 , 900000 , 1000000 ,
maxBucketValue_ = bucketValues_ . back ( ) ;
1200000 , 1400000 , 1600000 , 1800000 , 2000000 , 2500000 ,
minBucketValue_ = bucketValues_ . front ( ) ;
3000000 , 3500000 , 4000000 , 4500000 , 5000000 , 6000000 ,
7000000 , 8000000 , 9000000 , 10000000 , 12000000 , 14000000 ,
16000000 , 18000000 , 20000000 , 25000000 , 30000000 , 35000000 ,
40000000 , 45000000 , 50000000 , 60000000 , 70000000 , 80000000 ,
90000000 , 100000000 , 120000000 , 140000000 , 160000000 , 180000000 ,
200000000 , 250000000 , 300000000 , 350000000 , 400000000 , 450000000 ,
500000000 , 600000000 , 700000000 , 800000000 , 900000000 , 1000000000 } ) ,
maxBucketValue_ ( bucketValues_ . back ( ) ) ,
minBucketValue_ ( bucketValues_ . front ( ) ) {
for ( size_t i = 0 ; i < bucketValues_ . size ( ) ; + + i ) {
valueIndexMap_ [ bucketValues_ [ i ] ] = i ;
}
}
}
size_t HistogramBucketMapper : : IndexForValue ( const uint64_t value ) const {
size_t HistogramBucketMapper : : IndexForValue ( const uint64_t value ) const {