1 // Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
2 //  This source code is licensed under both the GPLv2 (found in the
3 //  COPYING file in the root directory) and Apache 2.0 License
4 //  (found in the LICENSE.Apache file in the root directory).
5 //
6 // This file implements the callback "bridge" between Java and C++ for
7 // ROCKSDB_NAMESPACE::Statistics
8 
9 #include "rocksjni/statisticsjni.h"
10 
11 namespace ROCKSDB_NAMESPACE {
12 
StatisticsJni(std::shared_ptr<Statistics> stats)13 StatisticsJni::StatisticsJni(std::shared_ptr<Statistics> stats)
14     : StatisticsImpl(stats), m_ignore_histograms() {}
15 
StatisticsJni(std::shared_ptr<Statistics> stats,const std::set<uint32_t> ignore_histograms)16 StatisticsJni::StatisticsJni(std::shared_ptr<Statistics> stats,
17                              const std::set<uint32_t> ignore_histograms)
18     : StatisticsImpl(stats), m_ignore_histograms(ignore_histograms) {}
19 
HistEnabledForType(uint32_t type) const20 bool StatisticsJni::HistEnabledForType(uint32_t type) const {
21   if (type >= HISTOGRAM_ENUM_MAX) {
22     return false;
23   }
24 
25   if (m_ignore_histograms.count(type) > 0) {
26     return false;
27   }
28 
29   return true;
30 }
31 // @lint-ignore TXT4 T25377293 Grandfathered in
32 };  // namespace ROCKSDB_NAMESPACE