statisticsjni.cc 1.0 KB

1234567891011121314151617181920212223242526272829303132
  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. #include "rocksjni/statisticsjni.h"
  9. namespace ROCKSDB_NAMESPACE {
  10. StatisticsJni::StatisticsJni(std::shared_ptr<Statistics> stats)
  11. : StatisticsImpl(stats), m_ignore_histograms() {}
  12. StatisticsJni::StatisticsJni(std::shared_ptr<Statistics> stats,
  13. const std::set<uint32_t> ignore_histograms)
  14. : StatisticsImpl(stats), m_ignore_histograms(ignore_histograms) {}
  15. bool StatisticsJni::HistEnabledForType(uint32_t type) const {
  16. if (type >= HISTOGRAM_ENUM_MAX) {
  17. return false;
  18. }
  19. if (m_ignore_histograms.count(type) > 0) {
  20. return false;
  21. }
  22. return true;
  23. }
  24. // @lint-ignore TXT4 T25377293 Grandfathered in
  25. }; // namespace ROCKSDB_NAMESPACE