rn-leveldb 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +92 -0
- package/android/.project +34 -0
- package/android/.settings/org.eclipse.buildship.core.prefs +13 -0
- package/android/CMakeLists.txt +69 -0
- package/android/build.gradle +125 -0
- package/android/cpp-adapter.cpp +19 -0
- package/android/gradle.properties +6 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/reactnativeleveldb/LeveldbModule.java +57 -0
- package/android/src/main/java/com/reactnativeleveldb/LeveldbPackage.java +28 -0
- package/cpp/leveldb/.appveyor.yml +36 -0
- package/cpp/leveldb/.clang-format +18 -0
- package/cpp/leveldb/.travis.yml +88 -0
- package/cpp/leveldb/AUTHORS +12 -0
- package/cpp/leveldb/CMakeLists.txt +495 -0
- package/cpp/leveldb/CONTRIBUTING.md +36 -0
- package/cpp/leveldb/LICENSE +27 -0
- package/cpp/leveldb/NEWS +17 -0
- package/cpp/leveldb/README.md +231 -0
- package/cpp/leveldb/TODO +14 -0
- package/cpp/leveldb/benchmarks/db_bench.cc +990 -0
- package/cpp/leveldb/benchmarks/db_bench_sqlite3.cc +726 -0
- package/cpp/leveldb/benchmarks/db_bench_tree_db.cc +531 -0
- package/cpp/leveldb/cmake/leveldbConfig.cmake.in +9 -0
- package/cpp/leveldb/db/autocompact_test.cc +115 -0
- package/cpp/leveldb/db/builder.cc +82 -0
- package/cpp/leveldb/db/builder.h +30 -0
- package/cpp/leveldb/db/c.cc +562 -0
- package/cpp/leveldb/db/c_test.c +384 -0
- package/cpp/leveldb/db/corruption_test.cc +367 -0
- package/cpp/leveldb/db/db_impl.cc +1554 -0
- package/cpp/leveldb/db/db_impl.h +217 -0
- package/cpp/leveldb/db/db_iter.cc +318 -0
- package/cpp/leveldb/db/db_iter.h +26 -0
- package/cpp/leveldb/db/db_test.cc +2305 -0
- package/cpp/leveldb/db/dbformat.cc +136 -0
- package/cpp/leveldb/db/dbformat.h +224 -0
- package/cpp/leveldb/db/dbformat_test.cc +133 -0
- package/cpp/leveldb/db/dumpfile.cc +232 -0
- package/cpp/leveldb/db/fault_injection_test.cc +555 -0
- package/cpp/leveldb/db/filename.cc +141 -0
- package/cpp/leveldb/db/filename.h +83 -0
- package/cpp/leveldb/db/filename_test.cc +132 -0
- package/cpp/leveldb/db/leveldbutil.cc +64 -0
- package/cpp/leveldb/db/log_format.h +35 -0
- package/cpp/leveldb/db/log_reader.cc +274 -0
- package/cpp/leveldb/db/log_reader.h +112 -0
- package/cpp/leveldb/db/log_test.cc +563 -0
- package/cpp/leveldb/db/log_writer.cc +111 -0
- package/cpp/leveldb/db/log_writer.h +54 -0
- package/cpp/leveldb/db/memtable.cc +137 -0
- package/cpp/leveldb/db/memtable.h +87 -0
- package/cpp/leveldb/db/recovery_test.cc +339 -0
- package/cpp/leveldb/db/repair.cc +451 -0
- package/cpp/leveldb/db/skiplist.h +382 -0
- package/cpp/leveldb/db/skiplist_test.cc +373 -0
- package/cpp/leveldb/db/snapshot.h +95 -0
- package/cpp/leveldb/db/table_cache.cc +120 -0
- package/cpp/leveldb/db/table_cache.h +57 -0
- package/cpp/leveldb/db/version_edit.cc +257 -0
- package/cpp/leveldb/db/version_edit.h +106 -0
- package/cpp/leveldb/db/version_edit_test.cc +46 -0
- package/cpp/leveldb/db/version_set.cc +1562 -0
- package/cpp/leveldb/db/version_set.h +393 -0
- package/cpp/leveldb/db/version_set_test.cc +336 -0
- package/cpp/leveldb/db/write_batch.cc +150 -0
- package/cpp/leveldb/db/write_batch_internal.h +45 -0
- package/cpp/leveldb/db/write_batch_test.cc +137 -0
- package/cpp/leveldb/doc/benchmark.html +459 -0
- package/cpp/leveldb/doc/impl.md +172 -0
- package/cpp/leveldb/doc/index.md +523 -0
- package/cpp/leveldb/doc/log_format.md +75 -0
- package/cpp/leveldb/doc/table_format.md +107 -0
- package/cpp/leveldb/helpers/memenv/memenv.cc +390 -0
- package/cpp/leveldb/helpers/memenv/memenv.h +22 -0
- package/cpp/leveldb/helpers/memenv/memenv_test.cc +264 -0
- package/cpp/leveldb/include/leveldb/c.h +270 -0
- package/cpp/leveldb/include/leveldb/cache.h +111 -0
- package/cpp/leveldb/include/leveldb/comparator.h +64 -0
- package/cpp/leveldb/include/leveldb/db.h +167 -0
- package/cpp/leveldb/include/leveldb/dumpfile.h +28 -0
- package/cpp/leveldb/include/leveldb/env.h +417 -0
- package/cpp/leveldb/include/leveldb/export.h +33 -0
- package/cpp/leveldb/include/leveldb/filter_policy.h +72 -0
- package/cpp/leveldb/include/leveldb/iterator.h +112 -0
- package/cpp/leveldb/include/leveldb/options.h +187 -0
- package/cpp/leveldb/include/leveldb/slice.h +114 -0
- package/cpp/leveldb/include/leveldb/status.h +122 -0
- package/cpp/leveldb/include/leveldb/table.h +84 -0
- package/cpp/leveldb/include/leveldb/table_builder.h +93 -0
- package/cpp/leveldb/include/leveldb/write_batch.h +83 -0
- package/cpp/leveldb/issues/issue178_test.cc +90 -0
- package/cpp/leveldb/issues/issue200_test.cc +59 -0
- package/cpp/leveldb/issues/issue320_test.cc +131 -0
- package/cpp/leveldb/port/README.md +10 -0
- package/cpp/leveldb/port/port.h +19 -0
- package/cpp/leveldb/port/port_config.h.in +33 -0
- package/cpp/leveldb/port/port_example.h +100 -0
- package/cpp/leveldb/port/port_stdcxx.h +151 -0
- package/cpp/leveldb/port/thread_annotations.h +108 -0
- package/cpp/leveldb/table/block.cc +267 -0
- package/cpp/leveldb/table/block.h +44 -0
- package/cpp/leveldb/table/block_builder.cc +107 -0
- package/cpp/leveldb/table/block_builder.h +54 -0
- package/cpp/leveldb/table/filter_block.cc +106 -0
- package/cpp/leveldb/table/filter_block.h +68 -0
- package/cpp/leveldb/table/filter_block_test.cc +127 -0
- package/cpp/leveldb/table/format.cc +141 -0
- package/cpp/leveldb/table/format.h +99 -0
- package/cpp/leveldb/table/iterator.cc +76 -0
- package/cpp/leveldb/table/iterator_wrapper.h +92 -0
- package/cpp/leveldb/table/merger.cc +191 -0
- package/cpp/leveldb/table/merger.h +26 -0
- package/cpp/leveldb/table/table.cc +271 -0
- package/cpp/leveldb/table/table_builder.cc +265 -0
- package/cpp/leveldb/table/table_test.cc +834 -0
- package/cpp/leveldb/table/two_level_iterator.cc +171 -0
- package/cpp/leveldb/table/two_level_iterator.h +31 -0
- package/cpp/leveldb/third_party/benchmark/.clang-format +5 -0
- package/cpp/leveldb/third_party/benchmark/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
- package/cpp/leveldb/third_party/benchmark/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/cpp/leveldb/third_party/benchmark/.github/workflows/build-and-test.yml +38 -0
- package/cpp/leveldb/third_party/benchmark/.github/workflows/pylint.yml +26 -0
- package/cpp/leveldb/third_party/benchmark/.github/workflows/test_bindings.yml +24 -0
- package/cpp/leveldb/third_party/benchmark/.travis-libcxx-setup.sh +28 -0
- package/cpp/leveldb/third_party/benchmark/.travis.yml +231 -0
- package/cpp/leveldb/third_party/benchmark/.ycm_extra_conf.py +115 -0
- package/cpp/leveldb/third_party/benchmark/AUTHORS +58 -0
- package/cpp/leveldb/third_party/benchmark/BUILD.bazel +44 -0
- package/cpp/leveldb/third_party/benchmark/CMakeLists.txt +287 -0
- package/cpp/leveldb/third_party/benchmark/CONTRIBUTING.md +58 -0
- package/cpp/leveldb/third_party/benchmark/CONTRIBUTORS +83 -0
- package/cpp/leveldb/third_party/benchmark/LICENSE +202 -0
- package/cpp/leveldb/third_party/benchmark/README.md +1323 -0
- package/cpp/leveldb/third_party/benchmark/WORKSPACE +51 -0
- package/cpp/leveldb/third_party/benchmark/_config.yml +1 -0
- package/cpp/leveldb/third_party/benchmark/appveyor.yml +50 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/BUILD +3 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/build_defs.bzl +25 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/google_benchmark/BUILD +38 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/google_benchmark/__init__.py +156 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/google_benchmark/benchmark.cc +180 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/google_benchmark/example.py +136 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/pybind11.BUILD +20 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/python_headers.BUILD +6 -0
- package/cpp/leveldb/third_party/benchmark/bindings/python/requirements.txt +2 -0
- package/cpp/leveldb/third_party/benchmark/cmake/AddCXXCompilerFlag.cmake +74 -0
- package/cpp/leveldb/third_party/benchmark/cmake/CXXFeatureCheck.cmake +69 -0
- package/cpp/leveldb/third_party/benchmark/cmake/Config.cmake.in +1 -0
- package/cpp/leveldb/third_party/benchmark/cmake/GetGitVersion.cmake +54 -0
- package/cpp/leveldb/third_party/benchmark/cmake/GoogleTest.cmake +41 -0
- package/cpp/leveldb/third_party/benchmark/cmake/GoogleTest.cmake.in +58 -0
- package/cpp/leveldb/third_party/benchmark/cmake/benchmark.pc.in +12 -0
- package/cpp/leveldb/third_party/benchmark/cmake/gnu_posix_regex.cpp +12 -0
- package/cpp/leveldb/third_party/benchmark/cmake/llvm-toolchain.cmake +8 -0
- package/cpp/leveldb/third_party/benchmark/cmake/posix_regex.cpp +14 -0
- package/cpp/leveldb/third_party/benchmark/cmake/split_list.cmake +3 -0
- package/cpp/leveldb/third_party/benchmark/cmake/std_regex.cpp +10 -0
- package/cpp/leveldb/third_party/benchmark/cmake/steady_clock.cpp +7 -0
- package/cpp/leveldb/third_party/benchmark/cmake/thread_safety_attributes.cpp +4 -0
- package/cpp/leveldb/third_party/benchmark/conan/CMakeLists.txt +7 -0
- package/cpp/leveldb/third_party/benchmark/conan/test_package/CMakeLists.txt +10 -0
- package/cpp/leveldb/third_party/benchmark/conan/test_package/conanfile.py +19 -0
- package/cpp/leveldb/third_party/benchmark/conan/test_package/test_package.cpp +18 -0
- package/cpp/leveldb/third_party/benchmark/conanfile.py +79 -0
- package/cpp/leveldb/third_party/benchmark/dependencies.md +18 -0
- package/cpp/leveldb/third_party/benchmark/docs/AssemblyTests.md +147 -0
- package/cpp/leveldb/third_party/benchmark/docs/_config.yml +1 -0
- package/cpp/leveldb/third_party/benchmark/docs/releasing.md +16 -0
- package/cpp/leveldb/third_party/benchmark/docs/tools.md +203 -0
- package/cpp/leveldb/third_party/benchmark/include/benchmark/benchmark.h +1604 -0
- package/cpp/leveldb/third_party/benchmark/requirements.txt +2 -0
- package/cpp/leveldb/third_party/benchmark/setup.py +140 -0
- package/cpp/leveldb/third_party/benchmark/src/CMakeLists.txt +114 -0
- package/cpp/leveldb/third_party/benchmark/src/arraysize.h +33 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark.cc +499 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_api_internal.cc +15 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_api_internal.h +53 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_main.cc +17 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_name.cc +58 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_register.cc +515 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_register.h +108 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_runner.cc +362 -0
- package/cpp/leveldb/third_party/benchmark/src/benchmark_runner.h +51 -0
- package/cpp/leveldb/third_party/benchmark/src/check.h +82 -0
- package/cpp/leveldb/third_party/benchmark/src/colorprint.cc +188 -0
- package/cpp/leveldb/third_party/benchmark/src/colorprint.h +33 -0
- package/cpp/leveldb/third_party/benchmark/src/commandlineflags.cc +228 -0
- package/cpp/leveldb/third_party/benchmark/src/commandlineflags.h +103 -0
- package/cpp/leveldb/third_party/benchmark/src/complexity.cc +238 -0
- package/cpp/leveldb/third_party/benchmark/src/complexity.h +55 -0
- package/cpp/leveldb/third_party/benchmark/src/console_reporter.cc +177 -0
- package/cpp/leveldb/third_party/benchmark/src/counter.cc +80 -0
- package/cpp/leveldb/third_party/benchmark/src/counter.h +32 -0
- package/cpp/leveldb/third_party/benchmark/src/csv_reporter.cc +154 -0
- package/cpp/leveldb/third_party/benchmark/src/cycleclock.h +211 -0
- package/cpp/leveldb/third_party/benchmark/src/internal_macros.h +102 -0
- package/cpp/leveldb/third_party/benchmark/src/json_reporter.cc +255 -0
- package/cpp/leveldb/third_party/benchmark/src/log.h +74 -0
- package/cpp/leveldb/third_party/benchmark/src/mutex.h +155 -0
- package/cpp/leveldb/third_party/benchmark/src/re.h +158 -0
- package/cpp/leveldb/third_party/benchmark/src/reporter.cc +105 -0
- package/cpp/leveldb/third_party/benchmark/src/sleep.cc +67 -0
- package/cpp/leveldb/third_party/benchmark/src/sleep.h +15 -0
- package/cpp/leveldb/third_party/benchmark/src/statistics.cc +193 -0
- package/cpp/leveldb/third_party/benchmark/src/statistics.h +37 -0
- package/cpp/leveldb/third_party/benchmark/src/string_util.cc +255 -0
- package/cpp/leveldb/third_party/benchmark/src/string_util.h +59 -0
- package/cpp/leveldb/third_party/benchmark/src/sysinfo.cc +716 -0
- package/cpp/leveldb/third_party/benchmark/src/thread_manager.h +64 -0
- package/cpp/leveldb/third_party/benchmark/src/thread_timer.h +86 -0
- package/cpp/leveldb/third_party/benchmark/src/timers.cc +245 -0
- package/cpp/leveldb/third_party/benchmark/src/timers.h +48 -0
- package/cpp/leveldb/third_party/benchmark/test/AssemblyTests.cmake +46 -0
- package/cpp/leveldb/third_party/benchmark/test/BUILD +73 -0
- package/cpp/leveldb/third_party/benchmark/test/CMakeLists.txt +263 -0
- package/cpp/leveldb/third_party/benchmark/test/args_product_test.cc +77 -0
- package/cpp/leveldb/third_party/benchmark/test/basic_test.cc +136 -0
- package/cpp/leveldb/third_party/benchmark/test/benchmark_gtest.cc +134 -0
- package/cpp/leveldb/third_party/benchmark/test/benchmark_name_gtest.cc +74 -0
- package/cpp/leveldb/third_party/benchmark/test/benchmark_test.cc +245 -0
- package/cpp/leveldb/third_party/benchmark/test/clobber_memory_assembly_test.cc +64 -0
- package/cpp/leveldb/third_party/benchmark/test/commandlineflags_gtest.cc +201 -0
- package/cpp/leveldb/third_party/benchmark/test/complexity_test.cc +213 -0
- package/cpp/leveldb/third_party/benchmark/test/cxx03_test.cc +63 -0
- package/cpp/leveldb/third_party/benchmark/test/diagnostics_test.cc +80 -0
- package/cpp/leveldb/third_party/benchmark/test/display_aggregates_only_test.cc +43 -0
- package/cpp/leveldb/third_party/benchmark/test/donotoptimize_assembly_test.cc +163 -0
- package/cpp/leveldb/third_party/benchmark/test/donotoptimize_test.cc +52 -0
- package/cpp/leveldb/third_party/benchmark/test/filter_test.cc +104 -0
- package/cpp/leveldb/third_party/benchmark/test/fixture_test.cc +51 -0
- package/cpp/leveldb/third_party/benchmark/test/internal_threading_test.cc +184 -0
- package/cpp/leveldb/third_party/benchmark/test/link_main_test.cc +8 -0
- package/cpp/leveldb/third_party/benchmark/test/map_test.cc +57 -0
- package/cpp/leveldb/third_party/benchmark/test/memory_manager_test.cc +44 -0
- package/cpp/leveldb/third_party/benchmark/test/multiple_ranges_test.cc +96 -0
- package/cpp/leveldb/third_party/benchmark/test/options_test.cc +75 -0
- package/cpp/leveldb/third_party/benchmark/test/output_test.h +213 -0
- package/cpp/leveldb/third_party/benchmark/test/output_test_helper.cc +515 -0
- package/cpp/leveldb/third_party/benchmark/test/register_benchmark_test.cc +184 -0
- package/cpp/leveldb/third_party/benchmark/test/report_aggregates_only_test.cc +39 -0
- package/cpp/leveldb/third_party/benchmark/test/reporter_output_test.cc +747 -0
- package/cpp/leveldb/third_party/benchmark/test/skip_with_error_test.cc +195 -0
- package/cpp/leveldb/third_party/benchmark/test/state_assembly_test.cc +68 -0
- package/cpp/leveldb/third_party/benchmark/test/statistics_gtest.cc +28 -0
- package/cpp/leveldb/third_party/benchmark/test/string_util_gtest.cc +153 -0
- package/cpp/leveldb/third_party/benchmark/test/templated_fixture_test.cc +28 -0
- package/cpp/leveldb/third_party/benchmark/test/user_counters_tabular_test.cc +285 -0
- package/cpp/leveldb/third_party/benchmark/test/user_counters_test.cc +531 -0
- package/cpp/leveldb/third_party/benchmark/test/user_counters_thousands_test.cc +173 -0
- package/cpp/leveldb/third_party/benchmark/tools/BUILD.bazel +19 -0
- package/cpp/leveldb/third_party/benchmark/tools/compare.py +429 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test1_run1.json +119 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test1_run2.json +119 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test2_run.json +81 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test3_run0.json +65 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/Inputs/test3_run1.json +65 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/__init__.py +8 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/report.py +903 -0
- package/cpp/leveldb/third_party/benchmark/tools/gbench/util.py +163 -0
- package/cpp/leveldb/third_party/benchmark/tools/requirements.txt +1 -0
- package/cpp/leveldb/third_party/benchmark/tools/strip_asm.py +151 -0
- package/cpp/leveldb/third_party/googletest/.clang-format +4 -0
- package/cpp/leveldb/third_party/googletest/.travis.yml +73 -0
- package/cpp/leveldb/third_party/googletest/BUILD.bazel +179 -0
- package/cpp/leveldb/third_party/googletest/CMakeLists.txt +36 -0
- package/cpp/leveldb/third_party/googletest/CONTRIBUTING.md +142 -0
- package/cpp/leveldb/third_party/googletest/LICENSE +28 -0
- package/cpp/leveldb/third_party/googletest/README.md +132 -0
- package/cpp/leveldb/third_party/googletest/WORKSPACE +23 -0
- package/cpp/leveldb/third_party/googletest/appveyor.yml +154 -0
- package/cpp/leveldb/third_party/googletest/ci/build-linux-bazel.sh +37 -0
- package/cpp/leveldb/third_party/googletest/ci/build-platformio.sh +2 -0
- package/cpp/leveldb/third_party/googletest/ci/env-linux.sh +41 -0
- package/cpp/leveldb/third_party/googletest/ci/env-osx.sh +47 -0
- package/cpp/leveldb/third_party/googletest/ci/get-nprocessors.sh +48 -0
- package/cpp/leveldb/third_party/googletest/ci/install-linux.sh +49 -0
- package/cpp/leveldb/third_party/googletest/ci/install-osx.sh +40 -0
- package/cpp/leveldb/third_party/googletest/ci/install-platformio.sh +5 -0
- package/cpp/leveldb/third_party/googletest/ci/log-config.sh +51 -0
- package/cpp/leveldb/third_party/googletest/ci/travis.sh +44 -0
- package/cpp/leveldb/third_party/googletest/googlemock/CMakeLists.txt +233 -0
- package/cpp/leveldb/third_party/googletest/googlemock/CONTRIBUTORS +40 -0
- package/cpp/leveldb/third_party/googletest/googlemock/LICENSE +28 -0
- package/cpp/leveldb/third_party/googletest/googlemock/README.md +44 -0
- package/cpp/leveldb/third_party/googletest/googlemock/cmake/gmock.pc.in +10 -0
- package/cpp/leveldb/third_party/googletest/googlemock/cmake/gmock_main.pc.in +10 -0
- package/cpp/leveldb/third_party/googletest/googlemock/docs/cheat_sheet.md +770 -0
- package/cpp/leveldb/third_party/googletest/googlemock/docs/cook_book.md +4270 -0
- package/cpp/leveldb/third_party/googletest/googlemock/docs/for_dummies.md +700 -0
- package/cpp/leveldb/third_party/googletest/googlemock/docs/gmock_faq.md +396 -0
- package/cpp/leveldb/third_party/googletest/googlemock/docs/pump_manual.md +187 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-actions.h +1193 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-cardinalities.h +157 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-function-mocker.h +276 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-actions.h +1884 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-actions.h.pump +627 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h +752 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-function-mockers.h.pump +227 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-matchers.h +1097 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-generated-matchers.h.pump +346 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-matchers.h +4591 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-more-actions.h +162 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-more-matchers.h +92 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-nice-strict.h +215 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock-spec-builders.h +1985 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/gmock.h +101 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/README.md +16 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h +10 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump +12 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h +36 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/custom/gmock-port.h +39 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/gmock-internal-utils.h +472 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/gmock-port.h +87 -0
- package/cpp/leveldb/third_party/googletest/googlemock/include/gmock/internal/gmock-pp.h +271 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/README.md +5 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/fuse_gmock_files.py +240 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/LICENSE +203 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/README +34 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/README.cppclean +115 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/__init__.py +0 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/ast.py +1761 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/gmock_class.py +248 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/gmock_class_test.py +540 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/keywords.py +56 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/tokenize.py +284 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/cpp/utils.py +37 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/generator/gmock_gen.py +30 -0
- package/cpp/leveldb/third_party/googletest/googlemock/scripts/pump.py +856 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-all.cc +46 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-cardinalities.cc +155 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-internal-utils.cc +200 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-matchers.cc +462 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock-spec-builders.cc +892 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock.cc +213 -0
- package/cpp/leveldb/third_party/googletest/googlemock/src/gmock_main.cc +72 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/BUILD.bazel +110 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-actions_test.cc +1507 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-cardinalities_test.cc +429 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-function-mocker_nc.cc +16 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-function-mocker_nc_test.py +43 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-function-mocker_test.cc +696 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-generated-actions_test.cc +1064 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-generated-function-mockers_test.cc +659 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-generated-matchers_test.cc +1323 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-internal-utils_test.cc +732 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-matchers_test.cc +6913 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-more-actions_test.cc +698 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-nice-strict_test.cc +500 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-port_test.cc +42 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-pp-string_test.cc +206 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-pp_test.cc +83 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock-spec-builders_test.cc +2775 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_all_test.cc +49 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_ex_test.cc +80 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_leak_test.py +104 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_leak_test_.cc +99 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_link2_test.cc +39 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_link_test.cc +39 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_link_test.h +690 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_output_test.py +183 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_output_test_.cc +309 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_output_test_golden.txt +317 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_stress_test.cc +240 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_test.cc +181 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/gmock_test_utils.py +108 -0
- package/cpp/leveldb/third_party/googletest/googlemock/test/pump_test.py +182 -0
- package/cpp/leveldb/third_party/googletest/googletest/CMakeLists.txt +329 -0
- package/cpp/leveldb/third_party/googletest/googletest/CONTRIBUTORS +38 -0
- package/cpp/leveldb/third_party/googletest/googletest/LICENSE +28 -0
- package/cpp/leveldb/third_party/googletest/googletest/README.md +244 -0
- package/cpp/leveldb/third_party/googletest/googletest/cmake/Config.cmake.in +9 -0
- package/cpp/leveldb/third_party/googletest/googletest/cmake/gtest.pc.in +9 -0
- package/cpp/leveldb/third_party/googletest/googletest/cmake/gtest_main.pc.in +10 -0
- package/cpp/leveldb/third_party/googletest/googletest/cmake/internal_utils.cmake +358 -0
- package/cpp/leveldb/third_party/googletest/googletest/cmake/libgtest.la.in +21 -0
- package/cpp/leveldb/third_party/googletest/googletest/docs/advanced.md +2567 -0
- package/cpp/leveldb/third_party/googletest/googletest/docs/faq.md +753 -0
- package/cpp/leveldb/third_party/googletest/googletest/docs/pkgconfig.md +219 -0
- package/cpp/leveldb/third_party/googletest/googletest/docs/primer.md +579 -0
- package/cpp/leveldb/third_party/googletest/googletest/docs/samples.md +22 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-death-test.h +343 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-matchers.h +750 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-message.h +219 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-param-test.h +514 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-printers.h +928 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-spi.h +238 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-test-part.h +184 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest-typed-test.h +337 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest.h +2477 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest_pred_impl.h +359 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/gtest_prod.h +61 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/custom/README.md +56 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/custom/gtest-port.h +37 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/custom/gtest-printers.h +42 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/custom/gtest.h +37 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-death-test-internal.h +304 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-filepath.h +211 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-internal.h +1411 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-param-util.h +880 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-port-arch.h +111 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-port.h +2227 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-string.h +171 -0
- package/cpp/leveldb/third_party/googletest/googletest/include/gtest/internal/gtest-type-util.h +183 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/prime_tables.h +126 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample1.cc +66 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample1.h +41 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample10_unittest.cc +139 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample1_unittest.cc +151 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample2.cc +54 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample2.h +81 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample2_unittest.cc +107 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample3-inl.h +172 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample3_unittest.cc +149 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample4.cc +54 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample4.h +53 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample4_unittest.cc +53 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample5_unittest.cc +196 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample6_unittest.cc +224 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample7_unittest.cc +117 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample8_unittest.cc +154 -0
- package/cpp/leveldb/third_party/googletest/googletest/samples/sample9_unittest.cc +156 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/README.md +5 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/common.py +83 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/fuse_gtest_files.py +253 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/gen_gtest_pred_impl.py +734 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/gtest-config.in +274 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/release_docs.py +158 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/run_with_path.py +32 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/upload.py +1402 -0
- package/cpp/leveldb/third_party/googletest/googletest/scripts/upload_gtest.py +78 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-all.cc +48 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-death-test.cc +1653 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-filepath.cc +382 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-internal-inl.h +1211 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-matchers.cc +97 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-port.cc +1399 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-printers.cc +442 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-test-part.cc +108 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest-typed-test.cc +118 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest.cc +6180 -0
- package/cpp/leveldb/third_party/googletest/googletest/src/gtest_main.cc +54 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/BUILD.bazel +529 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-break-on-failure-unittest.py +208 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-break-on-failure-unittest_.cc +86 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-catch-exceptions-test.py +236 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-catch-exceptions-test_.cc +293 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-color-test.py +127 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-color-test_.cc +62 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-death-test-test.cc +1516 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-death-test_ex_test.cc +92 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-env-var-test.py +117 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-env-var-test_.cc +122 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-filepath-test.cc +649 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-filter-unittest.py +639 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-filter-unittest_.cc +137 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-json-outfiles-test.py +191 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-json-output-unittest.py +778 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-list-tests-unittest.py +205 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-list-tests-unittest_.cc +156 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-listener-test.cc +518 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-message-test.cc +158 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-options-test.cc +216 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-output-test-golden-lin.txt +1137 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-output-test.py +346 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-output-test_.cc +1149 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-invalid-name1-test.py +63 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-invalid-name1-test_.cc +50 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-invalid-name2-test.py +62 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-invalid-name2-test_.cc +55 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-test.cc +1086 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test-test.h +51 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-param-test2-test.cc +61 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-port-test.cc +1272 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-printers-test.cc +1619 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-shuffle-test.py +323 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-shuffle-test_.cc +101 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-test-part-test.cc +230 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-test2_test.cc +61 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-throw-on-failure-test.py +168 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-throw-on-failure-test_.cc +71 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-uninitialized-test.py +67 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/googletest-uninitialized-test_.cc +42 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest-typed-test2_test.cc +44 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest-typed-test_test.cc +462 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest-typed-test_test.h +65 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest-unittest-api_test.cc +341 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_all_test.cc +46 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_assert_by_exception_test.cc +116 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_environment_test.cc +188 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_help_test.py +170 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_help_test_.cc +45 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_json_test_utils.py +60 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_list_output_unittest.py +141 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_list_output_unittest_.cc +51 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_main_unittest.cc +44 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_no_test_unittest.cc +54 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_pred_impl_unittest.cc +2427 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_premature_exit_test.cc +126 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_prod_test.cc +56 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_repeat_test.cc +233 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_skip_check_output_test.py +59 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_skip_environment_check_output_test.py +54 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc +49 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_skip_test.cc +55 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_sole_header_test.cc +56 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_stress_test.cc +248 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_test_macro_stack_footprint_test.cc +89 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_test_utils.py +314 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_testbridge_test.py +63 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_testbridge_test_.cc +43 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_throw_on_failure_ex_test.cc +90 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_unittest.cc +7496 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_outfile1_test_.cc +43 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_outfile2_test_.cc +43 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_outfiles_test.py +135 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_output_unittest.py +389 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_output_unittest_.cc +188 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/gtest_xml_test_utils.py +196 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/production.cc +35 -0
- package/cpp/leveldb/third_party/googletest/googletest/test/production.h +54 -0
- package/cpp/leveldb/third_party/googletest/library.json +66 -0
- package/cpp/leveldb/third_party/googletest/platformio.ini +47 -0
- package/cpp/leveldb/util/arena.cc +66 -0
- package/cpp/leveldb/util/arena.h +71 -0
- package/cpp/leveldb/util/arena_test.cc +66 -0
- package/cpp/leveldb/util/bloom.cc +92 -0
- package/cpp/leveldb/util/bloom_test.cc +159 -0
- package/cpp/leveldb/util/cache.cc +401 -0
- package/cpp/leveldb/util/cache_test.cc +229 -0
- package/cpp/leveldb/util/coding.cc +166 -0
- package/cpp/leveldb/util/coding.h +122 -0
- package/cpp/leveldb/util/coding_test.cc +198 -0
- package/cpp/leveldb/util/comparator.cc +75 -0
- package/cpp/leveldb/util/crc32c.cc +380 -0
- package/cpp/leveldb/util/crc32c.h +43 -0
- package/cpp/leveldb/util/crc32c_test.cc +61 -0
- package/cpp/leveldb/util/env.cc +108 -0
- package/cpp/leveldb/util/env_posix.cc +893 -0
- package/cpp/leveldb/util/env_posix_test.cc +353 -0
- package/cpp/leveldb/util/env_posix_test_helper.h +28 -0
- package/cpp/leveldb/util/env_test.cc +240 -0
- package/cpp/leveldb/util/env_windows.cc +796 -0
- package/cpp/leveldb/util/env_windows_test.cc +65 -0
- package/cpp/leveldb/util/env_windows_test_helper.h +25 -0
- package/cpp/leveldb/util/filter_policy.cc +11 -0
- package/cpp/leveldb/util/hash.cc +55 -0
- package/cpp/leveldb/util/hash.h +19 -0
- package/cpp/leveldb/util/hash_test.cc +46 -0
- package/cpp/leveldb/util/histogram.cc +272 -0
- package/cpp/leveldb/util/histogram.h +44 -0
- package/cpp/leveldb/util/logging.cc +82 -0
- package/cpp/leveldb/util/logging.h +44 -0
- package/cpp/leveldb/util/logging_test.cc +145 -0
- package/cpp/leveldb/util/mutexlock.h +39 -0
- package/cpp/leveldb/util/no_destructor.h +46 -0
- package/cpp/leveldb/util/no_destructor_test.cc +49 -0
- package/cpp/leveldb/util/options.cc +14 -0
- package/cpp/leveldb/util/posix_logger.h +130 -0
- package/cpp/leveldb/util/random.h +63 -0
- package/cpp/leveldb/util/status.cc +77 -0
- package/cpp/leveldb/util/status_test.cc +44 -0
- package/cpp/leveldb/util/testutil.cc +51 -0
- package/cpp/leveldb/util/testutil.h +82 -0
- package/cpp/leveldb/util/windows_logger.h +124 -0
- package/cpp/react-native-leveldb.cpp +694 -0
- package/cpp/react-native-leveldb.h +4 -0
- package/ios/Leveldb.h +9 -0
- package/ios/Leveldb.mm +35 -0
- package/ios/Leveldb.xcodeproj/project.pbxproj +288 -0
- package/lib/commonjs/fake.js +181 -0
- package/lib/commonjs/fake.js.map +1 -0
- package/lib/commonjs/fake.test.js +30 -0
- package/lib/commonjs/fake.test.js.map +1 -0
- package/lib/commonjs/index.js +172 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/fake.js +171 -0
- package/lib/module/fake.js.map +1 -0
- package/lib/module/fake.test.js +30 -0
- package/lib/module/fake.test.js.map +1 -0
- package/lib/module/index.js +165 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/fake.d.ts +34 -0
- package/lib/typescript/fake.d.ts.map +1 -0
- package/lib/typescript/fake.test.d.ts +2 -0
- package/lib/typescript/fake.test.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +72 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +157 -0
- package/rn-leveldb.podspec +30 -0
- package/src/fake.test.ts +37 -0
- package/src/fake.ts +203 -0
- package/src/index.ts +291 -0
|
@@ -0,0 +1,990 @@
|
|
|
1
|
+
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
4
|
+
|
|
5
|
+
#include <sys/types.h>
|
|
6
|
+
|
|
7
|
+
#include <cstdio>
|
|
8
|
+
#include <cstdlib>
|
|
9
|
+
|
|
10
|
+
#include "leveldb/cache.h"
|
|
11
|
+
#include "leveldb/db.h"
|
|
12
|
+
#include "leveldb/env.h"
|
|
13
|
+
#include "leveldb/filter_policy.h"
|
|
14
|
+
#include "leveldb/write_batch.h"
|
|
15
|
+
#include "port/port.h"
|
|
16
|
+
#include "util/crc32c.h"
|
|
17
|
+
#include "util/histogram.h"
|
|
18
|
+
#include "util/mutexlock.h"
|
|
19
|
+
#include "util/random.h"
|
|
20
|
+
#include "util/testutil.h"
|
|
21
|
+
|
|
22
|
+
// Comma-separated list of operations to run in the specified order
|
|
23
|
+
// Actual benchmarks:
|
|
24
|
+
// fillseq -- write N values in sequential key order in async mode
|
|
25
|
+
// fillrandom -- write N values in random key order in async mode
|
|
26
|
+
// overwrite -- overwrite N values in random key order in async mode
|
|
27
|
+
// fillsync -- write N/100 values in random key order in sync mode
|
|
28
|
+
// fill100K -- write N/1000 100K values in random order in async mode
|
|
29
|
+
// deleteseq -- delete N keys in sequential order
|
|
30
|
+
// deleterandom -- delete N keys in random order
|
|
31
|
+
// readseq -- read N times sequentially
|
|
32
|
+
// readreverse -- read N times in reverse order
|
|
33
|
+
// readrandom -- read N times in random order
|
|
34
|
+
// readmissing -- read N missing keys in random order
|
|
35
|
+
// readhot -- read N times in random order from 1% section of DB
|
|
36
|
+
// seekrandom -- N random seeks
|
|
37
|
+
// open -- cost of opening a DB
|
|
38
|
+
// crc32c -- repeated crc32c of 4K of data
|
|
39
|
+
// Meta operations:
|
|
40
|
+
// compact -- Compact the entire DB
|
|
41
|
+
// stats -- Print DB stats
|
|
42
|
+
// sstables -- Print sstable info
|
|
43
|
+
// heapprofile -- Dump a heap profile (if supported by this port)
|
|
44
|
+
static const char* FLAGS_benchmarks =
|
|
45
|
+
"fillseq,"
|
|
46
|
+
"fillsync,"
|
|
47
|
+
"fillrandom,"
|
|
48
|
+
"overwrite,"
|
|
49
|
+
"readrandom,"
|
|
50
|
+
"readrandom," // Extra run to allow previous compactions to quiesce
|
|
51
|
+
"readseq,"
|
|
52
|
+
"readreverse,"
|
|
53
|
+
"compact,"
|
|
54
|
+
"readrandom,"
|
|
55
|
+
"readseq,"
|
|
56
|
+
"readreverse,"
|
|
57
|
+
"fill100K,"
|
|
58
|
+
"crc32c,"
|
|
59
|
+
"snappycomp,"
|
|
60
|
+
"snappyuncomp,";
|
|
61
|
+
|
|
62
|
+
// Number of key/values to place in database
|
|
63
|
+
static int FLAGS_num = 1000000;
|
|
64
|
+
|
|
65
|
+
// Number of read operations to do. If negative, do FLAGS_num reads.
|
|
66
|
+
static int FLAGS_reads = -1;
|
|
67
|
+
|
|
68
|
+
// Number of concurrent threads to run.
|
|
69
|
+
static int FLAGS_threads = 1;
|
|
70
|
+
|
|
71
|
+
// Size of each value
|
|
72
|
+
static int FLAGS_value_size = 100;
|
|
73
|
+
|
|
74
|
+
// Arrange to generate values that shrink to this fraction of
|
|
75
|
+
// their original size after compression
|
|
76
|
+
static double FLAGS_compression_ratio = 0.5;
|
|
77
|
+
|
|
78
|
+
// Print histogram of operation timings
|
|
79
|
+
static bool FLAGS_histogram = false;
|
|
80
|
+
|
|
81
|
+
// Number of bytes to buffer in memtable before compacting
|
|
82
|
+
// (initialized to default value by "main")
|
|
83
|
+
static int FLAGS_write_buffer_size = 0;
|
|
84
|
+
|
|
85
|
+
// Number of bytes written to each file.
|
|
86
|
+
// (initialized to default value by "main")
|
|
87
|
+
static int FLAGS_max_file_size = 0;
|
|
88
|
+
|
|
89
|
+
// Approximate size of user data packed per block (before compression.
|
|
90
|
+
// (initialized to default value by "main")
|
|
91
|
+
static int FLAGS_block_size = 0;
|
|
92
|
+
|
|
93
|
+
// Number of bytes to use as a cache of uncompressed data.
|
|
94
|
+
// Negative means use default settings.
|
|
95
|
+
static int FLAGS_cache_size = -1;
|
|
96
|
+
|
|
97
|
+
// Maximum number of files to keep open at the same time (use default if == 0)
|
|
98
|
+
static int FLAGS_open_files = 0;
|
|
99
|
+
|
|
100
|
+
// Bloom filter bits per key.
|
|
101
|
+
// Negative means use default settings.
|
|
102
|
+
static int FLAGS_bloom_bits = -1;
|
|
103
|
+
|
|
104
|
+
// If true, do not destroy the existing database. If you set this
|
|
105
|
+
// flag and also specify a benchmark that wants a fresh database, that
|
|
106
|
+
// benchmark will fail.
|
|
107
|
+
static bool FLAGS_use_existing_db = false;
|
|
108
|
+
|
|
109
|
+
// If true, reuse existing log/MANIFEST files when re-opening a database.
|
|
110
|
+
static bool FLAGS_reuse_logs = false;
|
|
111
|
+
|
|
112
|
+
// Use the db with the following name.
|
|
113
|
+
static const char* FLAGS_db = nullptr;
|
|
114
|
+
|
|
115
|
+
namespace leveldb {
|
|
116
|
+
|
|
117
|
+
namespace {
|
|
118
|
+
leveldb::Env* g_env = nullptr;
|
|
119
|
+
|
|
120
|
+
// Helper for quickly generating random data.
|
|
121
|
+
class RandomGenerator {
|
|
122
|
+
private:
|
|
123
|
+
std::string data_;
|
|
124
|
+
int pos_;
|
|
125
|
+
|
|
126
|
+
public:
|
|
127
|
+
RandomGenerator() {
|
|
128
|
+
// We use a limited amount of data over and over again and ensure
|
|
129
|
+
// that it is larger than the compression window (32KB), and also
|
|
130
|
+
// large enough to serve all typical value sizes we want to write.
|
|
131
|
+
Random rnd(301);
|
|
132
|
+
std::string piece;
|
|
133
|
+
while (data_.size() < 1048576) {
|
|
134
|
+
// Add a short fragment that is as compressible as specified
|
|
135
|
+
// by FLAGS_compression_ratio.
|
|
136
|
+
test::CompressibleString(&rnd, FLAGS_compression_ratio, 100, &piece);
|
|
137
|
+
data_.append(piece);
|
|
138
|
+
}
|
|
139
|
+
pos_ = 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
Slice Generate(size_t len) {
|
|
143
|
+
if (pos_ + len > data_.size()) {
|
|
144
|
+
pos_ = 0;
|
|
145
|
+
assert(len < data_.size());
|
|
146
|
+
}
|
|
147
|
+
pos_ += len;
|
|
148
|
+
return Slice(data_.data() + pos_ - len, len);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
#if defined(__linux)
|
|
153
|
+
static Slice TrimSpace(Slice s) {
|
|
154
|
+
size_t start = 0;
|
|
155
|
+
while (start < s.size() && isspace(s[start])) {
|
|
156
|
+
start++;
|
|
157
|
+
}
|
|
158
|
+
size_t limit = s.size();
|
|
159
|
+
while (limit > start && isspace(s[limit - 1])) {
|
|
160
|
+
limit--;
|
|
161
|
+
}
|
|
162
|
+
return Slice(s.data() + start, limit - start);
|
|
163
|
+
}
|
|
164
|
+
#endif
|
|
165
|
+
|
|
166
|
+
static void AppendWithSpace(std::string* str, Slice msg) {
|
|
167
|
+
if (msg.empty()) return;
|
|
168
|
+
if (!str->empty()) {
|
|
169
|
+
str->push_back(' ');
|
|
170
|
+
}
|
|
171
|
+
str->append(msg.data(), msg.size());
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
class Stats {
|
|
175
|
+
private:
|
|
176
|
+
double start_;
|
|
177
|
+
double finish_;
|
|
178
|
+
double seconds_;
|
|
179
|
+
int done_;
|
|
180
|
+
int next_report_;
|
|
181
|
+
int64_t bytes_;
|
|
182
|
+
double last_op_finish_;
|
|
183
|
+
Histogram hist_;
|
|
184
|
+
std::string message_;
|
|
185
|
+
|
|
186
|
+
public:
|
|
187
|
+
Stats() { Start(); }
|
|
188
|
+
|
|
189
|
+
void Start() {
|
|
190
|
+
next_report_ = 100;
|
|
191
|
+
hist_.Clear();
|
|
192
|
+
done_ = 0;
|
|
193
|
+
bytes_ = 0;
|
|
194
|
+
seconds_ = 0;
|
|
195
|
+
message_.clear();
|
|
196
|
+
start_ = finish_ = last_op_finish_ = g_env->NowMicros();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
void Merge(const Stats& other) {
|
|
200
|
+
hist_.Merge(other.hist_);
|
|
201
|
+
done_ += other.done_;
|
|
202
|
+
bytes_ += other.bytes_;
|
|
203
|
+
seconds_ += other.seconds_;
|
|
204
|
+
if (other.start_ < start_) start_ = other.start_;
|
|
205
|
+
if (other.finish_ > finish_) finish_ = other.finish_;
|
|
206
|
+
|
|
207
|
+
// Just keep the messages from one thread
|
|
208
|
+
if (message_.empty()) message_ = other.message_;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
void Stop() {
|
|
212
|
+
finish_ = g_env->NowMicros();
|
|
213
|
+
seconds_ = (finish_ - start_) * 1e-6;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
void AddMessage(Slice msg) { AppendWithSpace(&message_, msg); }
|
|
217
|
+
|
|
218
|
+
void FinishedSingleOp() {
|
|
219
|
+
if (FLAGS_histogram) {
|
|
220
|
+
double now = g_env->NowMicros();
|
|
221
|
+
double micros = now - last_op_finish_;
|
|
222
|
+
hist_.Add(micros);
|
|
223
|
+
if (micros > 20000) {
|
|
224
|
+
std::fprintf(stderr, "long op: %.1f micros%30s\r", micros, "");
|
|
225
|
+
std::fflush(stderr);
|
|
226
|
+
}
|
|
227
|
+
last_op_finish_ = now;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
done_++;
|
|
231
|
+
if (done_ >= next_report_) {
|
|
232
|
+
if (next_report_ < 1000)
|
|
233
|
+
next_report_ += 100;
|
|
234
|
+
else if (next_report_ < 5000)
|
|
235
|
+
next_report_ += 500;
|
|
236
|
+
else if (next_report_ < 10000)
|
|
237
|
+
next_report_ += 1000;
|
|
238
|
+
else if (next_report_ < 50000)
|
|
239
|
+
next_report_ += 5000;
|
|
240
|
+
else if (next_report_ < 100000)
|
|
241
|
+
next_report_ += 10000;
|
|
242
|
+
else if (next_report_ < 500000)
|
|
243
|
+
next_report_ += 50000;
|
|
244
|
+
else
|
|
245
|
+
next_report_ += 100000;
|
|
246
|
+
std::fprintf(stderr, "... finished %d ops%30s\r", done_, "");
|
|
247
|
+
std::fflush(stderr);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
void AddBytes(int64_t n) { bytes_ += n; }
|
|
252
|
+
|
|
253
|
+
void Report(const Slice& name) {
|
|
254
|
+
// Pretend at least one op was done in case we are running a benchmark
|
|
255
|
+
// that does not call FinishedSingleOp().
|
|
256
|
+
if (done_ < 1) done_ = 1;
|
|
257
|
+
|
|
258
|
+
std::string extra;
|
|
259
|
+
if (bytes_ > 0) {
|
|
260
|
+
// Rate is computed on actual elapsed time, not the sum of per-thread
|
|
261
|
+
// elapsed times.
|
|
262
|
+
double elapsed = (finish_ - start_) * 1e-6;
|
|
263
|
+
char rate[100];
|
|
264
|
+
std::snprintf(rate, sizeof(rate), "%6.1f MB/s",
|
|
265
|
+
(bytes_ / 1048576.0) / elapsed);
|
|
266
|
+
extra = rate;
|
|
267
|
+
}
|
|
268
|
+
AppendWithSpace(&extra, message_);
|
|
269
|
+
|
|
270
|
+
std::fprintf(stdout, "%-12s : %11.3f micros/op;%s%s\n",
|
|
271
|
+
name.ToString().c_str(), seconds_ * 1e6 / done_,
|
|
272
|
+
(extra.empty() ? "" : " "), extra.c_str());
|
|
273
|
+
if (FLAGS_histogram) {
|
|
274
|
+
std::fprintf(stdout, "Microseconds per op:\n%s\n",
|
|
275
|
+
hist_.ToString().c_str());
|
|
276
|
+
}
|
|
277
|
+
std::fflush(stdout);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
// State shared by all concurrent executions of the same benchmark.
|
|
282
|
+
struct SharedState {
|
|
283
|
+
port::Mutex mu;
|
|
284
|
+
port::CondVar cv GUARDED_BY(mu);
|
|
285
|
+
int total GUARDED_BY(mu);
|
|
286
|
+
|
|
287
|
+
// Each thread goes through the following states:
|
|
288
|
+
// (1) initializing
|
|
289
|
+
// (2) waiting for others to be initialized
|
|
290
|
+
// (3) running
|
|
291
|
+
// (4) done
|
|
292
|
+
|
|
293
|
+
int num_initialized GUARDED_BY(mu);
|
|
294
|
+
int num_done GUARDED_BY(mu);
|
|
295
|
+
bool start GUARDED_BY(mu);
|
|
296
|
+
|
|
297
|
+
SharedState(int total)
|
|
298
|
+
: cv(&mu), total(total), num_initialized(0), num_done(0), start(false) {}
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
// Per-thread state for concurrent executions of the same benchmark.
|
|
302
|
+
struct ThreadState {
|
|
303
|
+
int tid; // 0..n-1 when running in n threads
|
|
304
|
+
Random rand; // Has different seeds for different threads
|
|
305
|
+
Stats stats;
|
|
306
|
+
SharedState* shared;
|
|
307
|
+
|
|
308
|
+
ThreadState(int index) : tid(index), rand(1000 + index), shared(nullptr) {}
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
} // namespace
|
|
312
|
+
|
|
313
|
+
class Benchmark {
|
|
314
|
+
private:
|
|
315
|
+
Cache* cache_;
|
|
316
|
+
const FilterPolicy* filter_policy_;
|
|
317
|
+
DB* db_;
|
|
318
|
+
int num_;
|
|
319
|
+
int value_size_;
|
|
320
|
+
int entries_per_batch_;
|
|
321
|
+
WriteOptions write_options_;
|
|
322
|
+
int reads_;
|
|
323
|
+
int heap_counter_;
|
|
324
|
+
|
|
325
|
+
void PrintHeader() {
|
|
326
|
+
const int kKeySize = 16;
|
|
327
|
+
PrintEnvironment();
|
|
328
|
+
std::fprintf(stdout, "Keys: %d bytes each\n", kKeySize);
|
|
329
|
+
std::fprintf(
|
|
330
|
+
stdout, "Values: %d bytes each (%d bytes after compression)\n",
|
|
331
|
+
FLAGS_value_size,
|
|
332
|
+
static_cast<int>(FLAGS_value_size * FLAGS_compression_ratio + 0.5));
|
|
333
|
+
std::fprintf(stdout, "Entries: %d\n", num_);
|
|
334
|
+
std::fprintf(stdout, "RawSize: %.1f MB (estimated)\n",
|
|
335
|
+
((static_cast<int64_t>(kKeySize + FLAGS_value_size) * num_) /
|
|
336
|
+
1048576.0));
|
|
337
|
+
std::fprintf(
|
|
338
|
+
stdout, "FileSize: %.1f MB (estimated)\n",
|
|
339
|
+
(((kKeySize + FLAGS_value_size * FLAGS_compression_ratio) * num_) /
|
|
340
|
+
1048576.0));
|
|
341
|
+
PrintWarnings();
|
|
342
|
+
std::fprintf(stdout, "------------------------------------------------\n");
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
void PrintWarnings() {
|
|
346
|
+
#if defined(__GNUC__) && !defined(__OPTIMIZE__)
|
|
347
|
+
std::fprintf(
|
|
348
|
+
stdout,
|
|
349
|
+
"WARNING: Optimization is disabled: benchmarks unnecessarily slow\n");
|
|
350
|
+
#endif
|
|
351
|
+
#ifndef NDEBUG
|
|
352
|
+
std::fprintf(
|
|
353
|
+
stdout,
|
|
354
|
+
"WARNING: Assertions are enabled; benchmarks unnecessarily slow\n");
|
|
355
|
+
#endif
|
|
356
|
+
|
|
357
|
+
// See if snappy is working by attempting to compress a compressible string
|
|
358
|
+
const char text[] = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
|
|
359
|
+
std::string compressed;
|
|
360
|
+
if (!port::Snappy_Compress(text, sizeof(text), &compressed)) {
|
|
361
|
+
std::fprintf(stdout, "WARNING: Snappy compression is not enabled\n");
|
|
362
|
+
} else if (compressed.size() >= sizeof(text)) {
|
|
363
|
+
std::fprintf(stdout, "WARNING: Snappy compression is not effective\n");
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
void PrintEnvironment() {
|
|
368
|
+
std::fprintf(stderr, "LevelDB: version %d.%d\n", kMajorVersion,
|
|
369
|
+
kMinorVersion);
|
|
370
|
+
|
|
371
|
+
#if defined(__linux)
|
|
372
|
+
time_t now = time(nullptr);
|
|
373
|
+
std::fprintf(stderr, "Date: %s",
|
|
374
|
+
ctime(&now)); // ctime() adds newline
|
|
375
|
+
|
|
376
|
+
FILE* cpuinfo = std::fopen("/proc/cpuinfo", "r");
|
|
377
|
+
if (cpuinfo != nullptr) {
|
|
378
|
+
char line[1000];
|
|
379
|
+
int num_cpus = 0;
|
|
380
|
+
std::string cpu_type;
|
|
381
|
+
std::string cache_size;
|
|
382
|
+
while (fgets(line, sizeof(line), cpuinfo) != nullptr) {
|
|
383
|
+
const char* sep = strchr(line, ':');
|
|
384
|
+
if (sep == nullptr) {
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
Slice key = TrimSpace(Slice(line, sep - 1 - line));
|
|
388
|
+
Slice val = TrimSpace(Slice(sep + 1));
|
|
389
|
+
if (key == "model name") {
|
|
390
|
+
++num_cpus;
|
|
391
|
+
cpu_type = val.ToString();
|
|
392
|
+
} else if (key == "cache size") {
|
|
393
|
+
cache_size = val.ToString();
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
std::fclose(cpuinfo);
|
|
397
|
+
std::fprintf(stderr, "CPU: %d * %s\n", num_cpus, cpu_type.c_str());
|
|
398
|
+
std::fprintf(stderr, "CPUCache: %s\n", cache_size.c_str());
|
|
399
|
+
}
|
|
400
|
+
#endif
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
public:
|
|
404
|
+
Benchmark()
|
|
405
|
+
: cache_(FLAGS_cache_size >= 0 ? NewLRUCache(FLAGS_cache_size) : nullptr),
|
|
406
|
+
filter_policy_(FLAGS_bloom_bits >= 0
|
|
407
|
+
? NewBloomFilterPolicy(FLAGS_bloom_bits)
|
|
408
|
+
: nullptr),
|
|
409
|
+
db_(nullptr),
|
|
410
|
+
num_(FLAGS_num),
|
|
411
|
+
value_size_(FLAGS_value_size),
|
|
412
|
+
entries_per_batch_(1),
|
|
413
|
+
reads_(FLAGS_reads < 0 ? FLAGS_num : FLAGS_reads),
|
|
414
|
+
heap_counter_(0) {
|
|
415
|
+
std::vector<std::string> files;
|
|
416
|
+
g_env->GetChildren(FLAGS_db, &files);
|
|
417
|
+
for (size_t i = 0; i < files.size(); i++) {
|
|
418
|
+
if (Slice(files[i]).starts_with("heap-")) {
|
|
419
|
+
g_env->RemoveFile(std::string(FLAGS_db) + "/" + files[i]);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
if (!FLAGS_use_existing_db) {
|
|
423
|
+
DestroyDB(FLAGS_db, Options());
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
~Benchmark() {
|
|
428
|
+
delete db_;
|
|
429
|
+
delete cache_;
|
|
430
|
+
delete filter_policy_;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
void Run() {
|
|
434
|
+
PrintHeader();
|
|
435
|
+
Open();
|
|
436
|
+
|
|
437
|
+
const char* benchmarks = FLAGS_benchmarks;
|
|
438
|
+
while (benchmarks != nullptr) {
|
|
439
|
+
const char* sep = strchr(benchmarks, ',');
|
|
440
|
+
Slice name;
|
|
441
|
+
if (sep == nullptr) {
|
|
442
|
+
name = benchmarks;
|
|
443
|
+
benchmarks = nullptr;
|
|
444
|
+
} else {
|
|
445
|
+
name = Slice(benchmarks, sep - benchmarks);
|
|
446
|
+
benchmarks = sep + 1;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// Reset parameters that may be overridden below
|
|
450
|
+
num_ = FLAGS_num;
|
|
451
|
+
reads_ = (FLAGS_reads < 0 ? FLAGS_num : FLAGS_reads);
|
|
452
|
+
value_size_ = FLAGS_value_size;
|
|
453
|
+
entries_per_batch_ = 1;
|
|
454
|
+
write_options_ = WriteOptions();
|
|
455
|
+
|
|
456
|
+
void (Benchmark::*method)(ThreadState*) = nullptr;
|
|
457
|
+
bool fresh_db = false;
|
|
458
|
+
int num_threads = FLAGS_threads;
|
|
459
|
+
|
|
460
|
+
if (name == Slice("open")) {
|
|
461
|
+
method = &Benchmark::OpenBench;
|
|
462
|
+
num_ /= 10000;
|
|
463
|
+
if (num_ < 1) num_ = 1;
|
|
464
|
+
} else if (name == Slice("fillseq")) {
|
|
465
|
+
fresh_db = true;
|
|
466
|
+
method = &Benchmark::WriteSeq;
|
|
467
|
+
} else if (name == Slice("fillbatch")) {
|
|
468
|
+
fresh_db = true;
|
|
469
|
+
entries_per_batch_ = 1000;
|
|
470
|
+
method = &Benchmark::WriteSeq;
|
|
471
|
+
} else if (name == Slice("fillrandom")) {
|
|
472
|
+
fresh_db = true;
|
|
473
|
+
method = &Benchmark::WriteRandom;
|
|
474
|
+
} else if (name == Slice("overwrite")) {
|
|
475
|
+
fresh_db = false;
|
|
476
|
+
method = &Benchmark::WriteRandom;
|
|
477
|
+
} else if (name == Slice("fillsync")) {
|
|
478
|
+
fresh_db = true;
|
|
479
|
+
num_ /= 1000;
|
|
480
|
+
write_options_.sync = true;
|
|
481
|
+
method = &Benchmark::WriteRandom;
|
|
482
|
+
} else if (name == Slice("fill100K")) {
|
|
483
|
+
fresh_db = true;
|
|
484
|
+
num_ /= 1000;
|
|
485
|
+
value_size_ = 100 * 1000;
|
|
486
|
+
method = &Benchmark::WriteRandom;
|
|
487
|
+
} else if (name == Slice("readseq")) {
|
|
488
|
+
method = &Benchmark::ReadSequential;
|
|
489
|
+
} else if (name == Slice("readreverse")) {
|
|
490
|
+
method = &Benchmark::ReadReverse;
|
|
491
|
+
} else if (name == Slice("readrandom")) {
|
|
492
|
+
method = &Benchmark::ReadRandom;
|
|
493
|
+
} else if (name == Slice("readmissing")) {
|
|
494
|
+
method = &Benchmark::ReadMissing;
|
|
495
|
+
} else if (name == Slice("seekrandom")) {
|
|
496
|
+
method = &Benchmark::SeekRandom;
|
|
497
|
+
} else if (name == Slice("readhot")) {
|
|
498
|
+
method = &Benchmark::ReadHot;
|
|
499
|
+
} else if (name == Slice("readrandomsmall")) {
|
|
500
|
+
reads_ /= 1000;
|
|
501
|
+
method = &Benchmark::ReadRandom;
|
|
502
|
+
} else if (name == Slice("deleteseq")) {
|
|
503
|
+
method = &Benchmark::DeleteSeq;
|
|
504
|
+
} else if (name == Slice("deleterandom")) {
|
|
505
|
+
method = &Benchmark::DeleteRandom;
|
|
506
|
+
} else if (name == Slice("readwhilewriting")) {
|
|
507
|
+
num_threads++; // Add extra thread for writing
|
|
508
|
+
method = &Benchmark::ReadWhileWriting;
|
|
509
|
+
} else if (name == Slice("compact")) {
|
|
510
|
+
method = &Benchmark::Compact;
|
|
511
|
+
} else if (name == Slice("crc32c")) {
|
|
512
|
+
method = &Benchmark::Crc32c;
|
|
513
|
+
} else if (name == Slice("snappycomp")) {
|
|
514
|
+
method = &Benchmark::SnappyCompress;
|
|
515
|
+
} else if (name == Slice("snappyuncomp")) {
|
|
516
|
+
method = &Benchmark::SnappyUncompress;
|
|
517
|
+
} else if (name == Slice("heapprofile")) {
|
|
518
|
+
HeapProfile();
|
|
519
|
+
} else if (name == Slice("stats")) {
|
|
520
|
+
PrintStats("leveldb.stats");
|
|
521
|
+
} else if (name == Slice("sstables")) {
|
|
522
|
+
PrintStats("leveldb.sstables");
|
|
523
|
+
} else {
|
|
524
|
+
if (!name.empty()) { // No error message for empty name
|
|
525
|
+
std::fprintf(stderr, "unknown benchmark '%s'\n",
|
|
526
|
+
name.ToString().c_str());
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
if (fresh_db) {
|
|
531
|
+
if (FLAGS_use_existing_db) {
|
|
532
|
+
std::fprintf(stdout, "%-12s : skipped (--use_existing_db is true)\n",
|
|
533
|
+
name.ToString().c_str());
|
|
534
|
+
method = nullptr;
|
|
535
|
+
} else {
|
|
536
|
+
delete db_;
|
|
537
|
+
db_ = nullptr;
|
|
538
|
+
DestroyDB(FLAGS_db, Options());
|
|
539
|
+
Open();
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
if (method != nullptr) {
|
|
544
|
+
RunBenchmark(num_threads, name, method);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
private:
|
|
550
|
+
struct ThreadArg {
|
|
551
|
+
Benchmark* bm;
|
|
552
|
+
SharedState* shared;
|
|
553
|
+
ThreadState* thread;
|
|
554
|
+
void (Benchmark::*method)(ThreadState*);
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
static void ThreadBody(void* v) {
|
|
558
|
+
ThreadArg* arg = reinterpret_cast<ThreadArg*>(v);
|
|
559
|
+
SharedState* shared = arg->shared;
|
|
560
|
+
ThreadState* thread = arg->thread;
|
|
561
|
+
{
|
|
562
|
+
MutexLock l(&shared->mu);
|
|
563
|
+
shared->num_initialized++;
|
|
564
|
+
if (shared->num_initialized >= shared->total) {
|
|
565
|
+
shared->cv.SignalAll();
|
|
566
|
+
}
|
|
567
|
+
while (!shared->start) {
|
|
568
|
+
shared->cv.Wait();
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
thread->stats.Start();
|
|
573
|
+
(arg->bm->*(arg->method))(thread);
|
|
574
|
+
thread->stats.Stop();
|
|
575
|
+
|
|
576
|
+
{
|
|
577
|
+
MutexLock l(&shared->mu);
|
|
578
|
+
shared->num_done++;
|
|
579
|
+
if (shared->num_done >= shared->total) {
|
|
580
|
+
shared->cv.SignalAll();
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
void RunBenchmark(int n, Slice name,
|
|
586
|
+
void (Benchmark::*method)(ThreadState*)) {
|
|
587
|
+
SharedState shared(n);
|
|
588
|
+
|
|
589
|
+
ThreadArg* arg = new ThreadArg[n];
|
|
590
|
+
for (int i = 0; i < n; i++) {
|
|
591
|
+
arg[i].bm = this;
|
|
592
|
+
arg[i].method = method;
|
|
593
|
+
arg[i].shared = &shared;
|
|
594
|
+
arg[i].thread = new ThreadState(i);
|
|
595
|
+
arg[i].thread->shared = &shared;
|
|
596
|
+
g_env->StartThread(ThreadBody, &arg[i]);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
shared.mu.Lock();
|
|
600
|
+
while (shared.num_initialized < n) {
|
|
601
|
+
shared.cv.Wait();
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
shared.start = true;
|
|
605
|
+
shared.cv.SignalAll();
|
|
606
|
+
while (shared.num_done < n) {
|
|
607
|
+
shared.cv.Wait();
|
|
608
|
+
}
|
|
609
|
+
shared.mu.Unlock();
|
|
610
|
+
|
|
611
|
+
for (int i = 1; i < n; i++) {
|
|
612
|
+
arg[0].thread->stats.Merge(arg[i].thread->stats);
|
|
613
|
+
}
|
|
614
|
+
arg[0].thread->stats.Report(name);
|
|
615
|
+
|
|
616
|
+
for (int i = 0; i < n; i++) {
|
|
617
|
+
delete arg[i].thread;
|
|
618
|
+
}
|
|
619
|
+
delete[] arg;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
void Crc32c(ThreadState* thread) {
|
|
623
|
+
// Checksum about 500MB of data total
|
|
624
|
+
const int size = 4096;
|
|
625
|
+
const char* label = "(4K per op)";
|
|
626
|
+
std::string data(size, 'x');
|
|
627
|
+
int64_t bytes = 0;
|
|
628
|
+
uint32_t crc = 0;
|
|
629
|
+
while (bytes < 500 * 1048576) {
|
|
630
|
+
crc = crc32c::Value(data.data(), size);
|
|
631
|
+
thread->stats.FinishedSingleOp();
|
|
632
|
+
bytes += size;
|
|
633
|
+
}
|
|
634
|
+
// Print so result is not dead
|
|
635
|
+
std::fprintf(stderr, "... crc=0x%x\r", static_cast<unsigned int>(crc));
|
|
636
|
+
|
|
637
|
+
thread->stats.AddBytes(bytes);
|
|
638
|
+
thread->stats.AddMessage(label);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
void SnappyCompress(ThreadState* thread) {
|
|
642
|
+
RandomGenerator gen;
|
|
643
|
+
Slice input = gen.Generate(Options().block_size);
|
|
644
|
+
int64_t bytes = 0;
|
|
645
|
+
int64_t produced = 0;
|
|
646
|
+
bool ok = true;
|
|
647
|
+
std::string compressed;
|
|
648
|
+
while (ok && bytes < 1024 * 1048576) { // Compress 1G
|
|
649
|
+
ok = port::Snappy_Compress(input.data(), input.size(), &compressed);
|
|
650
|
+
produced += compressed.size();
|
|
651
|
+
bytes += input.size();
|
|
652
|
+
thread->stats.FinishedSingleOp();
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
if (!ok) {
|
|
656
|
+
thread->stats.AddMessage("(snappy failure)");
|
|
657
|
+
} else {
|
|
658
|
+
char buf[100];
|
|
659
|
+
std::snprintf(buf, sizeof(buf), "(output: %.1f%%)",
|
|
660
|
+
(produced * 100.0) / bytes);
|
|
661
|
+
thread->stats.AddMessage(buf);
|
|
662
|
+
thread->stats.AddBytes(bytes);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
void SnappyUncompress(ThreadState* thread) {
|
|
667
|
+
RandomGenerator gen;
|
|
668
|
+
Slice input = gen.Generate(Options().block_size);
|
|
669
|
+
std::string compressed;
|
|
670
|
+
bool ok = port::Snappy_Compress(input.data(), input.size(), &compressed);
|
|
671
|
+
int64_t bytes = 0;
|
|
672
|
+
char* uncompressed = new char[input.size()];
|
|
673
|
+
while (ok && bytes < 1024 * 1048576) { // Compress 1G
|
|
674
|
+
ok = port::Snappy_Uncompress(compressed.data(), compressed.size(),
|
|
675
|
+
uncompressed);
|
|
676
|
+
bytes += input.size();
|
|
677
|
+
thread->stats.FinishedSingleOp();
|
|
678
|
+
}
|
|
679
|
+
delete[] uncompressed;
|
|
680
|
+
|
|
681
|
+
if (!ok) {
|
|
682
|
+
thread->stats.AddMessage("(snappy failure)");
|
|
683
|
+
} else {
|
|
684
|
+
thread->stats.AddBytes(bytes);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
void Open() {
|
|
689
|
+
assert(db_ == nullptr);
|
|
690
|
+
Options options;
|
|
691
|
+
options.env = g_env;
|
|
692
|
+
options.create_if_missing = !FLAGS_use_existing_db;
|
|
693
|
+
options.block_cache = cache_;
|
|
694
|
+
options.write_buffer_size = FLAGS_write_buffer_size;
|
|
695
|
+
options.max_file_size = FLAGS_max_file_size;
|
|
696
|
+
options.block_size = FLAGS_block_size;
|
|
697
|
+
options.max_open_files = FLAGS_open_files;
|
|
698
|
+
options.filter_policy = filter_policy_;
|
|
699
|
+
options.reuse_logs = FLAGS_reuse_logs;
|
|
700
|
+
Status s = DB::Open(options, FLAGS_db, &db_);
|
|
701
|
+
if (!s.ok()) {
|
|
702
|
+
std::fprintf(stderr, "open error: %s\n", s.ToString().c_str());
|
|
703
|
+
std::exit(1);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
void OpenBench(ThreadState* thread) {
|
|
708
|
+
for (int i = 0; i < num_; i++) {
|
|
709
|
+
delete db_;
|
|
710
|
+
Open();
|
|
711
|
+
thread->stats.FinishedSingleOp();
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
void WriteSeq(ThreadState* thread) { DoWrite(thread, true); }
|
|
716
|
+
|
|
717
|
+
void WriteRandom(ThreadState* thread) { DoWrite(thread, false); }
|
|
718
|
+
|
|
719
|
+
void DoWrite(ThreadState* thread, bool seq) {
|
|
720
|
+
if (num_ != FLAGS_num) {
|
|
721
|
+
char msg[100];
|
|
722
|
+
std::snprintf(msg, sizeof(msg), "(%d ops)", num_);
|
|
723
|
+
thread->stats.AddMessage(msg);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
RandomGenerator gen;
|
|
727
|
+
WriteBatch batch;
|
|
728
|
+
Status s;
|
|
729
|
+
int64_t bytes = 0;
|
|
730
|
+
for (int i = 0; i < num_; i += entries_per_batch_) {
|
|
731
|
+
batch.Clear();
|
|
732
|
+
for (int j = 0; j < entries_per_batch_; j++) {
|
|
733
|
+
const int k = seq ? i + j : (thread->rand.Next() % FLAGS_num);
|
|
734
|
+
char key[100];
|
|
735
|
+
std::snprintf(key, sizeof(key), "%016d", k);
|
|
736
|
+
batch.Put(key, gen.Generate(value_size_));
|
|
737
|
+
bytes += value_size_ + strlen(key);
|
|
738
|
+
thread->stats.FinishedSingleOp();
|
|
739
|
+
}
|
|
740
|
+
s = db_->Write(write_options_, &batch);
|
|
741
|
+
if (!s.ok()) {
|
|
742
|
+
std::fprintf(stderr, "put error: %s\n", s.ToString().c_str());
|
|
743
|
+
std::exit(1);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
thread->stats.AddBytes(bytes);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
void ReadSequential(ThreadState* thread) {
|
|
750
|
+
Iterator* iter = db_->NewIterator(ReadOptions());
|
|
751
|
+
int i = 0;
|
|
752
|
+
int64_t bytes = 0;
|
|
753
|
+
for (iter->SeekToFirst(); i < reads_ && iter->Valid(); iter->Next()) {
|
|
754
|
+
bytes += iter->key().size() + iter->value().size();
|
|
755
|
+
thread->stats.FinishedSingleOp();
|
|
756
|
+
++i;
|
|
757
|
+
}
|
|
758
|
+
delete iter;
|
|
759
|
+
thread->stats.AddBytes(bytes);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
void ReadReverse(ThreadState* thread) {
|
|
763
|
+
Iterator* iter = db_->NewIterator(ReadOptions());
|
|
764
|
+
int i = 0;
|
|
765
|
+
int64_t bytes = 0;
|
|
766
|
+
for (iter->SeekToLast(); i < reads_ && iter->Valid(); iter->Prev()) {
|
|
767
|
+
bytes += iter->key().size() + iter->value().size();
|
|
768
|
+
thread->stats.FinishedSingleOp();
|
|
769
|
+
++i;
|
|
770
|
+
}
|
|
771
|
+
delete iter;
|
|
772
|
+
thread->stats.AddBytes(bytes);
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
void ReadRandom(ThreadState* thread) {
|
|
776
|
+
ReadOptions options;
|
|
777
|
+
std::string value;
|
|
778
|
+
int found = 0;
|
|
779
|
+
for (int i = 0; i < reads_; i++) {
|
|
780
|
+
char key[100];
|
|
781
|
+
const int k = thread->rand.Next() % FLAGS_num;
|
|
782
|
+
std::snprintf(key, sizeof(key), "%016d", k);
|
|
783
|
+
if (db_->Get(options, key, &value).ok()) {
|
|
784
|
+
found++;
|
|
785
|
+
}
|
|
786
|
+
thread->stats.FinishedSingleOp();
|
|
787
|
+
}
|
|
788
|
+
char msg[100];
|
|
789
|
+
std::snprintf(msg, sizeof(msg), "(%d of %d found)", found, num_);
|
|
790
|
+
thread->stats.AddMessage(msg);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
void ReadMissing(ThreadState* thread) {
|
|
794
|
+
ReadOptions options;
|
|
795
|
+
std::string value;
|
|
796
|
+
for (int i = 0; i < reads_; i++) {
|
|
797
|
+
char key[100];
|
|
798
|
+
const int k = thread->rand.Next() % FLAGS_num;
|
|
799
|
+
std::snprintf(key, sizeof(key), "%016d.", k);
|
|
800
|
+
db_->Get(options, key, &value);
|
|
801
|
+
thread->stats.FinishedSingleOp();
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
void ReadHot(ThreadState* thread) {
|
|
806
|
+
ReadOptions options;
|
|
807
|
+
std::string value;
|
|
808
|
+
const int range = (FLAGS_num + 99) / 100;
|
|
809
|
+
for (int i = 0; i < reads_; i++) {
|
|
810
|
+
char key[100];
|
|
811
|
+
const int k = thread->rand.Next() % range;
|
|
812
|
+
std::snprintf(key, sizeof(key), "%016d", k);
|
|
813
|
+
db_->Get(options, key, &value);
|
|
814
|
+
thread->stats.FinishedSingleOp();
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
void SeekRandom(ThreadState* thread) {
|
|
819
|
+
ReadOptions options;
|
|
820
|
+
int found = 0;
|
|
821
|
+
for (int i = 0; i < reads_; i++) {
|
|
822
|
+
Iterator* iter = db_->NewIterator(options);
|
|
823
|
+
char key[100];
|
|
824
|
+
const int k = thread->rand.Next() % FLAGS_num;
|
|
825
|
+
std::snprintf(key, sizeof(key), "%016d", k);
|
|
826
|
+
iter->Seek(key);
|
|
827
|
+
if (iter->Valid() && iter->key() == key) found++;
|
|
828
|
+
delete iter;
|
|
829
|
+
thread->stats.FinishedSingleOp();
|
|
830
|
+
}
|
|
831
|
+
char msg[100];
|
|
832
|
+
std::snprintf(msg, sizeof(msg), "(%d of %d found)", found, num_);
|
|
833
|
+
thread->stats.AddMessage(msg);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
void DoDelete(ThreadState* thread, bool seq) {
|
|
837
|
+
RandomGenerator gen;
|
|
838
|
+
WriteBatch batch;
|
|
839
|
+
Status s;
|
|
840
|
+
for (int i = 0; i < num_; i += entries_per_batch_) {
|
|
841
|
+
batch.Clear();
|
|
842
|
+
for (int j = 0; j < entries_per_batch_; j++) {
|
|
843
|
+
const int k = seq ? i + j : (thread->rand.Next() % FLAGS_num);
|
|
844
|
+
char key[100];
|
|
845
|
+
std::snprintf(key, sizeof(key), "%016d", k);
|
|
846
|
+
batch.Delete(key);
|
|
847
|
+
thread->stats.FinishedSingleOp();
|
|
848
|
+
}
|
|
849
|
+
s = db_->Write(write_options_, &batch);
|
|
850
|
+
if (!s.ok()) {
|
|
851
|
+
std::fprintf(stderr, "del error: %s\n", s.ToString().c_str());
|
|
852
|
+
std::exit(1);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
void DeleteSeq(ThreadState* thread) { DoDelete(thread, true); }
|
|
858
|
+
|
|
859
|
+
void DeleteRandom(ThreadState* thread) { DoDelete(thread, false); }
|
|
860
|
+
|
|
861
|
+
void ReadWhileWriting(ThreadState* thread) {
|
|
862
|
+
if (thread->tid > 0) {
|
|
863
|
+
ReadRandom(thread);
|
|
864
|
+
} else {
|
|
865
|
+
// Special thread that keeps writing until other threads are done.
|
|
866
|
+
RandomGenerator gen;
|
|
867
|
+
while (true) {
|
|
868
|
+
{
|
|
869
|
+
MutexLock l(&thread->shared->mu);
|
|
870
|
+
if (thread->shared->num_done + 1 >= thread->shared->num_initialized) {
|
|
871
|
+
// Other threads have finished
|
|
872
|
+
break;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
const int k = thread->rand.Next() % FLAGS_num;
|
|
877
|
+
char key[100];
|
|
878
|
+
std::snprintf(key, sizeof(key), "%016d", k);
|
|
879
|
+
Status s = db_->Put(write_options_, key, gen.Generate(value_size_));
|
|
880
|
+
if (!s.ok()) {
|
|
881
|
+
std::fprintf(stderr, "put error: %s\n", s.ToString().c_str());
|
|
882
|
+
std::exit(1);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// Do not count any of the preceding work/delay in stats.
|
|
887
|
+
thread->stats.Start();
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
void Compact(ThreadState* thread) { db_->CompactRange(nullptr, nullptr); }
|
|
892
|
+
|
|
893
|
+
void PrintStats(const char* key) {
|
|
894
|
+
std::string stats;
|
|
895
|
+
if (!db_->GetProperty(key, &stats)) {
|
|
896
|
+
stats = "(failed)";
|
|
897
|
+
}
|
|
898
|
+
std::fprintf(stdout, "\n%s\n", stats.c_str());
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
static void WriteToFile(void* arg, const char* buf, int n) {
|
|
902
|
+
reinterpret_cast<WritableFile*>(arg)->Append(Slice(buf, n));
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
void HeapProfile() {
|
|
906
|
+
char fname[100];
|
|
907
|
+
std::snprintf(fname, sizeof(fname), "%s/heap-%04d", FLAGS_db,
|
|
908
|
+
++heap_counter_);
|
|
909
|
+
WritableFile* file;
|
|
910
|
+
Status s = g_env->NewWritableFile(fname, &file);
|
|
911
|
+
if (!s.ok()) {
|
|
912
|
+
std::fprintf(stderr, "%s\n", s.ToString().c_str());
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
915
|
+
bool ok = port::GetHeapProfile(WriteToFile, file);
|
|
916
|
+
delete file;
|
|
917
|
+
if (!ok) {
|
|
918
|
+
std::fprintf(stderr, "heap profiling not supported\n");
|
|
919
|
+
g_env->RemoveFile(fname);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
} // namespace leveldb
|
|
925
|
+
|
|
926
|
+
int main(int argc, char** argv) {
|
|
927
|
+
FLAGS_write_buffer_size = leveldb::Options().write_buffer_size;
|
|
928
|
+
FLAGS_max_file_size = leveldb::Options().max_file_size;
|
|
929
|
+
FLAGS_block_size = leveldb::Options().block_size;
|
|
930
|
+
FLAGS_open_files = leveldb::Options().max_open_files;
|
|
931
|
+
std::string default_db_path;
|
|
932
|
+
|
|
933
|
+
for (int i = 1; i < argc; i++) {
|
|
934
|
+
double d;
|
|
935
|
+
int n;
|
|
936
|
+
char junk;
|
|
937
|
+
if (leveldb::Slice(argv[i]).starts_with("--benchmarks=")) {
|
|
938
|
+
FLAGS_benchmarks = argv[i] + strlen("--benchmarks=");
|
|
939
|
+
} else if (sscanf(argv[i], "--compression_ratio=%lf%c", &d, &junk) == 1) {
|
|
940
|
+
FLAGS_compression_ratio = d;
|
|
941
|
+
} else if (sscanf(argv[i], "--histogram=%d%c", &n, &junk) == 1 &&
|
|
942
|
+
(n == 0 || n == 1)) {
|
|
943
|
+
FLAGS_histogram = n;
|
|
944
|
+
} else if (sscanf(argv[i], "--use_existing_db=%d%c", &n, &junk) == 1 &&
|
|
945
|
+
(n == 0 || n == 1)) {
|
|
946
|
+
FLAGS_use_existing_db = n;
|
|
947
|
+
} else if (sscanf(argv[i], "--reuse_logs=%d%c", &n, &junk) == 1 &&
|
|
948
|
+
(n == 0 || n == 1)) {
|
|
949
|
+
FLAGS_reuse_logs = n;
|
|
950
|
+
} else if (sscanf(argv[i], "--num=%d%c", &n, &junk) == 1) {
|
|
951
|
+
FLAGS_num = n;
|
|
952
|
+
} else if (sscanf(argv[i], "--reads=%d%c", &n, &junk) == 1) {
|
|
953
|
+
FLAGS_reads = n;
|
|
954
|
+
} else if (sscanf(argv[i], "--threads=%d%c", &n, &junk) == 1) {
|
|
955
|
+
FLAGS_threads = n;
|
|
956
|
+
} else if (sscanf(argv[i], "--value_size=%d%c", &n, &junk) == 1) {
|
|
957
|
+
FLAGS_value_size = n;
|
|
958
|
+
} else if (sscanf(argv[i], "--write_buffer_size=%d%c", &n, &junk) == 1) {
|
|
959
|
+
FLAGS_write_buffer_size = n;
|
|
960
|
+
} else if (sscanf(argv[i], "--max_file_size=%d%c", &n, &junk) == 1) {
|
|
961
|
+
FLAGS_max_file_size = n;
|
|
962
|
+
} else if (sscanf(argv[i], "--block_size=%d%c", &n, &junk) == 1) {
|
|
963
|
+
FLAGS_block_size = n;
|
|
964
|
+
} else if (sscanf(argv[i], "--cache_size=%d%c", &n, &junk) == 1) {
|
|
965
|
+
FLAGS_cache_size = n;
|
|
966
|
+
} else if (sscanf(argv[i], "--bloom_bits=%d%c", &n, &junk) == 1) {
|
|
967
|
+
FLAGS_bloom_bits = n;
|
|
968
|
+
} else if (sscanf(argv[i], "--open_files=%d%c", &n, &junk) == 1) {
|
|
969
|
+
FLAGS_open_files = n;
|
|
970
|
+
} else if (strncmp(argv[i], "--db=", 5) == 0) {
|
|
971
|
+
FLAGS_db = argv[i] + 5;
|
|
972
|
+
} else {
|
|
973
|
+
std::fprintf(stderr, "Invalid flag '%s'\n", argv[i]);
|
|
974
|
+
std::exit(1);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
leveldb::g_env = leveldb::Env::Default();
|
|
979
|
+
|
|
980
|
+
// Choose a location for the test database if none given with --db=<path>
|
|
981
|
+
if (FLAGS_db == nullptr) {
|
|
982
|
+
leveldb::g_env->GetTestDirectory(&default_db_path);
|
|
983
|
+
default_db_path += "/dbbench";
|
|
984
|
+
FLAGS_db = default_db_path.c_str();
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
leveldb::Benchmark benchmark;
|
|
988
|
+
benchmark.Run();
|
|
989
|
+
return 0;
|
|
990
|
+
}
|