sync_point.cc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #include "test_util/sync_point.h"
  6. #include "test_util/sync_point_impl.h"
  7. int rocksdb_kill_odds = 0;
  8. std::vector<std::string> rocksdb_kill_prefix_blacklist;
  9. #ifndef NDEBUG
  10. namespace ROCKSDB_NAMESPACE {
  11. SyncPoint* SyncPoint::GetInstance() {
  12. static SyncPoint sync_point;
  13. return &sync_point;
  14. }
  15. SyncPoint::SyncPoint() : impl_(new Data) {}
  16. SyncPoint:: ~SyncPoint() {
  17. delete impl_;
  18. }
  19. void SyncPoint::LoadDependency(const std::vector<SyncPointPair>& dependencies) {
  20. impl_->LoadDependency(dependencies);
  21. }
  22. void SyncPoint::LoadDependencyAndMarkers(
  23. const std::vector<SyncPointPair>& dependencies,
  24. const std::vector<SyncPointPair>& markers) {
  25. impl_->LoadDependencyAndMarkers(dependencies, markers);
  26. }
  27. void SyncPoint::SetCallBack(const std::string& point,
  28. const std::function<void(void*)>& callback) {
  29. impl_->SetCallBack(point, callback);
  30. }
  31. void SyncPoint::ClearCallBack(const std::string& point) {
  32. impl_->ClearCallBack(point);
  33. }
  34. void SyncPoint::ClearAllCallBacks() {
  35. impl_->ClearAllCallBacks();
  36. }
  37. void SyncPoint::EnableProcessing() {
  38. impl_->EnableProcessing();
  39. }
  40. void SyncPoint::DisableProcessing() {
  41. impl_->DisableProcessing();
  42. }
  43. void SyncPoint::ClearTrace() {
  44. impl_->ClearTrace();
  45. }
  46. void SyncPoint::Process(const std::string& point, void* cb_arg) {
  47. impl_->Process(point, cb_arg);
  48. }
  49. } // namespace ROCKSDB_NAMESPACE
  50. #endif // NDEBUG