├── .gitignore ├── Documentation └── uTree-overview.PNG ├── README.md ├── kv-store-test └── vire │ ├── .gitignore │ ├── ChangeLog │ ├── LICENSE │ ├── Makefile.am │ ├── NOTICE │ ├── README.md │ ├── conf │ └── vire.conf │ ├── configure.ac │ ├── dep │ ├── .gitignore │ ├── Makefile.am │ ├── ae │ │ ├── Makefile.am │ │ ├── ae.c │ │ ├── ae.h │ │ ├── ae_epoll.c │ │ ├── ae_evport.c │ │ ├── ae_kqueue.c │ │ └── ae_select.c │ ├── darray │ │ ├── Makefile.am │ │ ├── darray.c │ │ └── darray.h │ ├── dhashkit │ │ ├── Makefile.am │ │ ├── dcrc16.c │ │ ├── dcrc32.c │ │ ├── dfnv.c │ │ ├── dhashkit.h │ │ ├── dhsieh.c │ │ ├── djenkins.c │ │ ├── dketama.c │ │ ├── dmd5.c │ │ ├── dmodula.c │ │ ├── dmurmur.c │ │ ├── done_at_a_time.c │ │ ├── drandom.c │ │ └── dsha1.c │ ├── dlist │ │ ├── Makefile.am │ │ ├── dlist.c │ │ ├── dlist.h │ │ ├── dlockqueue.c │ │ ├── dlockqueue.h │ │ ├── dmtqueue.c │ │ └── dmtqueue.h │ ├── dmalloc │ │ ├── Makefile.am │ │ ├── dmalloc.c │ │ └── dmalloc.h │ ├── himemcached-0.1.0 │ │ ├── Makefile.am │ │ ├── himcdep │ │ │ ├── sds.c │ │ │ └── sds.h │ │ ├── himcread.c │ │ ├── himcread.h │ │ ├── himemcached.c │ │ └── himemcached.h │ ├── hiredis-0.13.3.tar.gz │ ├── hiredis-0.13.3 │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── CHANGELOG.md │ │ ├── COPYING │ │ ├── README.md │ │ ├── adapters │ │ │ ├── ae.h │ │ │ ├── glib.h │ │ │ ├── ivykis.h │ │ │ ├── libev.h │ │ │ ├── libevent.h │ │ │ ├── libuv.h │ │ │ ├── macosx.h │ │ │ └── qt.h │ │ ├── async.c │ │ ├── async.h │ │ ├── dict.c │ │ ├── dict.h │ │ ├── examples │ │ │ ├── example-ae.c │ │ │ ├── example-glib.c │ │ │ ├── example-ivykis.c │ │ │ ├── example-libev.c │ │ │ ├── example-libevent.c │ │ │ ├── example-libuv.c │ │ │ ├── example-macosx.c │ │ │ ├── example-qt.cpp │ │ │ ├── example-qt.h │ │ │ └── example.c │ │ ├── fmacros.h │ │ ├── hiredis.c │ │ ├── hiredis.h │ │ ├── net.c │ │ ├── net.h │ │ ├── read.c │ │ ├── read.h │ │ ├── sds.c │ │ ├── sds.h │ │ ├── test.c │ │ └── win32.h │ ├── jemalloc-4.2.0.tar.bz2 │ ├── jemalloc-4.2.0 │ │ ├── .autom4te.cfg │ │ ├── .gitattributes │ │ ├── .gitignore │ │ ├── COPYING │ │ ├── ChangeLog │ │ ├── INSTALL │ │ ├── README │ │ ├── autogen.sh │ │ ├── bin │ │ │ ├── jemalloc-config.in │ │ │ ├── jemalloc.sh.in │ │ │ └── jeprof.in │ │ ├── build-aux │ │ │ ├── config.guess │ │ │ ├── config.sub │ │ │ └── install-sh │ │ ├── config.stamp.in │ │ ├── configure.ac │ │ ├── coverage.sh │ │ ├── doc │ │ │ ├── html.xsl.in │ │ │ ├── jemalloc.xml.in │ │ │ ├── manpages.xsl.in │ │ │ └── stylesheet.xsl │ │ ├── include │ │ │ ├── jemalloc │ │ │ │ ├── internal │ │ │ │ │ ├── arena.h │ │ │ │ │ ├── assert.h │ │ │ │ │ ├── atomic.h │ │ │ │ │ ├── base.h │ │ │ │ │ ├── bitmap.h │ │ │ │ │ ├── chunk.h │ │ │ │ │ ├── chunk_dss.h │ │ │ │ │ ├── chunk_mmap.h │ │ │ │ │ ├── ckh.h │ │ │ │ │ ├── ctl.h │ │ │ │ │ ├── extent.h │ │ │ │ │ ├── hash.h │ │ │ │ │ ├── huge.h │ │ │ │ │ ├── jemalloc_internal.h.in │ │ │ │ │ ├── jemalloc_internal_decls.h │ │ │ │ │ ├── jemalloc_internal_defs.h.in │ │ │ │ │ ├── jemalloc_internal_macros.h │ │ │ │ │ ├── mb.h │ │ │ │ │ ├── mutex.h │ │ │ │ │ ├── nstime.h │ │ │ │ │ ├── pages.h │ │ │ │ │ ├── ph.h │ │ │ │ │ ├── private_namespace.sh │ │ │ │ │ ├── private_unnamespace.sh │ │ │ │ │ ├── prng.h │ │ │ │ │ ├── prof.h │ │ │ │ │ ├── public_namespace.sh │ │ │ │ │ ├── public_unnamespace.sh │ │ │ │ │ ├── ql.h │ │ │ │ │ ├── qr.h │ │ │ │ │ ├── quarantine.h │ │ │ │ │ ├── rb.h │ │ │ │ │ ├── rtree.h │ │ │ │ │ ├── size_classes.sh │ │ │ │ │ ├── smoothstep.h │ │ │ │ │ ├── smoothstep.sh │ │ │ │ │ ├── stats.h │ │ │ │ │ ├── tcache.h │ │ │ │ │ ├── ticker.h │ │ │ │ │ ├── tsd.h │ │ │ │ │ ├── util.h │ │ │ │ │ ├── valgrind.h │ │ │ │ │ └── witness.h │ │ │ │ ├── jemalloc.sh │ │ │ │ ├── jemalloc_defs.h.in │ │ │ │ ├── jemalloc_macros.h.in │ │ │ │ ├── jemalloc_mangle.sh │ │ │ │ ├── jemalloc_protos.h.in │ │ │ │ ├── jemalloc_rename.sh │ │ │ │ └── jemalloc_typedefs.h.in │ │ │ └── msvc_compat │ │ │ │ ├── C99 │ │ │ │ ├── stdbool.h │ │ │ │ └── stdint.h │ │ │ │ ├── strings.h │ │ │ │ └── windows_extra.h │ │ ├── jemalloc.pc.in │ │ ├── msvc │ │ │ ├── jemalloc_vc2015.sln │ │ │ └── projects │ │ │ │ └── vc2015 │ │ │ │ ├── jemalloc │ │ │ │ ├── jemalloc.vcxproj │ │ │ │ └── jemalloc.vcxproj.filters │ │ │ │ └── test_threads │ │ │ │ ├── test_threads.cpp │ │ │ │ ├── test_threads.h │ │ │ │ ├── test_threads.vcxproj │ │ │ │ ├── test_threads.vcxproj.filters │ │ │ │ └── test_threads_main.cpp │ │ ├── src │ │ │ ├── arena.c │ │ │ ├── atomic.c │ │ │ ├── base.c │ │ │ ├── bitmap.c │ │ │ ├── chunk.c │ │ │ ├── chunk_dss.c │ │ │ ├── chunk_mmap.c │ │ │ ├── ckh.c │ │ │ ├── ctl.c │ │ │ ├── extent.c │ │ │ ├── hash.c │ │ │ ├── huge.c │ │ │ ├── jemalloc.c │ │ │ ├── mb.c │ │ │ ├── mutex.c │ │ │ ├── nstime.c │ │ │ ├── pages.c │ │ │ ├── prng.c │ │ │ ├── prof.c │ │ │ ├── quarantine.c │ │ │ ├── rtree.c │ │ │ ├── stats.c │ │ │ ├── tcache.c │ │ │ ├── ticker.c │ │ │ ├── tsd.c │ │ │ ├── util.c │ │ │ ├── valgrind.c │ │ │ ├── witness.c │ │ │ └── zone.c │ │ └── test │ │ │ ├── include │ │ │ └── test │ │ │ │ ├── SFMT-alti.h │ │ │ │ ├── SFMT-params.h │ │ │ │ ├── SFMT-params11213.h │ │ │ │ ├── SFMT-params1279.h │ │ │ │ ├── SFMT-params132049.h │ │ │ │ ├── SFMT-params19937.h │ │ │ │ ├── SFMT-params216091.h │ │ │ │ ├── SFMT-params2281.h │ │ │ │ ├── SFMT-params4253.h │ │ │ │ ├── SFMT-params44497.h │ │ │ │ ├── SFMT-params607.h │ │ │ │ ├── SFMT-params86243.h │ │ │ │ ├── SFMT-sse2.h │ │ │ │ ├── SFMT.h │ │ │ │ ├── btalloc.h │ │ │ │ ├── jemalloc_test.h.in │ │ │ │ ├── jemalloc_test_defs.h.in │ │ │ │ ├── math.h │ │ │ │ ├── mq.h │ │ │ │ ├── mtx.h │ │ │ │ ├── test.h │ │ │ │ ├── thd.h │ │ │ │ └── timer.h │ │ │ ├── integration │ │ │ ├── MALLOCX_ARENA.c │ │ │ ├── aligned_alloc.c │ │ │ ├── allocated.c │ │ │ ├── chunk.c │ │ │ ├── mallocx.c │ │ │ ├── overflow.c │ │ │ ├── posix_memalign.c │ │ │ ├── rallocx.c │ │ │ ├── sdallocx.c │ │ │ ├── thread_arena.c │ │ │ ├── thread_tcache_enabled.c │ │ │ └── xallocx.c │ │ │ ├── src │ │ │ ├── SFMT.c │ │ │ ├── btalloc.c │ │ │ ├── btalloc_0.c │ │ │ ├── btalloc_1.c │ │ │ ├── math.c │ │ │ ├── mq.c │ │ │ ├── mtx.c │ │ │ ├── test.c │ │ │ ├── thd.c │ │ │ └── timer.c │ │ │ ├── stress │ │ │ └── microbench.c │ │ │ ├── test.sh.in │ │ │ └── unit │ │ │ ├── SFMT.c │ │ │ ├── a0.c │ │ │ ├── arena_reset.c │ │ │ ├── atomic.c │ │ │ ├── bitmap.c │ │ │ ├── ckh.c │ │ │ ├── decay.c │ │ │ ├── fork.c │ │ │ ├── hash.c │ │ │ ├── junk.c │ │ │ ├── junk_alloc.c │ │ │ ├── junk_free.c │ │ │ ├── lg_chunk.c │ │ │ ├── mallctl.c │ │ │ ├── math.c │ │ │ ├── mq.c │ │ │ ├── mtx.c │ │ │ ├── nstime.c │ │ │ ├── ph.c │ │ │ ├── prng.c │ │ │ ├── prof_accum.c │ │ │ ├── prof_active.c │ │ │ ├── prof_gdump.c │ │ │ ├── prof_idump.c │ │ │ ├── prof_reset.c │ │ │ ├── prof_thread_name.c │ │ │ ├── ql.c │ │ │ ├── qr.c │ │ │ ├── quarantine.c │ │ │ ├── rb.c │ │ │ ├── rtree.c │ │ │ ├── run_quantize.c │ │ │ ├── size_classes.c │ │ │ ├── smoothstep.c │ │ │ ├── stats.c │ │ │ ├── ticker.c │ │ │ ├── tsd.c │ │ │ ├── util.c │ │ │ ├── witness.c │ │ │ └── zero.c │ ├── sds │ │ ├── Makefile.am │ │ ├── sds.c │ │ ├── sds.h │ │ └── sdsalloc.h │ └── util │ │ ├── Makefile.am │ │ ├── dlog.c │ │ ├── dlog.h │ │ ├── dspecialconfig.h │ │ ├── dutil.c │ │ └── dutil.h │ ├── log │ ├── m4 │ └── .gitignore │ ├── pid_file │ ├── run.sh │ ├── scripts │ └── .gitignore │ ├── src │ ├── Makefile.am │ ├── atomic_ops │ │ ├── AUTHORS │ │ ├── COPYING │ │ ├── README │ │ ├── aligned_atomic_load_store.h │ │ ├── all_acquire_release_volatile.h │ │ ├── ao_t_is_int.h │ │ ├── atomic_ops.h │ │ ├── generalize-small.h │ │ ├── generalize.h │ │ ├── ia64.h │ │ ├── ordered_except_wr.h │ │ ├── powerpc.h │ │ ├── read_ordered.h │ │ ├── sparc.h │ │ ├── standard_ao_double_t.h │ │ ├── test_and_set_t_is_ao_t.h │ │ ├── test_and_set_t_is_char.h │ │ ├── x86.h │ │ └── x86_64.h │ ├── build_funcForC.sh │ ├── defns │ │ ├── alpha_defns.h │ │ ├── ia64_defns.h │ │ ├── intel_defns.h │ │ ├── mips_defns.h │ │ ├── ppc_defns.h │ │ └── sparc_defns.h │ ├── fast_fair.h │ ├── fptree.h │ ├── funcForC.c │ ├── funcForC.h │ ├── gc │ │ ├── portable_defns.h │ │ ├── ptst.c │ │ ├── ptst.h │ │ └── set.h │ ├── utils.h │ ├── utree.h │ ├── vr.c │ ├── vr_aof.c │ ├── vr_aof.h │ ├── vr_backend.c │ ├── vr_backend.h │ ├── vr_bitops.c │ ├── vr_bitops.h │ ├── vr_block.c │ ├── vr_block.h │ ├── vr_client.c │ ├── vr_client.h │ ├── vr_command.c │ ├── vr_command.h │ ├── vr_conf.c │ ├── vr_conf.h │ ├── vr_connection.c │ ├── vr_connection.h │ ├── vr_core.c │ ├── vr_core.h │ ├── vr_db.c │ ├── vr_db.h │ ├── vr_dict.c │ ├── vr_dict.h │ ├── vr_eventloop.c │ ├── vr_eventloop.h │ ├── vr_hyperloglog.c │ ├── vr_hyperloglog.h │ ├── vr_intset.c │ ├── vr_intset.h │ ├── vr_listen.c │ ├── vr_listen.h │ ├── vr_lzf.h │ ├── vr_lzfP.h │ ├── vr_lzf_c.c │ ├── vr_lzf_d.c │ ├── vr_master.c │ ├── vr_master.h │ ├── vr_multi.c │ ├── vr_multi.h │ ├── vr_notify.c │ ├── vr_notify.h │ ├── vr_object.c │ ├── vr_object.h │ ├── vr_pubsub.c │ ├── vr_pubsub.h │ ├── vr_quicklist.c │ ├── vr_quicklist.h │ ├── vr_rbtree.c │ ├── vr_rbtree.h │ ├── vr_rdb.c │ ├── vr_rdb.h │ ├── vr_replication.c │ ├── vr_replication.h │ ├── vr_scripting.c │ ├── vr_scripting.h │ ├── vr_server.c │ ├── vr_server.h │ ├── vr_signal.c │ ├── vr_signal.h │ ├── vr_slowlog.c │ ├── vr_slowlog.h │ ├── vr_stats.c │ ├── vr_stats.h │ ├── vr_t_hash.c │ ├── vr_t_hash.h │ ├── vr_t_list.c │ ├── vr_t_list.h │ ├── vr_t_set.c │ ├── vr_t_set.h │ ├── vr_t_string.c │ ├── vr_t_string.h │ ├── vr_t_zset.c │ ├── vr_t_zset.h │ ├── vr_thread.c │ ├── vr_thread.h │ ├── vr_util.c │ ├── vr_util.h │ ├── vr_worker.c │ ├── vr_worker.h │ ├── vr_ziplist.c │ ├── vr_ziplist.h │ ├── vr_zipmap.c │ └── vr_zipmap.h │ ├── tests │ ├── .gitignore │ ├── Makefile.am │ ├── vire-benchmark │ ├── vireabtest │ ├── viretest │ ├── vrabtest.c │ ├── vrabtest.h │ ├── vrt_backend.c │ ├── vrt_backend.h │ ├── vrt_benchmark.c │ ├── vrt_check_data.c │ ├── vrt_check_data.h │ ├── vrt_dispatch_data.c │ ├── vrt_dispatch_data.h │ ├── vrt_produce_data.c │ ├── vrt_produce_data.h │ ├── vrt_public.c │ ├── vrt_public.h │ ├── vrt_simple.c │ ├── vrt_simple.h │ ├── vrt_util.c │ ├── vrt_util.h │ └── vrtest.c │ └── tools │ └── .gitignore ├── multiThread ├── fast_fair │ ├── atomic_ops │ │ ├── AUTHORS │ │ ├── COPYING │ │ ├── README │ │ ├── aligned_atomic_load_store.h │ │ ├── all_acquire_release_volatile.h │ │ ├── ao_t_is_int.h │ │ ├── atomic_ops.h │ │ ├── generalize-small.h │ │ ├── generalize.h │ │ ├── ia64.h │ │ ├── ordered_except_wr.h │ │ ├── powerpc.h │ │ ├── read_ordered.h │ │ ├── sparc.h │ │ ├── standard_ao_double_t.h │ │ ├── test_and_set_t_is_ao_t.h │ │ ├── test_and_set_t_is_char.h │ │ ├── x86.h │ │ └── x86_64.h │ ├── btree.h │ ├── build.sh │ ├── main-gu-zipfian │ ├── main-gu-zipfian.c │ ├── run.sh │ ├── zipfian.h │ └── zipfian_util.h ├── fptree │ ├── atomic_ops │ │ ├── AUTHORS │ │ ├── COPYING │ │ ├── README │ │ ├── aligned_atomic_load_store.h │ │ ├── all_acquire_release_volatile.h │ │ ├── ao_t_is_int.h │ │ ├── atomic_ops.h │ │ ├── generalize-small.h │ │ ├── generalize.h │ │ ├── ia64.h │ │ ├── ordered_except_wr.h │ │ ├── powerpc.h │ │ ├── read_ordered.h │ │ ├── sparc.h │ │ ├── standard_ao_double_t.h │ │ ├── test_and_set_t_is_ao_t.h │ │ ├── test_and_set_t_is_char.h │ │ ├── x86.h │ │ └── x86_64.h │ ├── build.sh │ ├── defns │ │ ├── alpha_defns.h │ │ ├── ia64_defns.h │ │ ├── intel_defns.h │ │ ├── mips_defns.h │ │ ├── ppc_defns.h │ │ └── sparc_defns.h │ ├── fptree.cpp │ ├── fptree.h │ ├── gc │ │ ├── portable_defns.h │ │ ├── ptst.c │ │ ├── ptst.h │ │ └── set.h │ ├── main-gu-zipfian │ ├── main-gu-zipfian.c │ ├── run.sh │ ├── utils.h │ ├── zipfian.h │ └── zipfian_util.h └── utree │ ├── atomic_ops │ ├── AUTHORS │ ├── COPYING │ ├── README │ ├── aligned_atomic_load_store.h │ ├── all_acquire_release_volatile.h │ ├── ao_t_is_int.h │ ├── atomic_ops.h │ ├── generalize-small.h │ ├── generalize.h │ ├── ia64.h │ ├── ordered_except_wr.h │ ├── powerpc.h │ ├── read_ordered.h │ ├── sparc.h │ ├── standard_ao_double_t.h │ ├── test_and_set_t_is_ao_t.h │ ├── test_and_set_t_is_char.h │ ├── x86.h │ └── x86_64.h │ ├── build.sh │ ├── main-gu-zipfian.c │ ├── run.sh │ ├── utree.h │ ├── zipfian.h │ └── zipfian_util.h └── singleThread ├── FPTree ├── build.sh ├── fptree.h ├── fptree_map.h ├── main ├── main.cpp └── run.sh ├── NV_tree ├── build.sh ├── main.cpp ├── nv-tree.h └── run.sh ├── RNTree ├── LICENSE.TXT ├── README.md ├── atomic_ops │ ├── AUTHORS │ ├── COPYING │ ├── README │ ├── aligned_atomic_load_store.h │ ├── all_acquire_release_volatile.h │ ├── ao_t_is_int.h │ ├── atomic_ops.h │ ├── generalize-small.h │ ├── generalize.h │ ├── ia64.h │ ├── ordered_except_wr.h │ ├── powerpc.h │ ├── read_ordered.h │ ├── sparc.h │ ├── standard_ao_double_t.h │ ├── test_and_set_t_is_ao_t.h │ ├── test_and_set_t_is_char.h │ ├── x86.h │ └── x86_64.h ├── build │ ├── CMakeFiles │ │ ├── 3.10.2 │ │ │ ├── CMakeCCompiler.cmake │ │ │ ├── CMakeCXXCompiler.cmake │ │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ │ ├── CMakeSystem.cmake │ │ │ ├── CompilerIdC │ │ │ │ └── CMakeCCompilerId.c │ │ │ └── CompilerIdCXX │ │ │ │ └── CMakeCXXCompilerId.cpp │ │ ├── CMakeDirectoryInformation.cmake │ │ ├── CMakeOutput.log │ │ ├── Makefile.cmake │ │ ├── Makefile2 │ │ ├── cmake.check_cache │ │ ├── feature_tests.bin │ │ ├── feature_tests.c │ │ ├── feature_tests.cxx │ │ ├── fptree_main.dir │ │ │ ├── CXX.includecache │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.internal │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ └── progress.make │ │ ├── main-gu-zipfian.dir │ │ │ ├── CXX.includecache │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.internal │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ └── progress.make │ │ ├── nvtree_main.dir │ │ │ ├── CXX.includecache │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.internal │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ └── progress.make │ │ ├── progress.marks │ │ └── wb+tree_main.dir │ │ │ ├── CXX.includecache │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.internal │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ └── progress.make │ ├── Makefile │ └── cmake_install.cmake ├── include │ ├── benchmarks.h │ ├── config.h │ ├── coordinator.h │ ├── fptree.h │ ├── index.h │ ├── index_factory.h │ ├── microbench.h │ ├── nv_tree.h │ ├── nvm_mgr.h │ ├── pmalloc_wrap.h │ ├── rtm_tree.h │ ├── rtm_tree_r.h │ ├── threadinfo.h │ ├── timer.h │ ├── util.h │ ├── wbtree.h │ ├── wbtree2.h │ ├── zipfian.h │ └── zipfian_util.h ├── run.sh ├── src │ ├── data_generator.cpp │ ├── main.cpp │ ├── nvm_mgr.cpp │ ├── recover_test.cpp │ ├── threadinfo.cpp │ └── util.cpp ├── test.py ├── test │ ├── fptree_main.cpp │ ├── nvtree_main.cpp │ └── wb+tree_main.cpp └── third-party-lib │ └── tbb │ ├── aggregator.h │ ├── aligned_space.h │ ├── atomic.h │ ├── blocked_range.h │ ├── blocked_range2d.h │ ├── blocked_range3d.h │ ├── cache_aligned_allocator.h │ ├── combinable.h │ ├── compat │ ├── condition_variable │ ├── ppl.h │ ├── thread │ └── tuple │ ├── concurrent_hash_map.h │ ├── concurrent_lru_cache.h │ ├── concurrent_priority_queue.h │ ├── concurrent_queue.h │ ├── concurrent_unordered_map.h │ ├── concurrent_unordered_set.h │ ├── concurrent_vector.h │ ├── critical_section.h │ ├── enumerable_thread_specific.h │ ├── flow_graph.h │ ├── flow_graph_abstractions.h │ ├── flow_graph_opencl_node.h │ ├── gfx_factory.h │ ├── global_control.h │ ├── index.html │ ├── internal │ ├── _aggregator_impl.h │ ├── _concurrent_queue_impl.h │ ├── _concurrent_unordered_impl.h │ ├── _flow_graph_async_msg_impl.h │ ├── _flow_graph_body_impl.h │ ├── _flow_graph_cache_impl.h │ ├── _flow_graph_impl.h │ ├── _flow_graph_indexer_impl.h │ ├── _flow_graph_item_buffer_impl.h │ ├── _flow_graph_join_impl.h │ ├── _flow_graph_node_impl.h │ ├── _flow_graph_streaming_node.h │ ├── _flow_graph_tagged_buffer_impl.h │ ├── _flow_graph_trace_impl.h │ ├── _flow_graph_types_impl.h │ ├── _mutex_padding.h │ ├── _range_iterator.h │ ├── _tbb_hash_compare_impl.h │ ├── _tbb_strings.h │ ├── _tbb_trace_impl.h │ ├── _tbb_windef.h │ ├── _template_helpers.h │ ├── _x86_eliding_mutex_impl.h │ └── _x86_rtm_rw_mutex_impl.h │ ├── machine │ ├── gcc_armv7.h │ ├── gcc_generic.h │ ├── gcc_ia32_common.h │ ├── gcc_itsx.h │ ├── ibm_aix51.h │ ├── icc_generic.h │ ├── linux_common.h │ ├── linux_ia32.h │ ├── linux_ia64.h │ ├── linux_intel64.h │ ├── mac_ppc.h │ ├── macos_common.h │ ├── mic_common.h │ ├── msvc_armv7.h │ ├── msvc_ia32_common.h │ ├── sunos_sparc.h │ ├── windows_api.h │ ├── windows_ia32.h │ └── windows_intel64.h │ ├── memory_pool.h │ ├── mutex.h │ ├── null_mutex.h │ ├── null_rw_mutex.h │ ├── parallel_do.h │ ├── parallel_for.h │ ├── parallel_for_each.h │ ├── parallel_invoke.h │ ├── parallel_reduce.h │ ├── parallel_scan.h │ ├── parallel_sort.h │ ├── parallel_while.h │ ├── partitioner.h │ ├── pipeline.h │ ├── queuing_mutex.h │ ├── queuing_rw_mutex.h │ ├── reader_writer_lock.h │ ├── recursive_mutex.h │ ├── runtime_loader.h │ ├── scalable_allocator.h │ ├── spin_mutex.h │ ├── spin_rw_mutex.h │ ├── task.h │ ├── task_arena.h │ ├── task_group.h │ ├── task_scheduler_init.h │ ├── task_scheduler_observer.h │ ├── tbb.h │ ├── tbb_allocator.h │ ├── tbb_config.h │ ├── tbb_disable_exceptions.h │ ├── tbb_exception.h │ ├── tbb_machine.h │ ├── tbb_profiling.h │ ├── tbb_stddef.h │ ├── tbb_thread.h │ ├── tbbmalloc_proxy.h │ └── tick_count.h ├── fast_fair ├── btree.h ├── build.sh ├── main.cpp └── run.sh ├── nv-skiplist ├── build.sh ├── main.cpp ├── run.sh └── skiplist.h ├── uTree ├── build.sh ├── main.cpp ├── run.sh └── utree.h └── wb+tree ├── build.sh ├── main.cpp ├── run.sh └── wbtree.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | mount/* 4 | *.txt 5 | *.pdf 6 | 7 | # Object files 8 | *.o 9 | *.ko 10 | *.obj 11 | *.elf 12 | 13 | # Linker output 14 | *.ilk 15 | *.map 16 | *.exp 17 | 18 | # Precompiled Headers 19 | *.gch 20 | *.pch 21 | 22 | # Libraries 23 | *.lib 24 | *.a 25 | *.la 26 | *.lo 27 | 28 | # Shared objects (inc. Windows DLLs) 29 | *.dll 30 | *.so 31 | *.so.* 32 | *.dylib 33 | 34 | # Executables 35 | *.exe 36 | *.out 37 | *.app 38 | *.i*86 39 | *.x86_64 40 | *.hex 41 | 42 | # Debug files 43 | *.dSYM/ 44 | *.su 45 | *.idb 46 | *.pdb 47 | .git/* 48 | 49 | # Kernel Module Compile Results 50 | *.mod* 51 | *.cmd 52 | .tmp_versions/ 53 | modules.order 54 | Module.symvers 55 | Mkfile.old 56 | dkms.conf 57 | *.o.ur-safe 58 | 59 | # vim 60 | .*swp 61 | tags 62 | 63 | # vscode 64 | .vscode 65 | 66 | # macOS 67 | .DS_Store 68 | -------------------------------------------------------------------------------- /Documentation/uTree-overview.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/Documentation/uTree-overview.PNG -------------------------------------------------------------------------------- /kv-store-test/vire/.gitignore: -------------------------------------------------------------------------------- 1 | # pyc 2 | *.pyc 3 | 4 | # Compiled Object files 5 | *.lo 6 | *.o 7 | 8 | # Compiled Dynamic libraries 9 | *.so 10 | 11 | # Compiled Static libraries 12 | *.la 13 | *.a 14 | 15 | # Compiled misc 16 | *.dep 17 | *.gcda 18 | *.gcno 19 | *.gcov 20 | 21 | # Packages 22 | *.tar.gz 23 | *.tar.bz2 24 | 25 | # Logs 26 | *.log 27 | 28 | # vire 29 | *.swp 30 | *.~ 31 | *.project 32 | *.cproject 33 | 34 | # Core and executable 35 | core* 36 | vire 37 | 38 | # extracted jemalloc 39 | !/dep/jemalloc-* 40 | 41 | # Autotools 42 | .deps 43 | .libs 44 | 45 | /aclocal.m4 46 | /autom4te.cache 47 | /stamp-h1 48 | /autoscan.log 49 | /libtool 50 | 51 | /config/config.guess 52 | /config/config.sub 53 | /config/depcomp 54 | /config/install-sh 55 | /config/ltmain.sh 56 | /config/missing 57 | /config 58 | 59 | /config.h 60 | /config.h.in 61 | /config.h.in~ 62 | /config.log 63 | /config.status 64 | /configure.scan 65 | /configure 66 | 67 | Makefile 68 | Makefile.in 69 | -------------------------------------------------------------------------------- /kv-store-test/vire/ChangeLog: -------------------------------------------------------------------------------- 1 | 2016-10-25 deep011 2 | * vire: version 1.0.0 release 3 | vire (pronounced "vip-redis") is a multithread redis(based on redis-3.2.0) maintains in vipshop. 4 | multi-threads support. 5 | command type CONNECTION supported: ping,quit,echo,select,auth,admin. 6 | command type SERVER supported: info,flushall,flushdb,time,dbsize,command,config,client,slowlog. 7 | command type KEY supported: del,exists,ttl,pttl,expire,expireat,pexpire,pexpireat,persist,randomkey,type,keys,scan,object. 8 | command type STRING supported: get,set,setnx,setex,psetex,incr,decr,incrby,decrby,append,strlen,getset,incrbyfloat,setbit,getbit,setrange,getrange,bitcount,bitpos,mget,mset. 9 | command type HASH supported: hset,hget,hlen,hdel,hexists,hkeys,hvals,hgetall,hincrby,hincrbyfloat,hmget,hmset,hsetnx,hstrlen,hscan. 10 | command type LIST supported: rpush,lpush,lrange,rpop,lpop,llen,lrem,ltrim,lindex,lset. 11 | command type SET supported: sadd,smembers,scard,srem,spop,sismember,sscan,sunion,sunionstore,sdiff,sdiffstore,sinter,sinterstore. 12 | command type SORTEDSET supported: zadd,zincrby,zrange,zrevrange,zrem,zcard,zcount,zrangebyscore,zrevrangebyscore,zrank,zrevrank,zscore,zremrangebyscore,zremrangebyrank,zremrangebylex,zscan. 13 | command type HYPERLOGLOG supported: pfadd,pfcount. 14 | config option added(used for config file and 'config get/set' command): port,databases,internal-dbs-per-databases,requirepass,adminpass,commands-need-adminpass,maxclients,maxmemory,maxmemory-policy,maxmemory-samples,max-time-complexity-limit,slowlog-log-slower-than,slowlog-max-len. 15 | viretest added that is for unit test. 16 | vireabtest added that is for compare command execution and data consistency with redis-3.2.0. 17 | vire-benchmark added that is modified from redis-benchmark but multi-threads supported and pressure test vire. -------------------------------------------------------------------------------- /kv-store-test/vire/Makefile.am: -------------------------------------------------------------------------------- 1 | MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config.h.in config.h.in~ stamp-h.in 2 | 3 | ACLOCAL_AMFLAGS = -I m4 4 | 5 | SUBDIRS = dep src tests 6 | 7 | EXTRA_DIST = README.md NOTICE LICENSE ChangeLog conf scripts notes 8 | -------------------------------------------------------------------------------- /kv-store-test/vire/NOTICE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/kv-store-test/vire/NOTICE -------------------------------------------------------------------------------- /kv-store-test/vire/dep/.gitignore: -------------------------------------------------------------------------------- 1 | !*.tar.gz -------------------------------------------------------------------------------- /kv-store-test/vire/dep/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = jemalloc-4.2.0 hiredis-0.13.3 himemcached-0.1.0 util dhashkit dmalloc ae sds dlist darray 2 | 3 | EXTRA_DIST = jemalloc-4.2.0.tar.bz2 hiredis-0.13.3.tar.gz 4 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/ae/Makefile.am: -------------------------------------------------------------------------------- 1 | MAINTAINERCLEANFILES = Makefile.in 2 | 3 | AM_CPPFLAGS = 4 | if !OS_SOLARIS 5 | AM_CPPFLAGS += -D_GNU_SOURCE 6 | endif 7 | AM_CPPFLAGS += -I $(top_srcdir)/dep/util 8 | AM_CPPFLAGS += -I $(top_srcdir)/dep/jemalloc-4.2.0/include 9 | AM_CPPFLAGS += -I $(top_srcdir)/dep/dmalloc 10 | 11 | AM_CFLAGS = -Wall -Wshadow 12 | AM_CFLAGS += -Wno-unused-parameter -Wno-unused-value 13 | 14 | noinst_LIBRARIES = libae.a 15 | 16 | noinst_HEADERS = ae.h 17 | 18 | libae_a_SOURCES = \ 19 | ae.c ae.h -------------------------------------------------------------------------------- /kv-store-test/vire/dep/darray/Makefile.am: -------------------------------------------------------------------------------- 1 | MAINTAINERCLEANFILES = Makefile.in 2 | 3 | AM_CPPFLAGS = 4 | if !OS_SOLARIS 5 | AM_CPPFLAGS += -D_GNU_SOURCE 6 | endif 7 | AM_CPPFLAGS += -I $(top_srcdir)/dep/util 8 | AM_CPPFLAGS += -I $(top_srcdir)/dep/jemalloc-4.2.0/include 9 | AM_CPPFLAGS += -I $(top_srcdir)/dep/dmalloc 10 | 11 | AM_CFLAGS = -Wall -Wshadow 12 | AM_CFLAGS += -Wno-unused-parameter -Wno-unused-value 13 | 14 | noinst_LIBRARIES = libdarray.a 15 | 16 | noinst_HEADERS = darray.h 17 | 18 | libdarray_a_SOURCES = \ 19 | darray.c darray.h -------------------------------------------------------------------------------- /kv-store-test/vire/dep/darray/darray.h: -------------------------------------------------------------------------------- 1 | #ifndef _DARRAY_H_ 2 | #define _DARRAY_H_ 3 | 4 | typedef int (*darray_compare_t)(const void *, const void *); 5 | typedef int (*darray_each_t)(void *, void *); 6 | 7 | typedef struct darray { 8 | unsigned long long nelem; /* # element */ 9 | void *elem; /* element */ 10 | size_t size; /* element size */ 11 | unsigned long long nalloc; /* # allocated element */ 12 | } darray; 13 | 14 | #define null_darray { 0, NULL, 0, 0 } 15 | 16 | static inline void 17 | darray_null(darray *a) 18 | { 19 | a->nelem = 0; 20 | a->elem = NULL; 21 | a->size = 0; 22 | a->nalloc = 0; 23 | } 24 | 25 | static inline void 26 | darray_set(darray *a, void *elem, size_t size, unsigned long long nalloc) 27 | { 28 | a->nelem = 0; 29 | a->elem = elem; 30 | a->size = size; 31 | a->nalloc = nalloc; 32 | } 33 | 34 | static inline unsigned long long 35 | darray_n(const darray *a) 36 | { 37 | return a->nelem; 38 | } 39 | 40 | darray *darray_create(unsigned long long n, size_t size); 41 | void darray_destroy(darray *a); 42 | int darray_init(darray *a, unsigned long long n, size_t size); 43 | void darray_deinit(darray *a); 44 | 45 | unsigned long long darray_idx(darray *a, void *elem); 46 | void *darray_push(darray *a); 47 | void *darray_pop(darray *a); 48 | void *darray_get(darray *a, unsigned long long idx); 49 | void *darray_top(darray *a); 50 | void darray_swap(darray *a, darray *b); 51 | void darray_sort(darray *a, darray_compare_t compare); 52 | int darray_each(darray *a, darray_each_t func, void *data); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/dhashkit/Makefile.am: -------------------------------------------------------------------------------- 1 | MAINTAINERCLEANFILES = Makefile.in 2 | 3 | AM_CFLAGS = -Wall -Wshadow 4 | AM_CFLAGS += -Wno-unused-parameter -Wno-unused-value 5 | 6 | noinst_LIBRARIES = libdhashkit.a 7 | 8 | noinst_HEADERS = dhashkit.h 9 | 10 | libdhashkit_a_SOURCES = \ 11 | dhashkit.h \ 12 | dcrc16.c \ 13 | dcrc32.c \ 14 | dfnv.c \ 15 | dhsieh.c \ 16 | djenkins.c \ 17 | dketama.c \ 18 | dmd5.c \ 19 | dmodula.c \ 20 | dmurmur.c \ 21 | done_at_a_time.c \ 22 | drandom.c \ 23 | dsha1.c -------------------------------------------------------------------------------- /kv-store-test/vire/dep/dhashkit/dfnv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static uint64_t FNV_64_INIT = UINT64_C(0xcbf29ce484222325); 4 | static uint64_t FNV_64_PRIME = UINT64_C(0x100000001b3); 5 | static uint32_t FNV_32_INIT = 2166136261UL; 6 | static uint32_t FNV_32_PRIME = 16777619; 7 | 8 | uint32_t 9 | hash_fnv1_64(const char *key, size_t key_length) 10 | { 11 | uint64_t hash = FNV_64_INIT; 12 | size_t x; 13 | 14 | for (x = 0; x < key_length; x++) { 15 | hash *= FNV_64_PRIME; 16 | hash ^= (uint64_t)key[x]; 17 | } 18 | 19 | return (uint32_t)hash; 20 | } 21 | 22 | uint32_t 23 | hash_fnv1a_64(const char *key, size_t key_length) 24 | { 25 | uint32_t hash = (uint32_t) FNV_64_INIT; 26 | size_t x; 27 | 28 | for (x = 0; x < key_length; x++) { 29 | uint32_t val = (uint32_t)key[x]; 30 | hash ^= val; 31 | hash *= (uint32_t) FNV_64_PRIME; 32 | } 33 | 34 | return hash; 35 | } 36 | 37 | uint32_t 38 | hash_fnv1_32(const char *key, size_t key_length) 39 | { 40 | uint32_t hash = FNV_32_INIT; 41 | size_t x; 42 | 43 | for (x = 0; x < key_length; x++) { 44 | uint32_t val = (uint32_t)key[x]; 45 | hash *= FNV_32_PRIME; 46 | hash ^= val; 47 | } 48 | 49 | return hash; 50 | } 51 | 52 | uint32_t 53 | hash_fnv1a_32(const char *key, size_t key_length) 54 | { 55 | uint32_t hash = FNV_32_INIT; 56 | size_t x; 57 | 58 | for (x= 0; x < key_length; x++) { 59 | uint32_t val = (uint32_t)key[x]; 60 | hash ^= val; 61 | hash *= FNV_32_PRIME; 62 | } 63 | 64 | return hash; 65 | } 66 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/dhashkit/dhsieh.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #undef get16bits 4 | #if (defined(__GNUC__) && defined(__i386__)) 5 | #define get16bits(d) (*((const uint16_t *) (d))) 6 | #endif 7 | 8 | #if !defined (get16bits) 9 | #define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)\ 10 | +(uint32_t)(((const uint8_t *)(d))[0]) ) 11 | #endif 12 | 13 | uint32_t 14 | hash_hsieh(const char *key, size_t key_length) 15 | { 16 | uint32_t hash = 0, tmp; 17 | int rem; 18 | 19 | if (key_length <= 0 || key == NULL) { 20 | return 0; 21 | } 22 | 23 | rem = key_length & 3; 24 | key_length >>= 2; 25 | 26 | /* Main loop */ 27 | for (;key_length > 0; key_length--) { 28 | hash += get16bits (key); 29 | tmp = (get16bits (key+2) << 11) ^ hash; 30 | hash = (hash << 16) ^ tmp; 31 | key += 2*sizeof (uint16_t); 32 | hash += hash >> 11; 33 | } 34 | 35 | /* Handle end cases */ 36 | switch (rem) { 37 | case 3: 38 | hash += get16bits (key); 39 | hash ^= hash << 16; 40 | hash ^= (uint32_t)key[sizeof (uint16_t)] << 18; 41 | hash += hash >> 11; 42 | break; 43 | 44 | case 2: 45 | hash += get16bits (key); 46 | hash ^= hash << 11; 47 | hash += hash >> 17; 48 | break; 49 | 50 | case 1: 51 | hash += (unsigned char)(*key); 52 | hash ^= hash << 10; 53 | hash += hash >> 1; 54 | 55 | default: 56 | break; 57 | } 58 | 59 | /* Force "avalanching" of final 127 bits */ 60 | hash ^= hash << 3; 61 | hash += hash >> 5; 62 | hash ^= hash << 4; 63 | hash += hash >> 17; 64 | hash ^= hash << 25; 65 | hash += hash >> 6; 66 | 67 | return hash; 68 | } 69 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/dhashkit/dketama.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #define KETAMA_CONTINUUM_ADDITION 10 /* # extra slots to build into continuum */ 8 | #define KETAMA_POINTS_PER_SERVER 160 /* 40 points per hash */ 9 | #define KETAMA_MAX_HOSTLEN 86 10 | 11 | static uint32_t 12 | ketama_hash(const char *key, size_t key_length, uint32_t alignment) 13 | { 14 | unsigned char results[16]; 15 | 16 | md5_signature((const unsigned char*)key, (unsigned long)key_length, results); 17 | 18 | return ((uint32_t) (results[3 + alignment * 4] & 0xFF) << 24) 19 | | ((uint32_t) (results[2 + alignment * 4] & 0xFF) << 16) 20 | | ((uint32_t) (results[1 + alignment * 4] & 0xFF) << 8) 21 | | (results[0 + alignment * 4] & 0xFF); 22 | } 23 | 24 | static int 25 | ketama_item_cmp(const void *t1, const void *t2) 26 | { 27 | const struct continuum *ct1 = t1, *ct2 = t2; 28 | 29 | if (ct1->value == ct2->value) { 30 | return 0; 31 | } else if (ct1->value > ct2->value) { 32 | return 1; 33 | } else { 34 | return -1; 35 | } 36 | } 37 | 38 | uint32_t 39 | ketama_dispatch(struct continuum *continuum, uint32_t ncontinuum, uint32_t hash) 40 | { 41 | struct continuum *begin, *end, *left, *right, *middle; 42 | 43 | ASSERT(continuum != NULL); 44 | ASSERT(ncontinuum != 0); 45 | 46 | begin = left = continuum; 47 | end = right = continuum + ncontinuum; 48 | 49 | while (left < right) { 50 | middle = left + (right - left) / 2; 51 | if (middle->value < hash) { 52 | left = middle + 1; 53 | } else { 54 | right = middle; 55 | } 56 | } 57 | 58 | if (right == end) { 59 | right = begin; 60 | } 61 | 62 | return right->index; 63 | } 64 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/dhashkit/dmodula.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #define MODULA_CONTINUUM_ADDITION 10 /* # extra slots to build into continuum */ 7 | #define MODULA_POINTS_PER_SERVER 1 8 | 9 | uint32_t 10 | modula_dispatch(struct continuum *continuum, uint32_t ncontinuum, uint32_t hash) 11 | { 12 | struct continuum *c; 13 | 14 | ASSERT(continuum != NULL); 15 | ASSERT(ncontinuum != 0); 16 | 17 | c = continuum + hash % ncontinuum; 18 | 19 | return c->index; 20 | } 21 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/dhashkit/done_at_a_time.c: -------------------------------------------------------------------------------- 1 | /* 2 | * HashKit 3 | * Copyright (C) 2009 Brian Aker 4 | * All rights reserved. 5 | * 6 | * Use and distribution licensed under the BSD license. See 7 | * the COPYING file in the parent directory for full text. 8 | */ 9 | 10 | /* 11 | * This has is Jenkin's "One at A time Hash". 12 | * http://en.wikipedia.org/wiki/Jenkins_hash_function 13 | */ 14 | 15 | #include 16 | 17 | uint32_t 18 | hash_one_at_a_time(const char *key, size_t key_length) 19 | { 20 | const char *ptr = key; 21 | uint32_t value = 0; 22 | 23 | while (key_length--) { 24 | uint32_t val = (uint32_t) *ptr++; 25 | value += val; 26 | value += (value << 10); 27 | value ^= (value >> 6); 28 | } 29 | value += (value << 3); 30 | value ^= (value >> 11); 31 | value += (value << 15); 32 | 33 | return value; 34 | } 35 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/dhashkit/drandom.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #define RANDOM_CONTINUUM_ADDITION 10 /* # extra slots to build into continuum */ 7 | #define RANDOM_POINTS_PER_SERVER 1 8 | 9 | uint32_t 10 | random_dispatch(struct continuum *continuum, uint32_t ncontinuum, uint32_t hash) 11 | { 12 | struct continuum *c; 13 | 14 | ASSERT(continuum != NULL); 15 | ASSERT(ncontinuum != 0); 16 | 17 | c = continuum + random() % ncontinuum; 18 | 19 | return c->index; 20 | } 21 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/dlist/Makefile.am: -------------------------------------------------------------------------------- 1 | MAINTAINERCLEANFILES = Makefile.in 2 | 3 | AM_CPPFLAGS = 4 | if !OS_SOLARIS 5 | AM_CPPFLAGS += -D_GNU_SOURCE 6 | endif 7 | AM_CPPFLAGS += -I $(top_srcdir)/dep/util 8 | AM_CPPFLAGS += -I $(top_srcdir)/dep/jemalloc-4.2.0/include 9 | AM_CPPFLAGS += -I $(top_srcdir)/dep/dmalloc 10 | 11 | AM_CFLAGS = -Wall -Wshadow 12 | AM_CFLAGS += -Wno-unused-parameter -Wno-unused-value 13 | 14 | noinst_LIBRARIES = libdlist.a 15 | 16 | noinst_HEADERS = dlist.h dmtqueue.h dlockqueue.h 17 | 18 | libdlist_a_SOURCES = \ 19 | dlist.c dlist.h \ 20 | dmtqueue.c dmtqueue.h \ 21 | dlockqueue.c dlockqueue.h -------------------------------------------------------------------------------- /kv-store-test/vire/dep/dlist/dlockqueue.h: -------------------------------------------------------------------------------- 1 | #ifndef _DLOCKQUEUE_H_ 2 | #define _DLOCKQUEUE_H_ 3 | 4 | struct dlist; 5 | 6 | typedef struct dlockqueue{ 7 | struct dlist *l; 8 | long long maxlen; 9 | int maxlen_policy; 10 | pthread_mutex_t lmutex; 11 | } dlockqueue; 12 | 13 | dlockqueue *dlockqueue_create(void); 14 | long long dlockqueue_push(void *q, void *value); 15 | void *dlockqueue_pop(void *q); 16 | void dlockqueue_destroy(void *q); 17 | long long dlockqueue_length(void *q); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/dlist/dmtqueue.h: -------------------------------------------------------------------------------- 1 | #ifndef _DMTQUEUE_H_ 2 | #define _DMTQUEUE_H_ 3 | 4 | #define MAX_LENGTH_POLICY_REJECT 0 5 | #define MAX_LENGTH_POLICY_EVICT_HEAD 1 6 | #define MAX_LENGTH_POLICY_EVICT_END 2 7 | 8 | /* Multi-thread safe queue */ 9 | typedef struct dmtqueue{ 10 | void *l; 11 | long long (*lock_push)(void *q, void *value); 12 | void *(*lock_pop)(void *q); 13 | void (*destroy)(void *q); 14 | long long (*length)(void *q); 15 | } dmtqueue; 16 | 17 | #define dmtqueueSetMaxlength(q,l) ((q)->l->maxlen = (l)) 18 | #define dmtqueueSetMaxlengthPolicy(q,p) ((q)->l->maxlen = (p)) 19 | 20 | typedef int (*dmtqueue_init)(dmtqueue *); 21 | 22 | /******** multi-thread safe list interface ********/ 23 | 24 | dmtqueue *dmtqueue_create(void); 25 | void dmtqueue_destroy(dmtqueue *q); 26 | long long dmtqueue_push(dmtqueue *q, void *value); 27 | void *dmtqueue_pop(dmtqueue *q); 28 | int dmtqueue_empty(dmtqueue *q); 29 | long long dmtqueue_length(dmtqueue *q); 30 | 31 | /******** multi-thread safe list implement ********/ 32 | 33 | typedef void (*dlockqueue_freefunc)(void *); 34 | int dmtqueue_init_with_lockqueue(dmtqueue *l, dlockqueue_freefunc freefunc); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/dmalloc/Makefile.am: -------------------------------------------------------------------------------- 1 | MAINTAINERCLEANFILES = Makefile.in 2 | 3 | AM_CPPFLAGS = 4 | if !OS_SOLARIS 5 | AM_CPPFLAGS += -D_GNU_SOURCE 6 | endif 7 | AM_CPPFLAGS += -I $(top_srcdir)/dep/jemalloc-4.2.0/include 8 | AM_CPPFLAGS += -I $(top_srcdir)/dep/util 9 | 10 | AM_CFLAGS = -Wall -Wshadow 11 | AM_CFLAGS += -Wno-unused-parameter -Wno-unused-value 12 | 13 | noinst_LIBRARIES = libdmalloc.a 14 | 15 | noinst_HEADERS = dmalloc.h 16 | 17 | libdmalloc_a_SOURCES = \ 18 | dmalloc.c dmalloc.h -------------------------------------------------------------------------------- /kv-store-test/vire/dep/himemcached-0.1.0/Makefile.am: -------------------------------------------------------------------------------- 1 | MAINTAINERCLEANFILES = Makefile.in 2 | 3 | AM_CFLAGS = -Wall -Wshadow 4 | AM_CFLAGS += -Wno-unused-parameter -Wno-unused-value 5 | 6 | noinst_LIBRARIES = libhimemcached.a 7 | 8 | noinst_HEADERS = himemcached.h himcread.h himcdep/sds.h 9 | 10 | libhimemcached_a_SOURCES = \ 11 | himcdep/sds.c himcdep/sds.h \ 12 | himcread.c himcread.h \ 13 | himemcached.c himemcached.h -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/kv-store-test/vire/dep/hiredis-0.13.3.tar.gz -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3/.gitignore: -------------------------------------------------------------------------------- 1 | /hiredis-test 2 | /examples/hiredis-example* 3 | /*.o 4 | /*.so 5 | /*.dylib 6 | /*.a 7 | /*.pc 8 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3/.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | sudo: false 3 | compiler: 4 | - gcc 5 | - clang 6 | 7 | addons: 8 | apt: 9 | packages: 10 | - libc6-dbg 11 | - libc6-dev 12 | - libc6:i386 13 | - libc6-dev-i386 14 | - libc6-dbg:i386 15 | - gcc-multilib 16 | - valgrind 17 | 18 | env: 19 | - CFLAGS="-Werror" 20 | - PRE="valgrind --track-origins=yes --leak-check=full" 21 | - TARGET="32bit" TARGET_VARS="32bit-vars" CFLAGS="-Werror" 22 | - TARGET="32bit" TARGET_VARS="32bit-vars" PRE="valgrind --track-origins=yes --leak-check=full" 23 | 24 | script: make $TARGET CFLAGS="$CFLAGS" && make check PRE="$PRE" && make $TARGET_VARS hiredis-example 25 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2011, Salvatore Sanfilippo 2 | Copyright (c) 2010-2011, Pieter Noordhuis 3 | 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of Redis nor the names of its contributors may be used 17 | to endorse or promote products derived from this software without specific 18 | prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 27 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3/examples/example-ae.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | /* Put event loop in the global scope, so it can be explicitly stopped */ 11 | static aeEventLoop *loop; 12 | 13 | void getCallback(redisAsyncContext *c, void *r, void *privdata) { 14 | redisReply *reply = r; 15 | if (reply == NULL) return; 16 | printf("argv[%s]: %s\n", (char*)privdata, reply->str); 17 | 18 | /* Disconnect after receiving the reply to GET */ 19 | redisAsyncDisconnect(c); 20 | } 21 | 22 | void connectCallback(const redisAsyncContext *c, int status) { 23 | if (status != REDIS_OK) { 24 | printf("Error: %s\n", c->errstr); 25 | aeStop(loop); 26 | return; 27 | } 28 | 29 | printf("Connected...\n"); 30 | } 31 | 32 | void disconnectCallback(const redisAsyncContext *c, int status) { 33 | if (status != REDIS_OK) { 34 | printf("Error: %s\n", c->errstr); 35 | aeStop(loop); 36 | return; 37 | } 38 | 39 | printf("Disconnected...\n"); 40 | aeStop(loop); 41 | } 42 | 43 | int main (int argc, char **argv) { 44 | signal(SIGPIPE, SIG_IGN); 45 | 46 | redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379); 47 | if (c->err) { 48 | /* Let *c leak for now... */ 49 | printf("Error: %s\n", c->errstr); 50 | return 1; 51 | } 52 | 53 | loop = aeCreateEventLoop(64); 54 | redisAeAttach(loop, c); 55 | redisAsyncSetConnectCallback(c,connectCallback); 56 | redisAsyncSetDisconnectCallback(c,disconnectCallback); 57 | redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1])); 58 | redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key"); 59 | aeMain(loop); 60 | return 0; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3/examples/example-ivykis.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | void getCallback(redisAsyncContext *c, void *r, void *privdata) { 11 | redisReply *reply = r; 12 | if (reply == NULL) return; 13 | printf("argv[%s]: %s\n", (char*)privdata, reply->str); 14 | 15 | /* Disconnect after receiving the reply to GET */ 16 | redisAsyncDisconnect(c); 17 | } 18 | 19 | void connectCallback(const redisAsyncContext *c, int status) { 20 | if (status != REDIS_OK) { 21 | printf("Error: %s\n", c->errstr); 22 | return; 23 | } 24 | printf("Connected...\n"); 25 | } 26 | 27 | void disconnectCallback(const redisAsyncContext *c, int status) { 28 | if (status != REDIS_OK) { 29 | printf("Error: %s\n", c->errstr); 30 | return; 31 | } 32 | printf("Disconnected...\n"); 33 | } 34 | 35 | int main (int argc, char **argv) { 36 | signal(SIGPIPE, SIG_IGN); 37 | 38 | iv_init(); 39 | 40 | redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379); 41 | if (c->err) { 42 | /* Let *c leak for now... */ 43 | printf("Error: %s\n", c->errstr); 44 | return 1; 45 | } 46 | 47 | redisIvykisAttach(c); 48 | redisAsyncSetConnectCallback(c,connectCallback); 49 | redisAsyncSetDisconnectCallback(c,disconnectCallback); 50 | redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1])); 51 | redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key"); 52 | 53 | iv_main(); 54 | 55 | iv_deinit(); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3/examples/example-libev.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | void getCallback(redisAsyncContext *c, void *r, void *privdata) { 11 | redisReply *reply = r; 12 | if (reply == NULL) return; 13 | printf("argv[%s]: %s\n", (char*)privdata, reply->str); 14 | 15 | /* Disconnect after receiving the reply to GET */ 16 | redisAsyncDisconnect(c); 17 | } 18 | 19 | void connectCallback(const redisAsyncContext *c, int status) { 20 | if (status != REDIS_OK) { 21 | printf("Error: %s\n", c->errstr); 22 | return; 23 | } 24 | printf("Connected...\n"); 25 | } 26 | 27 | void disconnectCallback(const redisAsyncContext *c, int status) { 28 | if (status != REDIS_OK) { 29 | printf("Error: %s\n", c->errstr); 30 | return; 31 | } 32 | printf("Disconnected...\n"); 33 | } 34 | 35 | int main (int argc, char **argv) { 36 | signal(SIGPIPE, SIG_IGN); 37 | 38 | redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379); 39 | if (c->err) { 40 | /* Let *c leak for now... */ 41 | printf("Error: %s\n", c->errstr); 42 | return 1; 43 | } 44 | 45 | redisLibevAttach(EV_DEFAULT_ c); 46 | redisAsyncSetConnectCallback(c,connectCallback); 47 | redisAsyncSetDisconnectCallback(c,disconnectCallback); 48 | redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1])); 49 | redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key"); 50 | ev_loop(EV_DEFAULT_ 0); 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3/examples/example-libevent.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | void getCallback(redisAsyncContext *c, void *r, void *privdata) { 11 | redisReply *reply = r; 12 | if (reply == NULL) return; 13 | printf("argv[%s]: %s\n", (char*)privdata, reply->str); 14 | 15 | /* Disconnect after receiving the reply to GET */ 16 | redisAsyncDisconnect(c); 17 | } 18 | 19 | void connectCallback(const redisAsyncContext *c, int status) { 20 | if (status != REDIS_OK) { 21 | printf("Error: %s\n", c->errstr); 22 | return; 23 | } 24 | printf("Connected...\n"); 25 | } 26 | 27 | void disconnectCallback(const redisAsyncContext *c, int status) { 28 | if (status != REDIS_OK) { 29 | printf("Error: %s\n", c->errstr); 30 | return; 31 | } 32 | printf("Disconnected...\n"); 33 | } 34 | 35 | int main (int argc, char **argv) { 36 | signal(SIGPIPE, SIG_IGN); 37 | struct event_base *base = event_base_new(); 38 | 39 | redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379); 40 | if (c->err) { 41 | /* Let *c leak for now... */ 42 | printf("Error: %s\n", c->errstr); 43 | return 1; 44 | } 45 | 46 | redisLibeventAttach(c,base); 47 | redisAsyncSetConnectCallback(c,connectCallback); 48 | redisAsyncSetDisconnectCallback(c,disconnectCallback); 49 | redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1])); 50 | redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key"); 51 | event_base_dispatch(base); 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3/examples/example-libuv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | void getCallback(redisAsyncContext *c, void *r, void *privdata) { 11 | redisReply *reply = r; 12 | if (reply == NULL) return; 13 | printf("argv[%s]: %s\n", (char*)privdata, reply->str); 14 | 15 | /* Disconnect after receiving the reply to GET */ 16 | redisAsyncDisconnect(c); 17 | } 18 | 19 | void connectCallback(const redisAsyncContext *c, int status) { 20 | if (status != REDIS_OK) { 21 | printf("Error: %s\n", c->errstr); 22 | return; 23 | } 24 | printf("Connected...\n"); 25 | } 26 | 27 | void disconnectCallback(const redisAsyncContext *c, int status) { 28 | if (status != REDIS_OK) { 29 | printf("Error: %s\n", c->errstr); 30 | return; 31 | } 32 | printf("Disconnected...\n"); 33 | } 34 | 35 | int main (int argc, char **argv) { 36 | signal(SIGPIPE, SIG_IGN); 37 | uv_loop_t* loop = uv_default_loop(); 38 | 39 | redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379); 40 | if (c->err) { 41 | /* Let *c leak for now... */ 42 | printf("Error: %s\n", c->errstr); 43 | return 1; 44 | } 45 | 46 | redisLibuvAttach(c,loop); 47 | redisAsyncSetConnectCallback(c,connectCallback); 48 | redisAsyncSetDisconnectCallback(c,disconnectCallback); 49 | redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1])); 50 | redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key"); 51 | uv_run(loop, UV_RUN_DEFAULT); 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3/examples/example-qt.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | #include 5 | #include 6 | 7 | #include "example-qt.h" 8 | 9 | void getCallback(redisAsyncContext *, void * r, void * privdata) { 10 | 11 | redisReply * reply = static_cast(r); 12 | ExampleQt * ex = static_cast(privdata); 13 | if (reply == nullptr || ex == nullptr) return; 14 | 15 | cout << "key: " << reply->str << endl; 16 | 17 | ex->finish(); 18 | } 19 | 20 | void ExampleQt::run() { 21 | 22 | m_ctx = redisAsyncConnect("localhost", 6379); 23 | 24 | if (m_ctx->err) { 25 | cerr << "Error: " << m_ctx->errstr << endl; 26 | redisAsyncFree(m_ctx); 27 | emit finished(); 28 | } 29 | 30 | m_adapter.setContext(m_ctx); 31 | 32 | redisAsyncCommand(m_ctx, NULL, NULL, "SET key %s", m_value); 33 | redisAsyncCommand(m_ctx, getCallback, this, "GET key"); 34 | } 35 | 36 | int main (int argc, char **argv) { 37 | 38 | QCoreApplication app(argc, argv); 39 | 40 | ExampleQt example(argv[argc-1]); 41 | 42 | QObject::connect(&example, SIGNAL(finished()), &app, SLOT(quit())); 43 | QTimer::singleShot(0, &example, SLOT(run())); 44 | 45 | return app.exec(); 46 | } 47 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3/examples/example-qt.h: -------------------------------------------------------------------------------- 1 | #ifndef __HIREDIS_EXAMPLE_QT_H 2 | #define __HIREDIS_EXAMPLE_QT_H 3 | 4 | #include 5 | 6 | class ExampleQt : public QObject { 7 | 8 | Q_OBJECT 9 | 10 | public: 11 | ExampleQt(const char * value, QObject * parent = 0) 12 | : QObject(parent), m_value(value) {} 13 | 14 | signals: 15 | void finished(); 16 | 17 | public slots: 18 | void run(); 19 | 20 | private: 21 | void finish() { emit finished(); } 22 | 23 | private: 24 | const char * m_value; 25 | redisAsyncContext * m_ctx; 26 | RedisQtAdapter m_adapter; 27 | 28 | friend 29 | void getCallback(redisAsyncContext *, void *, void *); 30 | }; 31 | 32 | #endif /* !__HIREDIS_EXAMPLE_QT_H */ 33 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3/fmacros.h: -------------------------------------------------------------------------------- 1 | #ifndef __HIREDIS_FMACRO_H 2 | #define __HIREDIS_FMACRO_H 3 | 4 | #if defined(__linux__) 5 | #define _BSD_SOURCE 6 | #define _DEFAULT_SOURCE 7 | #endif 8 | 9 | #if defined(__sun__) 10 | #define _POSIX_C_SOURCE 200112L 11 | #elif defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) 12 | #define _XOPEN_SOURCE 600 13 | #else 14 | #define _XOPEN_SOURCE 15 | #endif 16 | 17 | #if __APPLE__ && __MACH__ 18 | #define _OSX 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/hiredis-0.13.3/win32.h: -------------------------------------------------------------------------------- 1 | #ifndef _WIN32_HELPER_INCLUDE 2 | #define _WIN32_HELPER_INCLUDE 3 | #ifdef _MSC_VER 4 | 5 | #ifndef inline 6 | #define inline __inline 7 | #endif 8 | 9 | #ifndef va_copy 10 | #define va_copy(d,s) ((d) = (s)) 11 | #endif 12 | 13 | #ifndef snprintf 14 | #define snprintf c99_snprintf 15 | 16 | __inline int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap) 17 | { 18 | int count = -1; 19 | 20 | if (size != 0) 21 | count = _vsnprintf_s(str, size, _TRUNCATE, format, ap); 22 | if (count == -1) 23 | count = _vscprintf(format, ap); 24 | 25 | return count; 26 | } 27 | 28 | __inline int c99_snprintf(char* str, size_t size, const char* format, ...) 29 | { 30 | int count; 31 | va_list ap; 32 | 33 | va_start(ap, format); 34 | count = c99_vsnprintf(str, size, format, ap); 35 | va_end(ap); 36 | 37 | return count; 38 | } 39 | #endif 40 | 41 | #endif 42 | #endif -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0.tar.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/kv-store-test/vire/dep/jemalloc-4.2.0.tar.bz2 -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/.autom4te.cfg: -------------------------------------------------------------------------------- 1 | begin-language: "Autoconf-without-aclocal-m4" 2 | args: --no-cache 3 | end-language: "Autoconf-without-aclocal-m4" 4 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/COPYING: -------------------------------------------------------------------------------- 1 | Unless otherwise specified, files in the jemalloc source distribution are 2 | subject to the following license: 3 | -------------------------------------------------------------------------------- 4 | Copyright (C) 2002-2016 Jason Evans . 5 | All rights reserved. 6 | Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved. 7 | Copyright (C) 2009-2016 Facebook, Inc. All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 1. Redistributions of source code must retain the above copyright notice(s), 12 | this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright notice(s), 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS 18 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 19 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 20 | EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 26 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- 28 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/README: -------------------------------------------------------------------------------- 1 | jemalloc is a general purpose malloc(3) implementation that emphasizes 2 | fragmentation avoidance and scalable concurrency support. jemalloc first came 3 | into use as the FreeBSD libc allocator in 2005, and since then it has found its 4 | way into numerous applications that rely on its predictable behavior. In 2010 5 | jemalloc development efforts broadened to include developer support features 6 | such as heap profiling, Valgrind integration, and extensive monitoring/tuning 7 | hooks. Modern jemalloc releases continue to be integrated back into FreeBSD, 8 | and therefore versatility remains critical. Ongoing development efforts trend 9 | toward making jemalloc among the best allocators for a broad range of demanding 10 | applications, and eliminating/mitigating weaknesses that have practical 11 | repercussions for real world applications. 12 | 13 | The COPYING file contains copyright and licensing information. 14 | 15 | The INSTALL file contains information on how to configure, build, and install 16 | jemalloc. 17 | 18 | The ChangeLog file contains a brief summary of changes for each release. 19 | 20 | URL: http://www.canonware.com/jemalloc/ 21 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in autoconf; do 4 | echo "$i" 5 | $i 6 | if [ $? -ne 0 ]; then 7 | echo "Error $? in $i" 8 | exit 1 9 | fi 10 | done 11 | 12 | echo "./configure --enable-autogen $@" 13 | ./configure --enable-autogen $@ 14 | if [ $? -ne 0 ]; then 15 | echo "Error $? in ./configure" 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/bin/jemalloc-config.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | usage() { 4 | cat < 7 | Options: 8 | --help | -h : Print usage. 9 | --version : Print jemalloc version. 10 | --revision : Print shared library revision number. 11 | --config : Print configure options used to build jemalloc. 12 | --prefix : Print installation directory prefix. 13 | --bindir : Print binary installation directory. 14 | --datadir : Print data installation directory. 15 | --includedir : Print include installation directory. 16 | --libdir : Print library installation directory. 17 | --mandir : Print manual page installation directory. 18 | --cc : Print compiler used to build jemalloc. 19 | --cflags : Print compiler flags used to build jemalloc. 20 | --cppflags : Print preprocessor flags used to build jemalloc. 21 | --ldflags : Print library flags used to build jemalloc. 22 | --libs : Print libraries jemalloc was linked against. 23 | EOF 24 | } 25 | 26 | prefix="@prefix@" 27 | exec_prefix="@exec_prefix@" 28 | 29 | case "$1" in 30 | --help | -h) 31 | usage 32 | exit 0 33 | ;; 34 | --version) 35 | echo "@jemalloc_version@" 36 | ;; 37 | --revision) 38 | echo "@rev@" 39 | ;; 40 | --config) 41 | echo "@CONFIG@" 42 | ;; 43 | --prefix) 44 | echo "@PREFIX@" 45 | ;; 46 | --bindir) 47 | echo "@BINDIR@" 48 | ;; 49 | --datadir) 50 | echo "@DATADIR@" 51 | ;; 52 | --includedir) 53 | echo "@INCLUDEDIR@" 54 | ;; 55 | --libdir) 56 | echo "@LIBDIR@" 57 | ;; 58 | --mandir) 59 | echo "@MANDIR@" 60 | ;; 61 | --cc) 62 | echo "@CC@" 63 | ;; 64 | --cflags) 65 | echo "@CFLAGS@" 66 | ;; 67 | --cppflags) 68 | echo "@CPPFLAGS@" 69 | ;; 70 | --ldflags) 71 | echo "@LDFLAGS@ @EXTRA_LDFLAGS@" 72 | ;; 73 | --libs) 74 | echo "@LIBS@" 75 | ;; 76 | *) 77 | usage 78 | exit 1 79 | esac 80 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/bin/jemalloc.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | 7 | @LD_PRELOAD_VAR@=${libdir}/libjemalloc.@SOREV@ 8 | export @LD_PRELOAD_VAR@ 9 | exec "$@" 10 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/config.stamp.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/kv-store-test/vire/dep/jemalloc-4.2.0/config.stamp.in -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | objdir=$1 6 | suffix=$2 7 | shift 2 8 | objs=$@ 9 | 10 | gcov -b -p -f -o "${objdir}" ${objs} 11 | 12 | # Move gcov outputs so that subsequent gcov invocations won't clobber results 13 | # for the same sources with different compilation flags. 14 | for f in `find . -maxdepth 1 -type f -name '*.gcov'` ; do 15 | mv "${f}" "${f}.${suffix}" 16 | done 17 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/doc/html.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/doc/manpages.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/doc/stylesheet.xsl: -------------------------------------------------------------------------------- 1 | 2 | ansi 3 | 4 | 5 | "" 6 | 7 | 8 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/internal/assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Define a custom assert() in order to reduce the chances of deadlock during 3 | * assertion failure. 4 | */ 5 | #ifndef assert 6 | #define assert(e) do { \ 7 | if (unlikely(config_debug && !(e))) { \ 8 | malloc_printf( \ 9 | ": %s:%d: Failed assertion: \"%s\"\n", \ 10 | __FILE__, __LINE__, #e); \ 11 | abort(); \ 12 | } \ 13 | } while (0) 14 | #endif 15 | 16 | #ifndef not_reached 17 | #define not_reached() do { \ 18 | if (config_debug) { \ 19 | malloc_printf( \ 20 | ": %s:%d: Unreachable code reached\n", \ 21 | __FILE__, __LINE__); \ 22 | abort(); \ 23 | } \ 24 | unreachable(); \ 25 | } while (0) 26 | #endif 27 | 28 | #ifndef not_implemented 29 | #define not_implemented() do { \ 30 | if (config_debug) { \ 31 | malloc_printf(": %s:%d: Not implemented\n", \ 32 | __FILE__, __LINE__); \ 33 | abort(); \ 34 | } \ 35 | } while (0) 36 | #endif 37 | 38 | #ifndef assert_not_implemented 39 | #define assert_not_implemented(e) do { \ 40 | if (unlikely(config_debug && !(e))) \ 41 | not_implemented(); \ 42 | } while (0) 43 | #endif 44 | 45 | 46 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/internal/base.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | #endif /* JEMALLOC_H_TYPES */ 5 | /******************************************************************************/ 6 | #ifdef JEMALLOC_H_STRUCTS 7 | 8 | #endif /* JEMALLOC_H_STRUCTS */ 9 | /******************************************************************************/ 10 | #ifdef JEMALLOC_H_EXTERNS 11 | 12 | void *base_alloc(tsdn_t *tsdn, size_t size); 13 | void base_stats_get(tsdn_t *tsdn, size_t *allocated, size_t *resident, 14 | size_t *mapped); 15 | bool base_boot(void); 16 | void base_prefork(tsdn_t *tsdn); 17 | void base_postfork_parent(tsdn_t *tsdn); 18 | void base_postfork_child(tsdn_t *tsdn); 19 | 20 | #endif /* JEMALLOC_H_EXTERNS */ 21 | /******************************************************************************/ 22 | #ifdef JEMALLOC_H_INLINES 23 | 24 | #endif /* JEMALLOC_H_INLINES */ 25 | /******************************************************************************/ 26 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/internal/chunk_dss.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | typedef enum { 5 | dss_prec_disabled = 0, 6 | dss_prec_primary = 1, 7 | dss_prec_secondary = 2, 8 | 9 | dss_prec_limit = 3 10 | } dss_prec_t; 11 | #define DSS_PREC_DEFAULT dss_prec_secondary 12 | #define DSS_DEFAULT "secondary" 13 | 14 | #endif /* JEMALLOC_H_TYPES */ 15 | /******************************************************************************/ 16 | #ifdef JEMALLOC_H_STRUCTS 17 | 18 | extern const char *dss_prec_names[]; 19 | 20 | #endif /* JEMALLOC_H_STRUCTS */ 21 | /******************************************************************************/ 22 | #ifdef JEMALLOC_H_EXTERNS 23 | 24 | dss_prec_t chunk_dss_prec_get(tsdn_t *tsdn); 25 | bool chunk_dss_prec_set(tsdn_t *tsdn, dss_prec_t dss_prec); 26 | void *chunk_alloc_dss(tsdn_t *tsdn, arena_t *arena, void *new_addr, 27 | size_t size, size_t alignment, bool *zero, bool *commit); 28 | bool chunk_in_dss(tsdn_t *tsdn, void *chunk); 29 | bool chunk_dss_boot(void); 30 | void chunk_dss_prefork(tsdn_t *tsdn); 31 | void chunk_dss_postfork_parent(tsdn_t *tsdn); 32 | void chunk_dss_postfork_child(tsdn_t *tsdn); 33 | 34 | #endif /* JEMALLOC_H_EXTERNS */ 35 | /******************************************************************************/ 36 | #ifdef JEMALLOC_H_INLINES 37 | 38 | #endif /* JEMALLOC_H_INLINES */ 39 | /******************************************************************************/ 40 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/internal/chunk_mmap.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | #endif /* JEMALLOC_H_TYPES */ 5 | /******************************************************************************/ 6 | #ifdef JEMALLOC_H_STRUCTS 7 | 8 | #endif /* JEMALLOC_H_STRUCTS */ 9 | /******************************************************************************/ 10 | #ifdef JEMALLOC_H_EXTERNS 11 | 12 | void *chunk_alloc_mmap(void *new_addr, size_t size, size_t alignment, 13 | bool *zero, bool *commit); 14 | bool chunk_dalloc_mmap(void *chunk, size_t size); 15 | 16 | #endif /* JEMALLOC_H_EXTERNS */ 17 | /******************************************************************************/ 18 | #ifdef JEMALLOC_H_INLINES 19 | 20 | #endif /* JEMALLOC_H_INLINES */ 21 | /******************************************************************************/ 22 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/internal/huge.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | #endif /* JEMALLOC_H_TYPES */ 5 | /******************************************************************************/ 6 | #ifdef JEMALLOC_H_STRUCTS 7 | 8 | #endif /* JEMALLOC_H_STRUCTS */ 9 | /******************************************************************************/ 10 | #ifdef JEMALLOC_H_EXTERNS 11 | 12 | void *huge_malloc(tsdn_t *tsdn, arena_t *arena, size_t usize, bool zero); 13 | void *huge_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize, 14 | size_t alignment, bool zero); 15 | bool huge_ralloc_no_move(tsdn_t *tsdn, void *ptr, size_t oldsize, 16 | size_t usize_min, size_t usize_max, bool zero); 17 | void *huge_ralloc(tsd_t *tsd, arena_t *arena, void *ptr, size_t oldsize, 18 | size_t usize, size_t alignment, bool zero, tcache_t *tcache); 19 | #ifdef JEMALLOC_JET 20 | typedef void (huge_dalloc_junk_t)(tsdn_t *, void *, size_t); 21 | extern huge_dalloc_junk_t *huge_dalloc_junk; 22 | #endif 23 | void huge_dalloc(tsdn_t *tsdn, void *ptr); 24 | arena_t *huge_aalloc(const void *ptr); 25 | size_t huge_salloc(tsdn_t *tsdn, const void *ptr); 26 | prof_tctx_t *huge_prof_tctx_get(tsdn_t *tsdn, const void *ptr); 27 | void huge_prof_tctx_set(tsdn_t *tsdn, const void *ptr, prof_tctx_t *tctx); 28 | void huge_prof_tctx_reset(tsdn_t *tsdn, const void *ptr); 29 | 30 | #endif /* JEMALLOC_H_EXTERNS */ 31 | /******************************************************************************/ 32 | #ifdef JEMALLOC_H_INLINES 33 | 34 | #endif /* JEMALLOC_H_INLINES */ 35 | /******************************************************************************/ 36 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/internal/jemalloc_internal_decls.h: -------------------------------------------------------------------------------- 1 | #ifndef JEMALLOC_INTERNAL_DECLS_H 2 | #define JEMALLOC_INTERNAL_DECLS_H 3 | 4 | #include 5 | #ifdef _WIN32 6 | # include 7 | # include "msvc_compat/windows_extra.h" 8 | 9 | #else 10 | # include 11 | # include 12 | # if !defined(__pnacl__) && !defined(__native_client__) 13 | # include 14 | # if !defined(SYS_write) && defined(__NR_write) 15 | # define SYS_write __NR_write 16 | # endif 17 | # include 18 | # endif 19 | # include 20 | # include 21 | # include 22 | #endif 23 | #include 24 | 25 | #include 26 | #ifndef SIZE_T_MAX 27 | # define SIZE_T_MAX SIZE_MAX 28 | #endif 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #ifndef offsetof 36 | # define offsetof(type, member) ((size_t)&(((type *)NULL)->member)) 37 | #endif 38 | #include 39 | #include 40 | #include 41 | #ifdef _MSC_VER 42 | # include 43 | typedef intptr_t ssize_t; 44 | # define PATH_MAX 1024 45 | # define STDERR_FILENO 2 46 | # define __func__ __FUNCTION__ 47 | # ifdef JEMALLOC_HAS_RESTRICT 48 | # define restrict __restrict 49 | # endif 50 | /* Disable warnings about deprecated system functions. */ 51 | # pragma warning(disable: 4996) 52 | #if _MSC_VER < 1800 53 | static int 54 | isblank(int c) 55 | { 56 | 57 | return (c == '\t' || c == ' '); 58 | } 59 | #endif 60 | #else 61 | # include 62 | #endif 63 | #include 64 | 65 | #endif /* JEMALLOC_INTERNAL_H */ 66 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/internal/pages.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | #endif /* JEMALLOC_H_TYPES */ 5 | /******************************************************************************/ 6 | #ifdef JEMALLOC_H_STRUCTS 7 | 8 | #endif /* JEMALLOC_H_STRUCTS */ 9 | /******************************************************************************/ 10 | #ifdef JEMALLOC_H_EXTERNS 11 | 12 | void *pages_map(void *addr, size_t size, bool *commit); 13 | void pages_unmap(void *addr, size_t size); 14 | void *pages_trim(void *addr, size_t alloc_size, size_t leadsize, 15 | size_t size, bool *commit); 16 | bool pages_commit(void *addr, size_t size); 17 | bool pages_decommit(void *addr, size_t size); 18 | bool pages_purge(void *addr, size_t size); 19 | void pages_boot(void); 20 | 21 | #endif /* JEMALLOC_H_EXTERNS */ 22 | /******************************************************************************/ 23 | #ifdef JEMALLOC_H_INLINES 24 | 25 | #endif /* JEMALLOC_H_INLINES */ 26 | /******************************************************************************/ 27 | 28 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/internal/private_namespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for symbol in `cat $1` ; do 4 | echo "#define ${symbol} JEMALLOC_N(${symbol})" 5 | done 6 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/internal/private_unnamespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for symbol in `cat $1` ; do 4 | echo "#undef ${symbol}" 5 | done 6 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/internal/public_namespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for nm in `cat $1` ; do 4 | n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` 5 | echo "#define je_${n} JEMALLOC_N(${n})" 6 | done 7 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/internal/public_unnamespace.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for nm in `cat $1` ; do 4 | n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'` 5 | echo "#undef je_${n}" 6 | done 7 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/internal/quarantine.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | #ifdef JEMALLOC_H_TYPES 3 | 4 | typedef struct quarantine_obj_s quarantine_obj_t; 5 | typedef struct quarantine_s quarantine_t; 6 | 7 | /* Default per thread quarantine size if valgrind is enabled. */ 8 | #define JEMALLOC_VALGRIND_QUARANTINE_DEFAULT (ZU(1) << 24) 9 | 10 | #endif /* JEMALLOC_H_TYPES */ 11 | /******************************************************************************/ 12 | #ifdef JEMALLOC_H_STRUCTS 13 | 14 | struct quarantine_obj_s { 15 | void *ptr; 16 | size_t usize; 17 | }; 18 | 19 | struct quarantine_s { 20 | size_t curbytes; 21 | size_t curobjs; 22 | size_t first; 23 | #define LG_MAXOBJS_INIT 10 24 | size_t lg_maxobjs; 25 | quarantine_obj_t objs[1]; /* Dynamically sized ring buffer. */ 26 | }; 27 | 28 | #endif /* JEMALLOC_H_STRUCTS */ 29 | /******************************************************************************/ 30 | #ifdef JEMALLOC_H_EXTERNS 31 | 32 | void quarantine_alloc_hook_work(tsd_t *tsd); 33 | void quarantine(tsd_t *tsd, void *ptr); 34 | void quarantine_cleanup(tsd_t *tsd); 35 | 36 | #endif /* JEMALLOC_H_EXTERNS */ 37 | /******************************************************************************/ 38 | #ifdef JEMALLOC_H_INLINES 39 | 40 | #ifndef JEMALLOC_ENABLE_INLINE 41 | void quarantine_alloc_hook(void); 42 | #endif 43 | 44 | #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_QUARANTINE_C_)) 45 | JEMALLOC_ALWAYS_INLINE void 46 | quarantine_alloc_hook(void) 47 | { 48 | tsd_t *tsd; 49 | 50 | assert(config_fill && opt_quarantine); 51 | 52 | tsd = tsd_fetch(); 53 | if (tsd_quarantine_get(tsd) == NULL) 54 | quarantine_alloc_hook_work(tsd); 55 | } 56 | #endif 57 | 58 | #endif /* JEMALLOC_H_INLINES */ 59 | /******************************************************************************/ 60 | 61 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/jemalloc/jemalloc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | objroot=$1 4 | 5 | cat < 5 | 6 | /* MSVC doesn't define _Bool or bool in C, but does have BOOL */ 7 | /* Note this doesn't pass autoconf's test because (bool) 0.5 != true */ 8 | /* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as 9 | * a built-in type. */ 10 | #ifndef __clang__ 11 | typedef BOOL _Bool; 12 | #endif 13 | 14 | #define bool _Bool 15 | #define true 1 16 | #define false 0 17 | 18 | #define __bool_true_false_are_defined 1 19 | 20 | #endif /* stdbool_h */ 21 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/msvc_compat/strings.h: -------------------------------------------------------------------------------- 1 | #ifndef strings_h 2 | #define strings_h 3 | 4 | /* MSVC doesn't define ffs/ffsl. This dummy strings.h header is provided 5 | * for both */ 6 | #ifdef _MSC_VER 7 | # include 8 | # pragma intrinsic(_BitScanForward) 9 | static __forceinline int ffsl(long x) 10 | { 11 | unsigned long i; 12 | 13 | if (_BitScanForward(&i, x)) 14 | return (i + 1); 15 | return (0); 16 | } 17 | 18 | static __forceinline int ffs(int x) 19 | { 20 | 21 | return (ffsl(x)); 22 | } 23 | 24 | # ifdef _M_X64 25 | # pragma intrinsic(_BitScanForward64) 26 | # endif 27 | 28 | static __forceinline int ffsll(unsigned __int64 x) 29 | { 30 | unsigned long i; 31 | #ifdef _M_X64 32 | if (_BitScanForward64(&i, x)) 33 | return (i + 1); 34 | return (0); 35 | #else 36 | // Fallback for 32-bit build where 64-bit version not available 37 | // assuming little endian 38 | union { 39 | unsigned __int64 ll; 40 | unsigned long l[2]; 41 | } s; 42 | 43 | s.ll = x; 44 | 45 | if (_BitScanForward(&i, s.l[0])) 46 | return (i + 1); 47 | else if(_BitScanForward(&i, s.l[1])) 48 | return (i + 33); 49 | return (0); 50 | #endif 51 | } 52 | 53 | #else 54 | # define ffsll(x) __builtin_ffsll(x) 55 | # define ffsl(x) __builtin_ffsl(x) 56 | # define ffs(x) __builtin_ffs(x) 57 | #endif 58 | 59 | #endif /* strings_h */ 60 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/include/msvc_compat/windows_extra.h: -------------------------------------------------------------------------------- 1 | #ifndef MSVC_COMPAT_WINDOWS_EXTRA_H 2 | #define MSVC_COMPAT_WINDOWS_EXTRA_H 3 | 4 | #include 5 | 6 | #endif /* MSVC_COMPAT_WINDOWS_EXTRA_H */ 7 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/jemalloc.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | install_suffix=@install_suffix@ 6 | 7 | Name: jemalloc 8 | Description: A general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support. 9 | URL: http://www.canonware.com/jemalloc 10 | Version: @jemalloc_version@ 11 | Cflags: -I${includedir} 12 | Libs: -L${libdir} -ljemalloc${install_suffix} 13 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/msvc/projects/vc2015/test_threads/test_threads.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int test_threads(); 4 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/msvc/projects/vc2015/test_threads/test_threads.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | 22 | 23 | Header Files 24 | 25 | 26 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/msvc/projects/vc2015/test_threads/test_threads_main.cpp: -------------------------------------------------------------------------------- 1 | #include "test_threads.h" 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std::chrono_literals; 7 | 8 | int main(int argc, char** argv) 9 | { 10 | int rc = test_threads(); 11 | return rc; 12 | } 13 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/src/atomic.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_ATOMIC_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/src/extent.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_EXTENT_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | 4 | /******************************************************************************/ 5 | 6 | JEMALLOC_INLINE_C size_t 7 | extent_quantize(size_t size) 8 | { 9 | 10 | /* 11 | * Round down to the nearest chunk size that can actually be requested 12 | * during normal huge allocation. 13 | */ 14 | return (index2size(size2index(size + 1) - 1)); 15 | } 16 | 17 | JEMALLOC_INLINE_C int 18 | extent_szad_comp(const extent_node_t *a, const extent_node_t *b) 19 | { 20 | int ret; 21 | size_t a_qsize = extent_quantize(extent_node_size_get(a)); 22 | size_t b_qsize = extent_quantize(extent_node_size_get(b)); 23 | 24 | /* 25 | * Compare based on quantized size rather than size, in order to sort 26 | * equally useful extents only by address. 27 | */ 28 | ret = (a_qsize > b_qsize) - (a_qsize < b_qsize); 29 | if (ret == 0) { 30 | uintptr_t a_addr = (uintptr_t)extent_node_addr_get(a); 31 | uintptr_t b_addr = (uintptr_t)extent_node_addr_get(b); 32 | 33 | ret = (a_addr > b_addr) - (a_addr < b_addr); 34 | } 35 | 36 | return (ret); 37 | } 38 | 39 | /* Generate red-black tree functions. */ 40 | rb_gen(, extent_tree_szad_, extent_tree_t, extent_node_t, szad_link, 41 | extent_szad_comp) 42 | 43 | JEMALLOC_INLINE_C int 44 | extent_ad_comp(const extent_node_t *a, const extent_node_t *b) 45 | { 46 | uintptr_t a_addr = (uintptr_t)extent_node_addr_get(a); 47 | uintptr_t b_addr = (uintptr_t)extent_node_addr_get(b); 48 | 49 | return ((a_addr > b_addr) - (a_addr < b_addr)); 50 | } 51 | 52 | /* Generate red-black tree functions. */ 53 | rb_gen(, extent_tree_ad_, extent_tree_t, extent_node_t, ad_link, extent_ad_comp) 54 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/src/hash.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_HASH_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/src/mb.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_MB_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/src/prng.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_PRNG_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/src/ticker.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_TICKER_C_ 2 | #include "jemalloc/internal/jemalloc_internal.h" 3 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/src/valgrind.c: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_internal.h" 2 | #ifndef JEMALLOC_VALGRIND 3 | # error "This source file is for Valgrind integration." 4 | #endif 5 | 6 | #include 7 | 8 | void 9 | valgrind_make_mem_noaccess(void *ptr, size_t usize) 10 | { 11 | 12 | VALGRIND_MAKE_MEM_NOACCESS(ptr, usize); 13 | } 14 | 15 | void 16 | valgrind_make_mem_undefined(void *ptr, size_t usize) 17 | { 18 | 19 | VALGRIND_MAKE_MEM_UNDEFINED(ptr, usize); 20 | } 21 | 22 | void 23 | valgrind_make_mem_defined(void *ptr, size_t usize) 24 | { 25 | 26 | VALGRIND_MAKE_MEM_DEFINED(ptr, usize); 27 | } 28 | 29 | void 30 | valgrind_freelike_block(void *ptr, size_t usize) 31 | { 32 | 33 | VALGRIND_FREELIKE_BLOCK(ptr, usize); 34 | } 35 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/include/test/btalloc.h: -------------------------------------------------------------------------------- 1 | /* btalloc() provides a mechanism for allocating via permuted backtraces. */ 2 | void *btalloc(size_t size, unsigned bits); 3 | 4 | #define btalloc_n_proto(n) \ 5 | void *btalloc_##n(size_t size, unsigned bits); 6 | btalloc_n_proto(0) 7 | btalloc_n_proto(1) 8 | 9 | #define btalloc_n_gen(n) \ 10 | void * \ 11 | btalloc_##n(size_t size, unsigned bits) \ 12 | { \ 13 | void *p; \ 14 | \ 15 | if (bits == 0) \ 16 | p = mallocx(size, 0); \ 17 | else { \ 18 | switch (bits & 0x1U) { \ 19 | case 0: \ 20 | p = (btalloc_0(size, bits >> 1)); \ 21 | break; \ 22 | case 1: \ 23 | p = (btalloc_1(size, bits >> 1)); \ 24 | break; \ 25 | default: not_reached(); \ 26 | } \ 27 | } \ 28 | /* Intentionally sabotage tail call optimization. */ \ 29 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); \ 30 | return (p); \ 31 | } 32 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/include/test/jemalloc_test_defs.h.in: -------------------------------------------------------------------------------- 1 | #include "jemalloc/internal/jemalloc_internal_defs.h" 2 | #include "jemalloc/internal/jemalloc_internal_decls.h" 3 | 4 | /* 5 | * For use by SFMT. configure.ac doesn't actually define HAVE_SSE2 because its 6 | * dependencies are notoriously unportable in practice. 7 | */ 8 | #undef HAVE_SSE2 9 | #undef HAVE_ALTIVEC 10 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/include/test/mtx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mtx is a slightly simplified version of malloc_mutex. This code duplication 3 | * is unfortunate, but there are allocator bootstrapping considerations that 4 | * would leak into the test infrastructure if malloc_mutex were used directly 5 | * in tests. 6 | */ 7 | 8 | typedef struct { 9 | #ifdef _WIN32 10 | CRITICAL_SECTION lock; 11 | #elif (defined(JEMALLOC_OSSPIN)) 12 | OSSpinLock lock; 13 | #else 14 | pthread_mutex_t lock; 15 | #endif 16 | } mtx_t; 17 | 18 | bool mtx_init(mtx_t *mtx); 19 | void mtx_fini(mtx_t *mtx); 20 | void mtx_lock(mtx_t *mtx); 21 | void mtx_unlock(mtx_t *mtx); 22 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/include/test/thd.h: -------------------------------------------------------------------------------- 1 | /* Abstraction layer for threading in tests. */ 2 | #ifdef _WIN32 3 | typedef HANDLE thd_t; 4 | #else 5 | typedef pthread_t thd_t; 6 | #endif 7 | 8 | void thd_create(thd_t *thd, void *(*proc)(void *), void *arg); 9 | void thd_join(thd_t thd, void **ret); 10 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/include/test/timer.h: -------------------------------------------------------------------------------- 1 | /* Simple timer, for use in benchmark reporting. */ 2 | 3 | typedef struct { 4 | nstime_t t0; 5 | nstime_t t1; 6 | } timedelta_t; 7 | 8 | void timer_start(timedelta_t *timer); 9 | void timer_stop(timedelta_t *timer); 10 | uint64_t timer_usec(const timedelta_t *timer); 11 | void timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen); 12 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/integration/MALLOCX_ARENA.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #define NTHREADS 10 4 | 5 | static bool have_dss = 6 | #ifdef JEMALLOC_DSS 7 | true 8 | #else 9 | false 10 | #endif 11 | ; 12 | 13 | void * 14 | thd_start(void *arg) 15 | { 16 | unsigned thread_ind = (unsigned)(uintptr_t)arg; 17 | unsigned arena_ind; 18 | void *p; 19 | size_t sz; 20 | 21 | sz = sizeof(arena_ind); 22 | assert_d_eq(mallctl("arenas.extend", &arena_ind, &sz, NULL, 0), 0, 23 | "Error in arenas.extend"); 24 | 25 | if (thread_ind % 4 != 3) { 26 | size_t mib[3]; 27 | size_t miblen = sizeof(mib) / sizeof(size_t); 28 | const char *dss_precs[] = {"disabled", "primary", "secondary"}; 29 | unsigned prec_ind = thread_ind % 30 | (sizeof(dss_precs)/sizeof(char*)); 31 | const char *dss = dss_precs[prec_ind]; 32 | int expected_err = (have_dss || prec_ind == 0) ? 0 : EFAULT; 33 | assert_d_eq(mallctlnametomib("arena.0.dss", mib, &miblen), 0, 34 | "Error in mallctlnametomib()"); 35 | mib[1] = arena_ind; 36 | assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, (void *)&dss, 37 | sizeof(const char *)), expected_err, 38 | "Error in mallctlbymib()"); 39 | } 40 | 41 | p = mallocx(1, MALLOCX_ARENA(arena_ind)); 42 | assert_ptr_not_null(p, "Unexpected mallocx() error"); 43 | dallocx(p, 0); 44 | 45 | return (NULL); 46 | } 47 | 48 | TEST_BEGIN(test_MALLOCX_ARENA) 49 | { 50 | thd_t thds[NTHREADS]; 51 | unsigned i; 52 | 53 | for (i = 0; i < NTHREADS; i++) { 54 | thd_create(&thds[i], thd_start, 55 | (void *)(uintptr_t)i); 56 | } 57 | 58 | for (i = 0; i < NTHREADS; i++) 59 | thd_join(thds[i], NULL); 60 | } 61 | TEST_END 62 | 63 | int 64 | main(void) 65 | { 66 | 67 | return (test( 68 | test_MALLOCX_ARENA)); 69 | } 70 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/integration/overflow.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_overflow) 4 | { 5 | unsigned nhchunks; 6 | size_t mib[4]; 7 | size_t sz, miblen, max_size_class; 8 | void *p; 9 | 10 | sz = sizeof(unsigned); 11 | assert_d_eq(mallctl("arenas.nhchunks", &nhchunks, &sz, NULL, 0), 0, 12 | "Unexpected mallctl() error"); 13 | 14 | miblen = sizeof(mib) / sizeof(size_t); 15 | assert_d_eq(mallctlnametomib("arenas.hchunk.0.size", mib, &miblen), 0, 16 | "Unexpected mallctlnametomib() error"); 17 | mib[2] = nhchunks - 1; 18 | 19 | sz = sizeof(size_t); 20 | assert_d_eq(mallctlbymib(mib, miblen, &max_size_class, &sz, NULL, 0), 0, 21 | "Unexpected mallctlbymib() error"); 22 | 23 | assert_ptr_null(malloc(max_size_class + 1), 24 | "Expected OOM due to over-sized allocation request"); 25 | assert_ptr_null(malloc(SIZE_T_MAX), 26 | "Expected OOM due to over-sized allocation request"); 27 | 28 | assert_ptr_null(calloc(1, max_size_class + 1), 29 | "Expected OOM due to over-sized allocation request"); 30 | assert_ptr_null(calloc(1, SIZE_T_MAX), 31 | "Expected OOM due to over-sized allocation request"); 32 | 33 | p = malloc(1); 34 | assert_ptr_not_null(p, "Unexpected malloc() OOM"); 35 | assert_ptr_null(realloc(p, max_size_class + 1), 36 | "Expected OOM due to over-sized allocation request"); 37 | assert_ptr_null(realloc(p, SIZE_T_MAX), 38 | "Expected OOM due to over-sized allocation request"); 39 | free(p); 40 | } 41 | TEST_END 42 | 43 | int 44 | main(void) 45 | { 46 | 47 | return (test( 48 | test_overflow)); 49 | } 50 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/integration/sdallocx.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #define MAXALIGN (((size_t)1) << 25) 4 | #define NITER 4 5 | 6 | TEST_BEGIN(test_basic) 7 | { 8 | void *ptr = mallocx(64, 0); 9 | sdallocx(ptr, 64, 0); 10 | } 11 | TEST_END 12 | 13 | TEST_BEGIN(test_alignment_and_size) 14 | { 15 | size_t nsz, sz, alignment, total; 16 | unsigned i; 17 | void *ps[NITER]; 18 | 19 | for (i = 0; i < NITER; i++) 20 | ps[i] = NULL; 21 | 22 | for (alignment = 8; 23 | alignment <= MAXALIGN; 24 | alignment <<= 1) { 25 | total = 0; 26 | for (sz = 1; 27 | sz < 3 * alignment && sz < (1U << 31); 28 | sz += (alignment >> (LG_SIZEOF_PTR-1)) - 1) { 29 | for (i = 0; i < NITER; i++) { 30 | nsz = nallocx(sz, MALLOCX_ALIGN(alignment) | 31 | MALLOCX_ZERO); 32 | ps[i] = mallocx(sz, MALLOCX_ALIGN(alignment) | 33 | MALLOCX_ZERO); 34 | total += nsz; 35 | if (total >= (MAXALIGN << 1)) 36 | break; 37 | } 38 | for (i = 0; i < NITER; i++) { 39 | if (ps[i] != NULL) { 40 | sdallocx(ps[i], sz, 41 | MALLOCX_ALIGN(alignment)); 42 | ps[i] = NULL; 43 | } 44 | } 45 | } 46 | } 47 | } 48 | TEST_END 49 | 50 | int 51 | main(void) 52 | { 53 | 54 | return (test( 55 | test_basic, 56 | test_alignment_and_size)); 57 | } 58 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/integration/thread_arena.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #define NTHREADS 10 4 | 5 | void * 6 | thd_start(void *arg) 7 | { 8 | unsigned main_arena_ind = *(unsigned *)arg; 9 | void *p; 10 | unsigned arena_ind; 11 | size_t size; 12 | int err; 13 | 14 | p = malloc(1); 15 | assert_ptr_not_null(p, "Error in malloc()"); 16 | free(p); 17 | 18 | size = sizeof(arena_ind); 19 | if ((err = mallctl("thread.arena", &arena_ind, &size, &main_arena_ind, 20 | sizeof(main_arena_ind)))) { 21 | char buf[BUFERROR_BUF]; 22 | 23 | buferror(err, buf, sizeof(buf)); 24 | test_fail("Error in mallctl(): %s", buf); 25 | } 26 | 27 | size = sizeof(arena_ind); 28 | if ((err = mallctl("thread.arena", &arena_ind, &size, NULL, 0))) { 29 | char buf[BUFERROR_BUF]; 30 | 31 | buferror(err, buf, sizeof(buf)); 32 | test_fail("Error in mallctl(): %s", buf); 33 | } 34 | assert_u_eq(arena_ind, main_arena_ind, 35 | "Arena index should be same as for main thread"); 36 | 37 | return (NULL); 38 | } 39 | 40 | TEST_BEGIN(test_thread_arena) 41 | { 42 | void *p; 43 | unsigned arena_ind; 44 | size_t size; 45 | int err; 46 | thd_t thds[NTHREADS]; 47 | unsigned i; 48 | 49 | p = malloc(1); 50 | assert_ptr_not_null(p, "Error in malloc()"); 51 | 52 | size = sizeof(arena_ind); 53 | if ((err = mallctl("thread.arena", &arena_ind, &size, NULL, 0))) { 54 | char buf[BUFERROR_BUF]; 55 | 56 | buferror(err, buf, sizeof(buf)); 57 | test_fail("Error in mallctl(): %s", buf); 58 | } 59 | 60 | for (i = 0; i < NTHREADS; i++) { 61 | thd_create(&thds[i], thd_start, 62 | (void *)&arena_ind); 63 | } 64 | 65 | for (i = 0; i < NTHREADS; i++) { 66 | intptr_t join_ret; 67 | thd_join(thds[i], (void *)&join_ret); 68 | assert_zd_eq(join_ret, 0, "Unexpected thread join error"); 69 | } 70 | } 71 | TEST_END 72 | 73 | int 74 | main(void) 75 | { 76 | 77 | return (test( 78 | test_thread_arena)); 79 | } 80 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/src/btalloc.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | void * 4 | btalloc(size_t size, unsigned bits) 5 | { 6 | 7 | return (btalloc_0(size, bits)); 8 | } 9 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/src/btalloc_0.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | btalloc_n_gen(0) 4 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/src/btalloc_1.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | btalloc_n_gen(1) 4 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/src/math.c: -------------------------------------------------------------------------------- 1 | #define MATH_C_ 2 | #include "test/jemalloc_test.h" 3 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/src/mq.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | /* 4 | * Sleep for approximately ns nanoseconds. No lower *nor* upper bound on sleep 5 | * time is guaranteed. 6 | */ 7 | void 8 | mq_nanosleep(unsigned ns) 9 | { 10 | 11 | assert(ns <= 1000*1000*1000); 12 | 13 | #ifdef _WIN32 14 | Sleep(ns / 1000); 15 | #else 16 | { 17 | struct timespec timeout; 18 | 19 | if (ns < 1000*1000*1000) { 20 | timeout.tv_sec = 0; 21 | timeout.tv_nsec = ns; 22 | } else { 23 | timeout.tv_sec = 1; 24 | timeout.tv_nsec = 0; 25 | } 26 | nanosleep(&timeout, NULL); 27 | } 28 | #endif 29 | } 30 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/src/mtx.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifndef _CRT_SPINCOUNT 4 | #define _CRT_SPINCOUNT 4000 5 | #endif 6 | 7 | bool 8 | mtx_init(mtx_t *mtx) 9 | { 10 | 11 | #ifdef _WIN32 12 | if (!InitializeCriticalSectionAndSpinCount(&mtx->lock, _CRT_SPINCOUNT)) 13 | return (true); 14 | #elif (defined(JEMALLOC_OSSPIN)) 15 | mtx->lock = 0; 16 | #else 17 | pthread_mutexattr_t attr; 18 | 19 | if (pthread_mutexattr_init(&attr) != 0) 20 | return (true); 21 | pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_DEFAULT); 22 | if (pthread_mutex_init(&mtx->lock, &attr) != 0) { 23 | pthread_mutexattr_destroy(&attr); 24 | return (true); 25 | } 26 | pthread_mutexattr_destroy(&attr); 27 | #endif 28 | return (false); 29 | } 30 | 31 | void 32 | mtx_fini(mtx_t *mtx) 33 | { 34 | 35 | #ifdef _WIN32 36 | #elif (defined(JEMALLOC_OSSPIN)) 37 | #else 38 | pthread_mutex_destroy(&mtx->lock); 39 | #endif 40 | } 41 | 42 | void 43 | mtx_lock(mtx_t *mtx) 44 | { 45 | 46 | #ifdef _WIN32 47 | EnterCriticalSection(&mtx->lock); 48 | #elif (defined(JEMALLOC_OSSPIN)) 49 | OSSpinLockLock(&mtx->lock); 50 | #else 51 | pthread_mutex_lock(&mtx->lock); 52 | #endif 53 | } 54 | 55 | void 56 | mtx_unlock(mtx_t *mtx) 57 | { 58 | 59 | #ifdef _WIN32 60 | LeaveCriticalSection(&mtx->lock); 61 | #elif (defined(JEMALLOC_OSSPIN)) 62 | OSSpinLockUnlock(&mtx->lock); 63 | #else 64 | pthread_mutex_unlock(&mtx->lock); 65 | #endif 66 | } 67 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/src/thd.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifdef _WIN32 4 | void 5 | thd_create(thd_t *thd, void *(*proc)(void *), void *arg) 6 | { 7 | LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)proc; 8 | *thd = CreateThread(NULL, 0, routine, arg, 0, NULL); 9 | if (*thd == NULL) 10 | test_fail("Error in CreateThread()\n"); 11 | } 12 | 13 | void 14 | thd_join(thd_t thd, void **ret) 15 | { 16 | 17 | if (WaitForSingleObject(thd, INFINITE) == WAIT_OBJECT_0 && ret) { 18 | DWORD exit_code; 19 | GetExitCodeThread(thd, (LPDWORD) &exit_code); 20 | *ret = (void *)(uintptr_t)exit_code; 21 | } 22 | } 23 | 24 | #else 25 | void 26 | thd_create(thd_t *thd, void *(*proc)(void *), void *arg) 27 | { 28 | 29 | if (pthread_create(thd, NULL, proc, arg) != 0) 30 | test_fail("Error in pthread_create()\n"); 31 | } 32 | 33 | void 34 | thd_join(thd_t thd, void **ret) 35 | { 36 | 37 | pthread_join(thd, ret); 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/src/timer.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | void 4 | timer_start(timedelta_t *timer) 5 | { 6 | 7 | nstime_init(&timer->t0, 0); 8 | nstime_update(&timer->t0); 9 | } 10 | 11 | void 12 | timer_stop(timedelta_t *timer) 13 | { 14 | 15 | nstime_copy(&timer->t1, &timer->t0); 16 | nstime_update(&timer->t1); 17 | } 18 | 19 | uint64_t 20 | timer_usec(const timedelta_t *timer) 21 | { 22 | nstime_t delta; 23 | 24 | nstime_copy(&delta, &timer->t1); 25 | nstime_subtract(&delta, &timer->t0); 26 | return (nstime_ns(&delta) / 1000); 27 | } 28 | 29 | void 30 | timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen) 31 | { 32 | uint64_t t0 = timer_usec(a); 33 | uint64_t t1 = timer_usec(b); 34 | uint64_t mult; 35 | size_t i = 0; 36 | size_t j, n; 37 | 38 | /* Whole. */ 39 | n = malloc_snprintf(&buf[i], buflen-i, "%"FMTu64, t0 / t1); 40 | i += n; 41 | if (i >= buflen) 42 | return; 43 | mult = 1; 44 | for (j = 0; j < n; j++) 45 | mult *= 10; 46 | 47 | /* Decimal. */ 48 | n = malloc_snprintf(&buf[i], buflen-i, "."); 49 | i += n; 50 | 51 | /* Fraction. */ 52 | while (i < buflen-1) { 53 | uint64_t round = (i+1 == buflen-1 && ((t0 * mult * 10 / t1) % 10 54 | >= 5)) ? 1 : 0; 55 | n = malloc_snprintf(&buf[i], buflen-i, 56 | "%"FMTu64, (t0 * mult / t1) % 10 + round); 57 | i += n; 58 | mult *= 10; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/test.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case @abi@ in 4 | macho) 5 | export DYLD_FALLBACK_LIBRARY_PATH="@objroot@lib" 6 | ;; 7 | pecoff) 8 | export PATH="${PATH}:@objroot@lib" 9 | ;; 10 | *) 11 | ;; 12 | esac 13 | 14 | # Corresponds to test_status_t. 15 | pass_code=0 16 | skip_code=1 17 | fail_code=2 18 | 19 | pass_count=0 20 | skip_count=0 21 | fail_count=0 22 | for t in $@; do 23 | if [ $pass_count -ne 0 -o $skip_count -ne 0 -o $fail_count != 0 ] ; then 24 | echo 25 | fi 26 | echo "=== ${t} ===" 27 | ${t}@exe@ @abs_srcroot@ @abs_objroot@ 28 | result_code=$? 29 | case ${result_code} in 30 | ${pass_code}) 31 | pass_count=$((pass_count+1)) 32 | ;; 33 | ${skip_code}) 34 | skip_count=$((skip_count+1)) 35 | ;; 36 | ${fail_code}) 37 | fail_count=$((fail_count+1)) 38 | ;; 39 | *) 40 | echo "Test harness error" 1>&2 41 | exit 1 42 | esac 43 | done 44 | 45 | total_count=`expr ${pass_count} + ${skip_count} + ${fail_count}` 46 | echo 47 | echo "Test suite summary: pass: ${pass_count}/${total_count}, skip: ${skip_count}/${total_count}, fail: ${fail_count}/${total_count}" 48 | 49 | if [ ${fail_count} -eq 0 ] ; then 50 | exit 0 51 | else 52 | exit 1 53 | fi 54 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/unit/a0.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_a0) 4 | { 5 | void *p; 6 | 7 | p = a0malloc(1); 8 | assert_ptr_not_null(p, "Unexpected a0malloc() error"); 9 | a0dalloc(p); 10 | } 11 | TEST_END 12 | 13 | int 14 | main(void) 15 | { 16 | 17 | return (test_no_malloc_init( 18 | test_a0)); 19 | } 20 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/unit/fork.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifndef _WIN32 4 | #include 5 | #endif 6 | 7 | TEST_BEGIN(test_fork) 8 | { 9 | #ifndef _WIN32 10 | void *p; 11 | pid_t pid; 12 | 13 | p = malloc(1); 14 | assert_ptr_not_null(p, "Unexpected malloc() failure"); 15 | 16 | pid = fork(); 17 | 18 | free(p); 19 | 20 | p = malloc(64); 21 | assert_ptr_not_null(p, "Unexpected malloc() failure"); 22 | free(p); 23 | 24 | if (pid == -1) { 25 | /* Error. */ 26 | test_fail("Unexpected fork() failure"); 27 | } else if (pid == 0) { 28 | /* Child. */ 29 | exit(0); 30 | } else { 31 | int status; 32 | 33 | /* Parent. */ 34 | while (true) { 35 | if (waitpid(pid, &status, 0) == -1) 36 | test_fail("Unexpected waitpid() failure"); 37 | if (WIFSIGNALED(status)) { 38 | test_fail("Unexpected child termination due to " 39 | "signal %d", WTERMSIG(status)); 40 | break; 41 | } 42 | if (WIFEXITED(status)) { 43 | if (WEXITSTATUS(status) != 0) { 44 | test_fail( 45 | "Unexpected child exit value %d", 46 | WEXITSTATUS(status)); 47 | } 48 | break; 49 | } 50 | } 51 | } 52 | #else 53 | test_skip("fork(2) is irrelevant to Windows"); 54 | #endif 55 | } 56 | TEST_END 57 | 58 | int 59 | main(void) 60 | { 61 | 62 | return (test( 63 | test_fork)); 64 | } 65 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/unit/junk_alloc.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_TEST_JUNK_OPT "junk:alloc" 2 | #include "junk.c" 3 | #undef JEMALLOC_TEST_JUNK_OPT 4 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/unit/junk_free.c: -------------------------------------------------------------------------------- 1 | #define JEMALLOC_TEST_JUNK_OPT "junk:free" 2 | #include "junk.c" 3 | #undef JEMALLOC_TEST_JUNK_OPT 4 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/unit/lg_chunk.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | /* 4 | * Make sure that opt.lg_chunk clamping is sufficient. In practice, this test 5 | * program will fail a debug assertion during initialization and abort (rather 6 | * than the test soft-failing) if clamping is insufficient. 7 | */ 8 | const char *malloc_conf = "lg_chunk:0"; 9 | 10 | TEST_BEGIN(test_lg_chunk_clamp) 11 | { 12 | void *p; 13 | 14 | p = mallocx(1, 0); 15 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); 16 | dallocx(p, 0); 17 | } 18 | TEST_END 19 | 20 | int 21 | main(void) 22 | { 23 | 24 | return (test( 25 | test_lg_chunk_clamp)); 26 | } 27 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/unit/mtx.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #define NTHREADS 2 4 | #define NINCRS 2000000 5 | 6 | TEST_BEGIN(test_mtx_basic) 7 | { 8 | mtx_t mtx; 9 | 10 | assert_false(mtx_init(&mtx), "Unexpected mtx_init() failure"); 11 | mtx_lock(&mtx); 12 | mtx_unlock(&mtx); 13 | mtx_fini(&mtx); 14 | } 15 | TEST_END 16 | 17 | typedef struct { 18 | mtx_t mtx; 19 | unsigned x; 20 | } thd_start_arg_t; 21 | 22 | static void * 23 | thd_start(void *varg) 24 | { 25 | thd_start_arg_t *arg = (thd_start_arg_t *)varg; 26 | unsigned i; 27 | 28 | for (i = 0; i < NINCRS; i++) { 29 | mtx_lock(&arg->mtx); 30 | arg->x++; 31 | mtx_unlock(&arg->mtx); 32 | } 33 | return (NULL); 34 | } 35 | 36 | TEST_BEGIN(test_mtx_race) 37 | { 38 | thd_start_arg_t arg; 39 | thd_t thds[NTHREADS]; 40 | unsigned i; 41 | 42 | assert_false(mtx_init(&arg.mtx), "Unexpected mtx_init() failure"); 43 | arg.x = 0; 44 | for (i = 0; i < NTHREADS; i++) 45 | thd_create(&thds[i], thd_start, (void *)&arg); 46 | for (i = 0; i < NTHREADS; i++) 47 | thd_join(thds[i], NULL); 48 | assert_u_eq(arg.x, NTHREADS * NINCRS, 49 | "Race-related counter corruption"); 50 | } 51 | TEST_END 52 | 53 | int 54 | main(void) 55 | { 56 | 57 | return (test( 58 | test_mtx_basic, 59 | test_mtx_race)); 60 | } 61 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/unit/prng.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | TEST_BEGIN(test_prng_lg_range) 4 | { 5 | uint64_t sa, sb, ra, rb; 6 | unsigned lg_range; 7 | 8 | sa = 42; 9 | ra = prng_lg_range(&sa, 64); 10 | sa = 42; 11 | rb = prng_lg_range(&sa, 64); 12 | assert_u64_eq(ra, rb, 13 | "Repeated generation should produce repeated results"); 14 | 15 | sb = 42; 16 | rb = prng_lg_range(&sb, 64); 17 | assert_u64_eq(ra, rb, 18 | "Equivalent generation should produce equivalent results"); 19 | 20 | sa = 42; 21 | ra = prng_lg_range(&sa, 64); 22 | rb = prng_lg_range(&sa, 64); 23 | assert_u64_ne(ra, rb, 24 | "Full-width results must not immediately repeat"); 25 | 26 | sa = 42; 27 | ra = prng_lg_range(&sa, 64); 28 | for (lg_range = 63; lg_range > 0; lg_range--) { 29 | sb = 42; 30 | rb = prng_lg_range(&sb, lg_range); 31 | assert_u64_eq((rb & (UINT64_C(0xffffffffffffffff) << lg_range)), 32 | 0, "High order bits should be 0, lg_range=%u", lg_range); 33 | assert_u64_eq(rb, (ra >> (64 - lg_range)), 34 | "Expected high order bits of full-width result, " 35 | "lg_range=%u", lg_range); 36 | } 37 | } 38 | TEST_END 39 | 40 | TEST_BEGIN(test_prng_range) 41 | { 42 | uint64_t range; 43 | #define MAX_RANGE 10000000 44 | #define RANGE_STEP 97 45 | #define NREPS 10 46 | 47 | for (range = 2; range < MAX_RANGE; range += RANGE_STEP) { 48 | uint64_t s; 49 | unsigned rep; 50 | 51 | s = range; 52 | for (rep = 0; rep < NREPS; rep++) { 53 | uint64_t r = prng_range(&s, range); 54 | 55 | assert_u64_lt(r, range, "Out of range"); 56 | } 57 | } 58 | } 59 | TEST_END 60 | 61 | int 62 | main(void) 63 | { 64 | 65 | return (test( 66 | test_prng_lg_range, 67 | test_prng_range)); 68 | } 69 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/unit/prof_idump.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifdef JEMALLOC_PROF 4 | const char *malloc_conf = 5 | "prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0," 6 | "lg_prof_interval:0"; 7 | #endif 8 | 9 | static bool did_prof_dump_open; 10 | 11 | static int 12 | prof_dump_open_intercept(bool propagate_err, const char *filename) 13 | { 14 | int fd; 15 | 16 | did_prof_dump_open = true; 17 | 18 | fd = open("/dev/null", O_WRONLY); 19 | assert_d_ne(fd, -1, "Unexpected open() failure"); 20 | 21 | return (fd); 22 | } 23 | 24 | TEST_BEGIN(test_idump) 25 | { 26 | bool active; 27 | void *p; 28 | 29 | test_skip_if(!config_prof); 30 | 31 | active = true; 32 | assert_d_eq(mallctl("prof.active", NULL, NULL, &active, sizeof(active)), 33 | 0, "Unexpected mallctl failure while activating profiling"); 34 | 35 | prof_dump_open = prof_dump_open_intercept; 36 | 37 | did_prof_dump_open = false; 38 | p = mallocx(1, 0); 39 | assert_ptr_not_null(p, "Unexpected mallocx() failure"); 40 | dallocx(p, 0); 41 | assert_true(did_prof_dump_open, "Expected a profile dump"); 42 | } 43 | TEST_END 44 | 45 | int 46 | main(void) 47 | { 48 | 49 | return (test( 50 | test_idump)); 51 | } 52 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/jemalloc-4.2.0/test/unit/zero.c: -------------------------------------------------------------------------------- 1 | #include "test/jemalloc_test.h" 2 | 3 | #ifdef JEMALLOC_FILL 4 | const char *malloc_conf = 5 | "abort:false,junk:false,zero:true,redzone:false,quarantine:0"; 6 | #endif 7 | 8 | static void 9 | test_zero(size_t sz_min, size_t sz_max) 10 | { 11 | uint8_t *s; 12 | size_t sz_prev, sz, i; 13 | #define MAGIC ((uint8_t)0x61) 14 | 15 | sz_prev = 0; 16 | s = (uint8_t *)mallocx(sz_min, 0); 17 | assert_ptr_not_null((void *)s, "Unexpected mallocx() failure"); 18 | 19 | for (sz = sallocx(s, 0); sz <= sz_max; 20 | sz_prev = sz, sz = sallocx(s, 0)) { 21 | if (sz_prev > 0) { 22 | assert_u_eq(s[0], MAGIC, 23 | "Previously allocated byte %zu/%zu is corrupted", 24 | ZU(0), sz_prev); 25 | assert_u_eq(s[sz_prev-1], MAGIC, 26 | "Previously allocated byte %zu/%zu is corrupted", 27 | sz_prev-1, sz_prev); 28 | } 29 | 30 | for (i = sz_prev; i < sz; i++) { 31 | assert_u_eq(s[i], 0x0, 32 | "Newly allocated byte %zu/%zu isn't zero-filled", 33 | i, sz); 34 | s[i] = MAGIC; 35 | } 36 | 37 | if (xallocx(s, sz+1, 0, 0) == sz) { 38 | s = (uint8_t *)rallocx(s, sz+1, 0); 39 | assert_ptr_not_null((void *)s, 40 | "Unexpected rallocx() failure"); 41 | } 42 | } 43 | 44 | dallocx(s, 0); 45 | #undef MAGIC 46 | } 47 | 48 | TEST_BEGIN(test_zero_small) 49 | { 50 | 51 | test_skip_if(!config_fill); 52 | test_zero(1, SMALL_MAXCLASS-1); 53 | } 54 | TEST_END 55 | 56 | TEST_BEGIN(test_zero_large) 57 | { 58 | 59 | test_skip_if(!config_fill); 60 | test_zero(SMALL_MAXCLASS+1, large_maxclass); 61 | } 62 | TEST_END 63 | 64 | TEST_BEGIN(test_zero_huge) 65 | { 66 | 67 | test_skip_if(!config_fill); 68 | test_zero(large_maxclass+1, chunksize*2); 69 | } 70 | TEST_END 71 | 72 | int 73 | main(void) 74 | { 75 | 76 | return (test( 77 | test_zero_small, 78 | test_zero_large, 79 | test_zero_huge)); 80 | } 81 | -------------------------------------------------------------------------------- /kv-store-test/vire/dep/sds/Makefile.am: -------------------------------------------------------------------------------- 1 | MAINTAINERCLEANFILES = Makefile.in 2 | 3 | AM_CPPFLAGS = 4 | if !OS_SOLARIS 5 | AM_CPPFLAGS += -D_GNU_SOURCE 6 | endif 7 | AM_CPPFLAGS += -I $(top_srcdir)/dep/util 8 | AM_CPPFLAGS += -I $(top_srcdir)/dep/jemalloc-4.2.0/include 9 | AM_CPPFLAGS += -I $(top_srcdir)/dep/dmalloc 10 | 11 | AM_CFLAGS = -Wall -Wshadow 12 | AM_CFLAGS += -Wno-unused-parameter -Wno-unused-value 13 | 14 | noinst_LIBRARIES = libsds.a 15 | 16 | noinst_HEADERS = sds.h sdsalloc.h 17 | 18 | libsds_a_SOURCES = \ 19 | sdsalloc.h \ 20 | sds.c sds.h -------------------------------------------------------------------------------- /kv-store-test/vire/dep/util/Makefile.am: -------------------------------------------------------------------------------- 1 | MAINTAINERCLEANFILES = Makefile.in 2 | 3 | AM_CFLAGS = -Wall -Wshadow 4 | AM_CFLAGS += -Wno-unused-parameter -Wno-unused-value 5 | 6 | noinst_LIBRARIES = libdutil.a 7 | 8 | noinst_HEADERS = dspecialconfig.h dutil.h dlog.h 9 | 10 | libdutil_a_SOURCES = \ 11 | dspecialconfig.h \ 12 | dutil.c dutil.h \ 13 | dlog.c dlog.h -------------------------------------------------------------------------------- /kv-store-test/vire/dep/util/dspecialconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _DSPECIALCONFIG_H_ 2 | #define _DSPECIALCONFIG_H_ 3 | 4 | #ifdef __APPLE__ 5 | #include 6 | #endif 7 | 8 | #ifdef __linux__ 9 | #include 10 | #include 11 | #endif 12 | 13 | #if (__i386 || __amd64 || __powerpc__) && __GNUC__ 14 | #define GNUC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 15 | #if defined(__clang__) 16 | #define HAVE_ATOMIC 17 | #endif 18 | #if (defined(__GLIBC__) && defined(__GLIBC_PREREQ)) 19 | #if (GNUC_VERSION >= 40100 && __GLIBC_PREREQ(2, 6)) 20 | #define HAVE_ATOMIC 21 | #endif 22 | #endif 23 | #endif 24 | 25 | 26 | #if defined(__sun) 27 | #if defined(__GNUC__) 28 | #include 29 | #undef isnan 30 | #define isnan(x) \ 31 | __extension__({ __typeof (x) __x_a = (x); \ 32 | __builtin_expect(__x_a != __x_a, 0); }) 33 | 34 | #undef isfinite 35 | #define isfinite(x) \ 36 | __extension__ ({ __typeof (x) __x_f = (x); \ 37 | __builtin_expect(!isnan(__x_f - __x_f), 1); }) 38 | 39 | #undef isinf 40 | #define isinf(x) \ 41 | __extension__ ({ __typeof (x) __x_i = (x); \ 42 | __builtin_expect(!isnan(__x_i) && !isfinite(__x_i), 0); }) 43 | 44 | #define u_int uint 45 | #define u_int32_t uint32_t 46 | #endif /* __GNUC__ */ 47 | #endif /* __sun */ 48 | 49 | 50 | /* Test for proc filesystem */ 51 | #ifdef __linux__ 52 | #define HAVE_PROC_STAT 1 53 | #define HAVE_PROC_MAPS 1 54 | #define HAVE_PROC_SMAPS 1 55 | #define HAVE_PROC_SOMAXCONN 1 56 | #endif 57 | 58 | /* Test for task_info() */ 59 | #if defined(__APPLE__) 60 | #define HAVE_TASKINFO 1 61 | #endif 62 | 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /kv-store-test/vire/m4/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything 2 | * 3 | 4 | # Except me 5 | !.gitignore 6 | -------------------------------------------------------------------------------- /kv-store-test/vire/pid_file: -------------------------------------------------------------------------------- 1 | 24040 -------------------------------------------------------------------------------- /kv-store-test/vire/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm log 4 | rm /home/fkd/CPTree-202006/mount/pmem0/main_pool 5 | rm /home/fkd/CPTree-202006/mount/pmem0/pool-* 6 | rm /home/fkd/CPTree-202006/mount/pmem1/pool-* 7 | echo $1 threads 8 | src/vire -c conf/vire.conf -p pid_file -v 0 -o log -T $1 -d 9 | -------------------------------------------------------------------------------- /kv-store-test/vire/scripts/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.out 3 | *.log 4 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/atomic_ops/AUTHORS: -------------------------------------------------------------------------------- 1 | Originally written by Hans Boehm, with some platform-dependent code 2 | imported from the Boehm-Demers-Weiser GC, where it was contributed 3 | by many others. 4 | 5 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/atomic_ops/README: -------------------------------------------------------------------------------- 1 | This directory contains a stripped-down (support only gcc) version of libatomic_ops by Hans Boehm. 2 | The official release is available from http://www.hpl.hp.com/research/linux/atomic_ops/. 3 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/atomic_ops/aligned_atomic_load_store.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * Definitions for architectures on which loads and stores of AO_t are 25 | * atomic fo all legal alignments. 26 | */ 27 | 28 | AO_INLINE AO_t 29 | AO_load(const volatile AO_t *addr) 30 | { 31 | assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0); 32 | /* Cast away the volatile for architectures where */ 33 | /* volatile adds barrier semantics. */ 34 | return *(AO_t *)addr; 35 | } 36 | 37 | #define AO_HAVE_load 38 | 39 | AO_INLINE void 40 | AO_store(volatile AO_t *addr, AO_t new_val) 41 | { 42 | assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0); 43 | (*(AO_t *)addr) = new_val; 44 | } 45 | 46 | #define AO_HAVE_store 47 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/atomic_ops/standard_ao_double_t.h: -------------------------------------------------------------------------------- 1 | /* NEC LE-IT: For 64Bit OS we extend the double type to hold two int64's 2 | * 3 | * x86-64: __m128 serves as placeholder which also requires the compiler 4 | * to align it on 16 byte boundary (as required by cmpxchg16. 5 | * Similar things could be done for PowerPC 64bit using a VMX data type... */ 6 | 7 | #if (defined(__x86_64__) && defined(__GNUC__)) || defined(_WIN64) 8 | # include 9 | typedef __m128 double_ptr_storage; 10 | #elif defined(_WIN32) && !defined(__GNUC__) 11 | typedef unsigned __int64 double_ptr_storage; 12 | #else 13 | typedef unsigned long long double_ptr_storage; 14 | #endif 15 | 16 | # define AO_HAVE_DOUBLE_PTR_STORAGE 17 | 18 | typedef union { 19 | double_ptr_storage AO_whole; 20 | struct {AO_t AO_v1; AO_t AO_v2;} AO_parts; 21 | } AO_double_t; 22 | 23 | #define AO_HAVE_double_t 24 | #define AO_val1 AO_parts.AO_v1 25 | #define AO_val2 AO_parts.AO_v2 26 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/atomic_ops/test_and_set_t_is_ao_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * These are common definitions for architectures on which test_and_set 25 | * operates on pointer-sized quantities, the "clear" value contains 26 | * all zeroes, and the "set" value contains only one lowest bit set. 27 | * This can be used if test_and_set is synthesized from compare_and_swap. 28 | */ 29 | typedef enum {AO_TS_clear = 0, AO_TS_set = 1} AO_TS_val; 30 | #define AO_TS_VAL_t AO_TS_val 31 | #define AO_TS_CLEAR AO_TS_clear 32 | #define AO_TS_SET AO_TS_set 33 | 34 | #define AO_TS_t AO_t 35 | 36 | #define AO_AO_TS_T 1 37 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/atomic_ops/test_and_set_t_is_char.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * These are common definitions for architectures on which test_and_set 25 | * operates on byte sized quantities, the "clear" value contains 26 | * all zeroes, and the "set" value contains all ones. 27 | */ 28 | 29 | #define AO_TS_t unsigned char 30 | typedef enum {AO_BYTE_TS_clear = 0, AO_BYTE_TS_set = 0xff} AO_BYTE_TS_val; 31 | #define AO_TS_VAL_t AO_BYTE_TS_val 32 | #define AO_TS_CLEAR AO_BYTE_TS_clear 33 | #define AO_TS_SET AO_BYTE_TS_set 34 | 35 | #define AO_CHAR_TS_T 1 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/build_funcForC.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #gcc -O3 -DNDEBUG -DMUTEX -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -c -o gc/ptst.o gc/ptst.c 4 | #g++ -O3 -DNDEBUG -DMUTEX -m64 -D_REENTRANT -fno-strict-aliasing -I./atomic_ops -DINTEL -Wno-unused-value -Wno-format -fPIC -c -o fptree.o fptree.cpp -m64 -lpthread 5 | g++ -O3 -DHAVE_CONFIG_H -DNDEBUG -DMUTEX -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -I. -I.. -c -o funcForC.o funcForC.c -lpthread -lpmemobj -lpmem 6 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/funcForC.h: -------------------------------------------------------------------------------- 1 | // wrapper 2 | #include 3 | 4 | #ifdef __cplusplus 5 | extern "C"{ 6 | #endif 7 | 8 | void* cptree_init(void); 9 | void cptree_insert(void* p, int64_t key, char* val); 10 | char* cptree_search(void* p, int64_t key); 11 | void* cptree_getListHead(void* p); 12 | void print_btree(void* p); 13 | void initForFpTree(void); 14 | void openPmemobjPool(char *pathname, uint64_t allocate_size); 15 | 16 | #ifdef __cplusplus 17 | }//end extern "C" 18 | #endif -------------------------------------------------------------------------------- /kv-store-test/vire/src/gc/set.h: -------------------------------------------------------------------------------- 1 | #ifndef __SET_H__ 2 | #define __SET_H__ 3 | 4 | /************************************* 5 | * INTERNAL DEFINITIONS 应该是这个 */ 6 | 7 | /* Internal key values with special meanings. */ 8 | #define INVALID_FIELD (0) /* Uninitialised field value. */ 9 | #define SENTINEL_KEYMIN (1UL) /* Key value of first dummy node. */ 10 | #define SENTINEL_KEYMAX (~0UL) /* Key value of last dummy node. */ 11 | #define BLIST_SPLIT_KEY (2UL) 12 | 13 | /* Used internally be set access functions, so that callers can use 14 | * key values 0 and 1, without knowing these have special meanings. */ 15 | #define CALLER_TO_INTERNAL_KEY(_k) ((_k) + 3) 16 | 17 | /* SUPPORT FOR WEAK ORDERING OF MEMORY ACCESSES */ 18 | #ifdef WEAK_MEM_ORDER 19 | 20 | /* Read field @_f into variable @_x. */ 21 | #define READ_FIELD(_x,_f) \ 22 | do { \ 23 | (_x) = (_f); \ 24 | if ( (_x) == INVALID_FIELD ) { RMB(); (_x) = (_f); } \ 25 | assert((_x) != INVALID_FIELD); \ 26 | } while ( 0 ) 27 | 28 | #else 29 | 30 | /* Read field @_f into variable @_x. */ 31 | #define READ_FIELD(_x,_f) ((_x) = (_f)) 32 | 33 | #endif 34 | 35 | /************************************* 36 | * PUBLIC DEFINITIONS */ 37 | 38 | /* Key range accepted by set functions. 39 | * We lose three values (conveniently at top end of key space). 40 | * - Known invalid value to which all fields are initialised. 41 | * - Sentinel key values for up to two dummy nodes. */ 42 | #define KEY_MIN ( 0U) 43 | #define KEY_MAX ((~0U) - 3) 44 | 45 | #endif /* __SET_H__ */ 46 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_aof.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_AOF_H_ 2 | #define _VR_AOF_H_ 3 | 4 | /* AOF states */ 5 | #define AOF_OFF 0 /* AOF is off */ 6 | #define AOF_ON 1 /* AOF is on */ 7 | #define AOF_WAIT_REWRITE 2 /* AOF waits rewrite to start appending */ 8 | 9 | #define AOF_AUTOSYNC_BYTES (1024*1024*32) /* fdatasync every 32MB */ 10 | 11 | /* ---------------------------------------------------------------------------- 12 | * AOF rewrite buffer implementation. 13 | * 14 | * The following code implement a simple buffer used in order to accumulate 15 | * changes while the background process is rewriting the AOF file. 16 | * 17 | * We only need to append, but can't just use realloc with a large block 18 | * because 'huge' reallocs are not always handled as one could expect 19 | * (via remapping of pages at OS level) but may involve copying data. 20 | * 21 | * For this reason we use a list of blocks, every block is 22 | * AOF_RW_BUF_BLOCK_SIZE bytes. 23 | * ------------------------------------------------------------------------- */ 24 | 25 | #define AOF_RW_BUF_BLOCK_SIZE (1024*1024*10) /* 10 MB per block */ 26 | 27 | typedef struct aofrwblock { 28 | unsigned long used, free; 29 | char buf[AOF_RW_BUF_BLOCK_SIZE]; 30 | } aofrwblock; 31 | 32 | unsigned long aofRewriteBufferSize(void); 33 | void aofChildWriteDiffData(aeEventLoop *el, int fd, void *privdata, int mask); 34 | sds catAppendOnlyExpireAtCommand(sds buf, struct redisCommand *cmd, robj *key, robj *seconds); 35 | sds catAppendOnlyGenericCommand(sds dst, int argc, robj **argv); 36 | void aofRewriteBufferAppend(unsigned char *s, unsigned long len); 37 | void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int argc); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_backend.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_BACKEND_H_ 2 | #define _VR_BACKEND_H_ 3 | 4 | typedef struct vr_backend { 5 | 6 | int id; 7 | vr_eventloop vel; 8 | 9 | /* Some global state in order to continue the work incrementally 10 | * across calls for activeExpireCycle() to expire some keys. */ 11 | unsigned int current_db; /* Last DB tested. */ 12 | int timelimit_exit; /* Time limit hit in previous call? */ 13 | long long last_fast_cycle; /* When last fast cycle ran. */ 14 | 15 | /* We use global counters so if we stop the computation at a given 16 | * DB we'll be able to start from the successive in the next 17 | * cron loop iteration for databasesCron() to resize and reshash db. */ 18 | unsigned int resize_db; 19 | unsigned int rehash_db; 20 | }vr_backend; 21 | 22 | extern struct darray backends; 23 | 24 | int backends_init(uint32_t backend_count); 25 | int backends_run(void); 26 | int backends_wait(void); 27 | void backends_deinit(void); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_bitops.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_BITOPS_H_ 2 | #define _VR_BITOPS_H_ 3 | 4 | size_t redisPopcount(void *s, long count); 5 | long redisBitpos(void *s, unsigned long count, int bit); 6 | void setUnsignedBitfield(unsigned char *p, uint64_t offset, uint64_t bits, uint64_t value); 7 | void setSignedBitfield(unsigned char *p, uint64_t offset, uint64_t bits, int64_t value); 8 | uint64_t getUnsignedBitfield(unsigned char *p, uint64_t offset, uint64_t bits); 9 | int64_t getSignedBitfield(unsigned char *p, uint64_t offset, uint64_t bits); 10 | int checkUnsignedBitfieldOverflow(uint64_t value, int64_t incr, uint64_t bits, int owtype, uint64_t *limit); 11 | int checkSignedBitfieldOverflow(int64_t value, int64_t incr, uint64_t bits, int owtype, int64_t *limit); 12 | void printBits(unsigned char *p, unsigned long count); 13 | int getBitOffsetFromArgument(struct client *c, robj *o, size_t *offset, int hash, int bits); 14 | int getBitfieldTypeFromArgument(struct client *c, robj *o, int *sign, int *bits); 15 | robj *lookupStringForBitCommand(struct client *c, size_t maxbit, int *expired); 16 | void setbitCommand(struct client *c); 17 | void getbitCommand(struct client *c); 18 | void bitopCommand(struct client *c); 19 | void bitcountCommand(struct client *c); 20 | void bitposCommand(struct client *c); 21 | void bitfieldCommand(client *c); 22 | #endif 23 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_block.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_BLOCK_H_ 2 | #define _VR_BLOCK_H_ 3 | 4 | /* This structure holds the blocking operation state for a client. 5 | * The fields used depend on client->btype. */ 6 | typedef struct blockingState { 7 | /* Generic fields. */ 8 | long long timeout; /* Blocking operation timeout. If UNIX current time 9 | * is > timeout then the operation timed out. */ 10 | 11 | /* BLOCKED_LIST */ 12 | dict *keys; /* The keys we are waiting to terminate a blocking 13 | * operation such as BLPOP. Otherwise NULL. */ 14 | robj *target; /* The key that should receive the element, 15 | * for BRPOPLPUSH. */ 16 | 17 | /* BLOCKED_WAIT */ 18 | int numreplicas; /* Number of replicas we are waiting for ACK. */ 19 | long long reploffset; /* Replication offset to reach. */ 20 | } blockingState; 21 | 22 | void blockClient(struct client *c, int btype); 23 | void unblockClient(struct client *c); 24 | int getTimeoutFromObjectOrReply(struct client *c, robj *object, long long *timeout, int unit); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_core.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | static uint32_t reserved_fds = 0; 7 | 8 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_hyperloglog.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_HYPERLOGLOG_H_ 2 | #define _VR_HYPERLOGLOG_H_ 3 | 4 | uint64_t MurmurHash64A (const void * key, int len, unsigned int seed); 5 | int hllPatLen(unsigned char *ele, size_t elesize, long *regp); 6 | int hllDenseAdd(uint8_t *registers, unsigned char *ele, size_t elesize); 7 | double hllDenseSum(uint8_t *registers, double *PE, int *ezp); 8 | int hllSparseToDense(robj *o); 9 | int hllSparseAdd(robj *o, unsigned char *ele, size_t elesize); 10 | double hllSparseSum(uint8_t *sparse, int sparselen, double *PE, int *ezp, int *invalid); 11 | double hllRawSum(uint8_t *registers, double *PE, int *ezp); 12 | int hllAdd(robj *o, unsigned char *ele, size_t elesize); 13 | int hllMerge(uint8_t *max, robj *hll); 14 | robj *createHLLObject(void); 15 | int isHLLObjectOrReply(struct client *c, robj *o); 16 | void pfaddCommand(struct client *c); 17 | void pfcountCommand(struct client *c); 18 | void pfmergeCommand(struct client *c); 19 | void pfselftestCommand(struct client *c); 20 | void pfdebugCommand(struct client *c); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_intset.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_INTSET_H_ 2 | #define _VR_INTSET_H_ 3 | 4 | #include 5 | 6 | typedef struct intset { 7 | uint32_t encoding; 8 | uint32_t length; 9 | int8_t contents[]; 10 | } intset; 11 | 12 | intset *intsetNew(void); 13 | intset *intsetAdd(intset *is, int64_t value, uint8_t *success); 14 | intset *intsetRemove(intset *is, int64_t value, int *success); 15 | uint8_t intsetFind(intset *is, int64_t value); 16 | int64_t intsetRandom(intset *is); 17 | uint8_t intsetGet(intset *is, uint32_t pos, int64_t *value); 18 | uint32_t intsetLen(intset *is); 19 | size_t intsetBlobLen(intset *is); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_listen.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_LISTEN_H_ 2 | #define _VR_LISTEN_H_ 3 | 4 | typedef struct vr_listen { 5 | sds name; /* hostname:port */ 6 | int port; /* port */ 7 | mode_t perm; /* socket permissions */ 8 | struct sockinfo info; /* listen socket info */ 9 | int sd; /* socket descriptor */ 10 | }vr_listen; 11 | 12 | vr_listen *vr_listen_create(sds linten_str); 13 | void vr_listen_destroy(vr_listen *vliston); 14 | rstatus_t vr_listen_begin(struct vr_listen *vlisten); 15 | int vr_listen_accept(vr_listen *vlisten); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_master.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_MASTER_H_ 2 | #define _VR_MASTER_H_ 3 | 4 | typedef struct vr_master { 5 | 6 | vr_eventloop vel; 7 | 8 | struct darray listens; /* type: vr_listen */ 9 | 10 | dlist *cbsul; /* Connect back swap unit list */ 11 | pthread_mutex_t cbsullock; /* swap unit list locker */ 12 | }vr_master; 13 | 14 | extern vr_master master; 15 | 16 | int master_init(vr_conf *conf); 17 | void master_deinit(void); 18 | 19 | void dispatch_conn_exist(struct client *c, int tid); 20 | 21 | int master_run(void); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_multi.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_MULTI_H_ 2 | #define _VR_MULTI_H_ 3 | 4 | /* Client MULTI/EXEC state */ 5 | typedef struct multiCmd { 6 | robj **argv; 7 | int argc; 8 | struct redisCommand *cmd; 9 | } multiCmd; 10 | 11 | typedef struct multiState { 12 | multiCmd *commands; /* Array of MULTI commands */ 13 | int count; /* Total number of MULTI commands */ 14 | int minreplicas; /* MINREPLICAS for synchronous replication */ 15 | time_t minreplicas_timeout; /* MINREPLICAS timeout as unixtime. */ 16 | } multiState; 17 | 18 | void unwatchAllKeys(struct client *c); 19 | void initClientMultiState(struct client *c); 20 | void freeClientMultiState(struct client *c); 21 | void queueMultiCommand(struct client *c); 22 | 23 | void flagTransaction(struct client *c); 24 | void execCommand(struct client *c); 25 | void discardCommand(struct client *c); 26 | void discardTransaction(struct client *c); 27 | void multiCommand(struct client *c); 28 | void watchForKey(struct client *c, robj *key); 29 | void watchCommand(struct client *c); 30 | void touchWatchedKey(redisDb *db, robj *key); 31 | void touchWatchedKeysOnFlush(int dbid) ; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_notify.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_NOTIFY_H_ 2 | #define _VR_NOTIFY_H_ 3 | 4 | /* Keyspace changes notification classes. Every class is associated with a 5 | * character for configuration purposes. */ 6 | #define NOTIFY_KEYSPACE (1<<0) /* K */ 7 | #define NOTIFY_KEYEVENT (1<<1) /* E */ 8 | #define NOTIFY_GENERIC (1<<2) /* g */ 9 | #define NOTIFY_STRING (1<<3) /* $ */ 10 | #define NOTIFY_LIST (1<<4) /* l */ 11 | #define NOTIFY_SET (1<<5) /* s */ 12 | #define NOTIFY_HASH (1<<6) /* h */ 13 | #define NOTIFY_ZSET (1<<7) /* z */ 14 | #define NOTIFY_EXPIRED (1<<8) /* x */ 15 | #define NOTIFY_EVICTED (1<<9) /* e */ 16 | #define NOTIFY_ALL (NOTIFY_GENERIC | NOTIFY_STRING | NOTIFY_LIST | NOTIFY_SET | NOTIFY_HASH | NOTIFY_ZSET | NOTIFY_EXPIRED | NOTIFY_EVICTED) /* A */ 17 | 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_pubsub.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_PUBSUB_H_ 2 | #define _VR_PUBSUB_H_ 3 | 4 | typedef struct pubsubPattern { 5 | client *client; 6 | robj *pattern; 7 | } pubsubPattern; 8 | 9 | int pubsubUnsubscribeChannel(client *c, robj *channel, int notify); 10 | int pubsubUnsubscribeAllChannels(client *c, int notify); 11 | int pubsubUnsubscribePattern(client *c, robj *pattern, int notify); 12 | int pubsubUnsubscribeAllPatterns(client *c, int notify); 13 | int pubsubSubscribeChannel(client *c, robj *channel); 14 | int clientSubscriptionsCount(client *c); 15 | void subscribeCommand(client *c); 16 | void unsubscribeCommand(client *c); 17 | void psubscribeCommand(client *c); 18 | void punsubscribeCommand(client *c); 19 | int pubsubSubscribePattern(client *c, robj *pattern); 20 | int pubsubPublishMessage(robj *channel, robj *message); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_rbtree.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_RBTREE_ 2 | #define _VR_RBTREE_ 3 | 4 | #define rbtree_red(_node) ((_node)->color = 1) 5 | #define rbtree_black(_node) ((_node)->color = 0) 6 | #define rbtree_is_red(_node) ((_node)->color) 7 | #define rbtree_is_black(_node) (!rbtree_is_red(_node)) 8 | #define rbtree_copy_color(_n1, _n2) ((_n1)->color = (_n2)->color) 9 | 10 | struct rbnode { 11 | struct rbnode *left; /* left link */ 12 | struct rbnode *right; /* right link */ 13 | struct rbnode *parent; /* parent link */ 14 | int64_t key; /* key for ordering */ 15 | void *data; /* opaque data */ 16 | uint8_t color; /* red | black */ 17 | }; 18 | 19 | struct rbtree { 20 | struct rbnode *root; /* root node */ 21 | struct rbnode *sentinel; /* nil node */ 22 | }; 23 | 24 | void rbtree_node_init(struct rbnode *node); 25 | void rbtree_init(struct rbtree *tree, struct rbnode *node); 26 | struct rbnode *rbtree_min(struct rbtree *tree); 27 | void rbtree_insert(struct rbtree *tree, struct rbnode *node); 28 | void rbtree_delete(struct rbtree *tree, struct rbnode *node); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_rdb.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* Save the DB on disk. Return C_ERR on error, C_OK on success. */ 4 | int rdbSave(char *filename) { 5 | return VR_OK; 6 | } 7 | 8 | void rdbRemoveTempFile(pid_t childpid) { 9 | char tmpfile[256]; 10 | 11 | snprintf(tmpfile,sizeof(tmpfile),"temp-%d.rdb", (int) childpid); 12 | unlink(tmpfile); 13 | } 14 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_rdb.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_RDB_H_ 2 | #define _VR_RDB_H_ 3 | 4 | /* Defines related to the dump file format. To store 32 bits lengths for short 5 | * keys requires a lot of space, so we check the most significant 2 bits of 6 | * the first byte to interpreter the length: 7 | * 8 | * 00|000000 => if the two MSB are 00 the len is the 6 bits of this byte 9 | * 01|000000 00000000 => 01, the len is 14 byes, 6 bits + 8 bits of next byte 10 | * 10|000000 [32 bit integer] => if it's 10, a full 32 bit len will follow 11 | * 11|000000 this means: specially encoded object will follow. The six bits 12 | * number specify the kind of object that follows. 13 | * See the RDB_ENC_* defines. 14 | * 15 | * Lengths up to 63 are stored using a single byte, most DB keys, and may 16 | * values, will fit inside. */ 17 | #define RDB_6BITLEN 0 18 | #define RDB_14BITLEN 1 19 | #define RDB_32BITLEN 2 20 | #define RDB_ENCVAL 3 21 | #define RDB_LENERR UINT_MAX 22 | 23 | /* When a length of a string object stored on disk has the first two bits 24 | * set, the remaining two bits specify a special encoding for the object 25 | * accordingly to the following defines: */ 26 | #define RDB_ENC_INT8 0 /* 8 bit signed integer */ 27 | #define RDB_ENC_INT16 1 /* 16 bit signed integer */ 28 | #define RDB_ENC_INT32 2 /* 32 bit signed integer */ 29 | #define RDB_ENC_LZF 3 /* string compressed with FASTLZ */ 30 | 31 | struct saveparam { 32 | time_t seconds; 33 | int changes; 34 | }; 35 | 36 | int rdbSave(char *filename); 37 | void rdbRemoveTempFile(pid_t childpid); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_scripting.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void scriptCommand(client *c) { 4 | addReply(c,shared.ok); 5 | } 6 | 7 | 8 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_scripting.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_SCRIPTING_H_ 2 | #define _VR_SCRIPTING_H_ 3 | 4 | void scriptCommand(client *c); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_signal.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_SIGNAL_H_ 2 | #define _VR_SIGNAL_H_ 3 | 4 | struct signal { 5 | int signo; 6 | char *signame; 7 | int flags; 8 | void (*handler)(int signo); 9 | }; 10 | 11 | rstatus_t signal_init(void); 12 | void signal_deinit(void); 13 | void signal_handler(int signo); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_slowlog.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_SLOWLOG_H_ 2 | #define _VR_SLOWLOG_H_ 3 | 4 | #define SLOWLOG_ENTRY_MAX_ARGC 32 5 | #define SLOWLOG_ENTRY_MAX_STRING 128 6 | 7 | /* This structure defines an entry inside the slow log list */ 8 | typedef struct slowlogEntry { 9 | robj **argv; 10 | int argc; 11 | long long id; /* Unique entry identifier. */ 12 | long long duration; /* Time spent by the query, in nanoseconds. */ 13 | time_t time; /* Unix time at which the query was executed. */ 14 | } slowlogEntry; 15 | 16 | /* Exported API */ 17 | void slowlogInit(void); 18 | void slowlogPushEntryIfNeeded(vr_eventloop *vel, robj **argv, int argc, long long duration); 19 | 20 | /* Exported commands */ 21 | void slowlogCommand(client *c); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_t_hash.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_T_HASH_H_ 2 | #define _VR_T_HASH_H_ 3 | 4 | void hashTypeTryConversion(robj *o, robj **argv, int start, int end); 5 | void hashTypeTryObjectEncoding(robj *subject, robj **o1, robj **o2); 6 | int hashTypeGetFromZiplist(robj *o, robj *field, unsigned char **vstr, unsigned int *vlen, long long *vll); 7 | int hashTypeGetFromHashTable(robj *o, robj *field, robj **value); 8 | robj *hashTypeGetObject(robj *o, robj *field); 9 | size_t hashTypeGetValueLength(robj *o, robj *field); 10 | int hashTypeExists(robj *o, robj *field); 11 | int hashTypeSet(robj *o, robj *field, robj *value); 12 | int hashTypeDelete(robj *o, robj *field); 13 | unsigned long hashTypeLength(robj *o); 14 | hashTypeIterator *hashTypeInitIterator(robj *subject); 15 | void hashTypeReleaseIterator(hashTypeIterator *hi); 16 | int hashTypeNext(hashTypeIterator *hi); 17 | void hashTypeCurrentFromZiplist(hashTypeIterator *hi, int what, unsigned char **vstr, unsigned int *vlen, long long *vll); 18 | void hashTypeCurrentFromHashTable(hashTypeIterator *hi, int what, robj **dst); 19 | robj *hashTypeCurrentObject(hashTypeIterator *hi, int what); 20 | robj *hashTypeLookupWriteOrCreate(client *c, robj *key, int *expired); 21 | void hashTypeConvertZiplist(robj *o, int enc); 22 | void hashTypeConvert(robj *o, int enc); 23 | void hsetCommand(client *c); 24 | void hsetnxCommand(client *c); 25 | void hmsetCommand(client *c); 26 | void hincrbyCommand(client *c); 27 | void hincrbyfloatCommand(client *c); 28 | void hgetCommand(client *c); 29 | void hmgetCommand(client *c); 30 | void hdelCommand(client *c); 31 | void hlenCommand(client *c); 32 | void hstrlenCommand(client *c); 33 | void genericHgetallCommand(client *c, int flags); 34 | void hkeysCommand(client *c); 35 | void hvalsCommand(client *c); 36 | void hgetallCommand(client *c); 37 | void hexistsCommand(client *c); 38 | void hscanCommand(client *c); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_t_set.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_T_SET_H_ 2 | #define _VR_T_SET_H_ 3 | 4 | robj *setTypeCreate(robj *value); 5 | int setTypeAdd(robj *subject, robj *value); 6 | int setTypeRemove(robj *setobj, robj *value); 7 | int setTypeIsMember(robj *subject, robj *value); 8 | setTypeIterator *setTypeInitIterator(robj *subject); 9 | void setTypeReleaseIterator(setTypeIterator *si); 10 | int setTypeNext(setTypeIterator *si, robj **objele, int64_t *llele); 11 | robj *setTypeNextObject(setTypeIterator *si); 12 | int setTypeRandomElement(robj *setobj, robj **objele, int64_t *llele); 13 | 14 | unsigned long setTypeSize(robj *subject); 15 | void setTypeConvert(robj *setobj, int enc); 16 | void saddCommand(client *c); 17 | void sremCommand(client *c); 18 | void smoveCommand(client *c); 19 | void sismemberCommand(client *c); 20 | void scardCommand(client *c); 21 | void spopWithCountCommand(client *c); 22 | void spopCommand(client *c); 23 | void srandmemberWithCountCommand(client *c); 24 | void srandmemberCommand(client *c); 25 | void smembersCommand(client *c); 26 | int qsortCompareSetsByCardinality(const void *s1, const void *s2); 27 | int qsortCompareSetsByRevCardinality(const void *s1, const void *s2); 28 | void sinterGenericCommand(client *c, robj **setkeys, unsigned long setnum, robj *dstkey); 29 | void sinterCommand(client *c); 30 | void sinterstoreCommand(client *c); 31 | void sunionDiffGenericCommand(client *c, robj **setkeys, int setnum, robj *dstkey, int op); 32 | void sunionCommand(client *c); 33 | void sunionstoreCommand(client *c); 34 | void sdiffCommand(client *c); 35 | void sdiffstoreCommand(client *c); 36 | void sscanCommand(client *c); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_t_string.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_T_STRING_H_ 2 | #define _VR_T_STRING_H_ 3 | 4 | void setGenericCommand(client *c, int flags, robj *key, robj *val, robj *expire, int unit, robj *ok_reply, robj *abort_reply); 5 | void setCommand(client *c); 6 | void setnxCommand(client *c); 7 | void setexCommand(client *c); 8 | void psetexCommand(client *c); 9 | int getGenericCommand(client *c); 10 | void getCommand(client *c); 11 | void getsetCommand(client *c); 12 | void setrangeCommand(client *c); 13 | void getrangeCommand(client *c); 14 | void mgetCommand(client *c); 15 | void msetGenericCommand(client *c, int nx); 16 | void msetCommand(client *c); 17 | void msetnxCommand(client *c); 18 | void incrDecrCommand(client *c, long long incr); 19 | void incrCommand(client *c); 20 | void decrCommand(client *c); 21 | void incrbyCommand(client *c); 22 | void decrbyCommand(client *c); 23 | void incrbyfloatCommand(client *c); 24 | void appendCommand(client *c); 25 | void strlenCommand(client *c); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_thread.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_THREAD_H_ 2 | #define _VR_THREAD_H_ 3 | 4 | typedef void *(*vr_thread_func_t)(void *data); 5 | 6 | typedef struct vr_thread { 7 | int id; 8 | pthread_t thread_id; 9 | 10 | vr_thread_func_t fun_run; 11 | void *data; 12 | #ifdef USE_DAX 13 | char* start_addr; 14 | int affinityNodeID; 15 | uint64_t padding[32]; 16 | #endif 17 | }vr_thread; 18 | 19 | int vr_thread_init(vr_thread *thread); 20 | void vr_thread_deinit(vr_thread *thread); 21 | int vr_thread_start(vr_thread *thread); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_worker.h: -------------------------------------------------------------------------------- 1 | #ifndef _VR_WORKER_H_ 2 | #define _VR_WORKER_H_ 3 | 4 | typedef struct vr_worker { 5 | 6 | int id; 7 | vr_eventloop vel; 8 | 9 | int socketpairs[2]; /*0: belong to master thread, 1: belong to myself*/ 10 | 11 | dlist *csul; /* Connect swap unit list */ 12 | pthread_mutex_t csullock; /* swap unit list locker */ 13 | 14 | /* Some global state in order to continue the work incrementally 15 | * across calls for activeExpireCycle() to expire some keys. */ 16 | unsigned int current_db; /* Last DB tested. */ 17 | int timelimit_exit; /* Time limit hit in previous call? */ 18 | long long last_fast_cycle; /* When last fast cycle ran. */ 19 | 20 | /* We use global counters so if we stop the computation at a given 21 | * DB we'll be able to start from the successive in the next 22 | * cron loop iteration for databasesCron() to resize and reshash db. */ 23 | unsigned int resize_db; 24 | unsigned int rehash_db; 25 | }vr_worker; 26 | 27 | struct connswapunit { 28 | int num; 29 | void *data; 30 | struct connswapunit *next; 31 | }; 32 | 33 | extern struct darray workers; 34 | 35 | int workers_init(uint32_t worker_count); 36 | int workers_run(void); 37 | int workers_wait(void); 38 | void workers_deinit(void); 39 | 40 | struct connswapunit *csui_new(void); 41 | void csui_free(struct connswapunit *item); 42 | 43 | void csul_push(vr_worker *worker, struct connswapunit *su); 44 | struct connswapunit *csul_pop(vr_worker *worker); 45 | 46 | int worker_get_next_idx(int curidx); 47 | 48 | void dispatch_conn_new(vr_listen *vlisten, int sd); 49 | 50 | void worker_before_sleep(struct aeEventLoop *eventLoop, void *private_data); 51 | int worker_cron(struct aeEventLoop *eventLoop, long long id, void *clientData); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_ziplist.h: -------------------------------------------------------------------------------- 1 | #ifndef _ZIPLIST_H 2 | #define _ZIPLIST_H 3 | 4 | #define ZIPLIST_HEAD 0 5 | #define ZIPLIST_TAIL 1 6 | 7 | unsigned char *ziplistNew(void); 8 | unsigned char *ziplistMerge(unsigned char **first, unsigned char **second); 9 | unsigned char *ziplistPush(unsigned char *zl, unsigned char *s, unsigned int slen, int where); 10 | unsigned char *ziplistIndex(unsigned char *zl, int index); 11 | unsigned char *ziplistNext(unsigned char *zl, unsigned char *p); 12 | unsigned char *ziplistPrev(unsigned char *zl, unsigned char *p); 13 | unsigned int ziplistGet(unsigned char *p, unsigned char **sval, unsigned int *slen, long long *lval); 14 | unsigned char *ziplistInsert(unsigned char *zl, unsigned char *p, unsigned char *s, unsigned int slen); 15 | unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p); 16 | unsigned char *ziplistDeleteRange(unsigned char *zl, int index, unsigned int num); 17 | unsigned int ziplistCompare(unsigned char *p, unsigned char *s, unsigned int slen); 18 | unsigned char *ziplistFind(unsigned char *p, unsigned char *vstr, unsigned int vlen, unsigned int skip); 19 | unsigned int ziplistLen(unsigned char *zl); 20 | size_t ziplistBlobLen(unsigned char *zl); 21 | 22 | #ifdef REDIS_TEST 23 | int ziplistTest(int argc, char *argv[]); 24 | #endif 25 | 26 | #endif /* _ZIPLIST_H */ 27 | -------------------------------------------------------------------------------- /kv-store-test/vire/src/vr_zipmap.h: -------------------------------------------------------------------------------- 1 | #ifndef _ZIPMAP_H 2 | #define _ZIPMAP_H 3 | 4 | unsigned char *zipmapNew(void); 5 | unsigned char *zipmapSet(unsigned char *zm, unsigned char *key, unsigned int klen, unsigned char *val, unsigned int vlen, int *update); 6 | unsigned char *zipmapDel(unsigned char *zm, unsigned char *key, unsigned int klen, int *deleted); 7 | unsigned char *zipmapRewind(unsigned char *zm); 8 | unsigned char *zipmapNext(unsigned char *zm, unsigned char **key, unsigned int *klen, unsigned char **value, unsigned int *vlen); 9 | int zipmapGet(unsigned char *zm, unsigned char *key, unsigned int klen, unsigned char **value, unsigned int *vlen); 10 | int zipmapExists(unsigned char *zm, unsigned char *key, unsigned int klen); 11 | unsigned int zipmapLen(unsigned char *zm); 12 | size_t zipmapBlobLen(unsigned char *zm); 13 | void zipmapRepr(unsigned char *p); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /kv-store-test/vire/tests/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.out 3 | *.log -------------------------------------------------------------------------------- /kv-store-test/vire/tests/vire-benchmark: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/kv-store-test/vire/tests/vire-benchmark -------------------------------------------------------------------------------- /kv-store-test/vire/tests/vireabtest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/kv-store-test/vire/tests/vireabtest -------------------------------------------------------------------------------- /kv-store-test/vire/tests/viretest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/kv-store-test/vire/tests/viretest -------------------------------------------------------------------------------- /kv-store-test/vire/tests/vrabtest.h: -------------------------------------------------------------------------------- 1 | #ifndef _VRABTEST_H_ 2 | #define _VRABTEST_H_ 3 | 4 | #include 5 | 6 | struct redisContext; 7 | struct redisAsyncContext; 8 | struct abtest_group; 9 | 10 | typedef struct conn_context { 11 | struct redisContext *ctx; 12 | struct redisAsyncContext *actx; 13 | } conn_context; 14 | 15 | typedef struct abtest_server { 16 | sds host; 17 | int port; 18 | 19 | darray *conn_contexts; /* connection context */ 20 | 21 | void *data; 22 | } abtest_server; 23 | 24 | typedef unsigned int (*backend_server_idx_t)(struct abtest_group*, char *, size_t); 25 | typedef abtest_server *(*backend_server_t)(struct abtest_group*, char *, size_t); 26 | 27 | typedef struct abtest_group { 28 | int type; 29 | 30 | darray abtest_servers; /* type: abtest_server */ 31 | 32 | backend_server_idx_t get_backend_server_idx; 33 | backend_server_t get_backend_server; 34 | } abtest_group; 35 | 36 | extern int expire_enabled; 37 | extern long long test_interval; 38 | extern long long last_test_begin_time; 39 | 40 | darray *abtest_groups_create(char *groups_string); 41 | void abtest_groups_destroy(darray *abgs); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /kv-store-test/vire/tests/vrt_backend.h: -------------------------------------------------------------------------------- 1 | #ifndef _VRT_BACKEND_H_ 2 | #define _VRT_BACKEND_H_ 3 | 4 | #include 5 | 6 | struct abtest_group; 7 | struct dlist; 8 | struct dmtlist; 9 | struct data_unit; 10 | struct aeEventLoop; 11 | 12 | typedef struct backend_thread { 13 | int id; 14 | pthread_t thread_id; 15 | 16 | struct aeEventLoop *el; 17 | int hz; 18 | int cronloops; /* Number of times the cron function run */ 19 | 20 | darray *abgs; /* type is abtest_group */ 21 | 22 | int deleting; 23 | int pause; 24 | } backend_thread; 25 | 26 | extern int backend_threads_count; 27 | 28 | extern int backend_threads_pause_finished_count; 29 | 30 | int vrt_backend_init(int threads_count, char *test_target_groups); 31 | void vrt_backend_deinit(void); 32 | 33 | int vrt_start_backend(void); 34 | int vrt_wait_backend(void); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /kv-store-test/vire/tests/vrt_check_data.h: -------------------------------------------------------------------------------- 1 | #ifndef _VRT_CHECK_DATA_H_ 2 | #define _VRT_CHECK_DATA_H_ 3 | 4 | int vrt_data_checker_init(char *checker, char *test_target_groups); 5 | void vrt_data_checker_deinit(void); 6 | 7 | int vrt_start_data_checker(void); 8 | int vrt_wait_data_checker(void); 9 | 10 | int test_if_need_pause(void); 11 | void test_can_continue(void); 12 | void test_need_to_pause(void); 13 | 14 | void one_produce_thread_paused(void); 15 | void one_dispatch_thread_paused(void); 16 | void one_backend_thread_paused(void); 17 | 18 | int all_produce_threads_paused(void); 19 | int all_dispatch_threads_paused(void); 20 | int all_backend_threads_paused(void); 21 | int all_threads_paused(void); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /kv-store-test/vire/tests/vrt_dispatch_data.h: -------------------------------------------------------------------------------- 1 | #ifndef _VRT_DISPATCH_DATA_H_ 2 | #define _VRT_DISPATCH_DATA_H_ 3 | 4 | #include 5 | 6 | struct abtest_group; 7 | struct dlist; 8 | struct dmtqueue; 9 | struct data_unit; 10 | struct aeEventLoop; 11 | 12 | typedef struct dispatch_data_thread { 13 | int id; 14 | pthread_t thread_id; 15 | 16 | struct aeEventLoop *el; 17 | int hz; 18 | int cronloops; /* Number of times the cron function run */ 19 | 20 | struct dmtqueue *datas; /* Value is data_unit, used receive data 21 | from produce data thread, and send to the abtest groups. */ 22 | struct dlist *rdatas; /* Value is reply_unit, used to cache data 23 | that has not received from abtest groups completely */ 24 | 25 | darray *abgs; /* type is abtest_group */ 26 | 27 | int pause; 28 | 29 | int count_wait_for_reply; 30 | 31 | long long reply_total_count_per_cycle; 32 | long long reply_type_err_count_per_cycle; 33 | } dispatch_data_thread; 34 | 35 | extern int dispatch_data_threads_count; 36 | 37 | extern int dispatch_threads_pause_finished_count; 38 | 39 | long long get_total_tested_commands_count_per_cycle(void); 40 | long long get_total_reply_err_count_per_cycle(void); 41 | void reset_total_count_per_cycle(void); 42 | 43 | int vrt_dispatch_data_init(int threads_count, char *test_target_groups, int connections); 44 | void vrt_dispatch_data_deinit(void); 45 | 46 | int vrt_start_dispatch_data(void); 47 | int vrt_wait_dispatch_data(void); 48 | 49 | int data_dispatch(struct data_unit *du); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /kv-store-test/vire/tests/vrt_simple.h: -------------------------------------------------------------------------------- 1 | #ifndef _VRT_SIMPLE_H_ 2 | #define _VRT_SIMPLE_H_ 3 | 4 | int simple_test(void); 5 | 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /kv-store-test/vire/tools/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.out 3 | *.log 4 | -------------------------------------------------------------------------------- /multiThread/fast_fair/atomic_ops/AUTHORS: -------------------------------------------------------------------------------- 1 | Originally written by Hans Boehm, with some platform-dependent code 2 | imported from the Boehm-Demers-Weiser GC, where it was contributed 3 | by many others. 4 | 5 | -------------------------------------------------------------------------------- /multiThread/fast_fair/atomic_ops/README: -------------------------------------------------------------------------------- 1 | This directory contains a stripped-down (support only gcc) version of libatomic_ops by Hans Boehm. 2 | The official release is available from http://www.hpl.hp.com/research/linux/atomic_ops/. 3 | -------------------------------------------------------------------------------- /multiThread/fast_fair/atomic_ops/standard_ao_double_t.h: -------------------------------------------------------------------------------- 1 | /* NEC LE-IT: For 64Bit OS we extend the double type to hold two int64's 2 | * 3 | * x86-64: __m128 serves as placeholder which also requires the compiler 4 | * to align it on 16 byte boundary (as required by cmpxchg16. 5 | * Similar things could be done for PowerPC 64bit using a VMX data type... */ 6 | 7 | #if (defined(__x86_64__) && defined(__GNUC__)) || defined(_WIN64) 8 | # include 9 | typedef __m128 double_ptr_storage; 10 | #elif defined(_WIN32) && !defined(__GNUC__) 11 | typedef unsigned __int64 double_ptr_storage; 12 | #else 13 | typedef unsigned long long double_ptr_storage; 14 | #endif 15 | 16 | # define AO_HAVE_DOUBLE_PTR_STORAGE 17 | 18 | typedef union { 19 | double_ptr_storage AO_whole; 20 | struct {AO_t AO_v1; AO_t AO_v2;} AO_parts; 21 | } AO_double_t; 22 | 23 | #define AO_HAVE_double_t 24 | #define AO_val1 AO_parts.AO_v1 25 | #define AO_val2 AO_parts.AO_v2 26 | -------------------------------------------------------------------------------- /multiThread/fast_fair/atomic_ops/test_and_set_t_is_ao_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * These are common definitions for architectures on which test_and_set 25 | * operates on pointer-sized quantities, the "clear" value contains 26 | * all zeroes, and the "set" value contains only one lowest bit set. 27 | * This can be used if test_and_set is synthesized from compare_and_swap. 28 | */ 29 | typedef enum {AO_TS_clear = 0, AO_TS_set = 1} AO_TS_val; 30 | #define AO_TS_VAL_t AO_TS_val 31 | #define AO_TS_CLEAR AO_TS_clear 32 | #define AO_TS_SET AO_TS_set 33 | 34 | #define AO_TS_t AO_t 35 | 36 | #define AO_AO_TS_T 1 37 | -------------------------------------------------------------------------------- /multiThread/fast_fair/atomic_ops/test_and_set_t_is_char.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * These are common definitions for architectures on which test_and_set 25 | * operates on byte sized quantities, the "clear" value contains 26 | * all zeroes, and the "set" value contains all ones. 27 | */ 28 | 29 | #define AO_TS_t unsigned char 30 | typedef enum {AO_BYTE_TS_clear = 0, AO_BYTE_TS_set = 0xff} AO_BYTE_TS_val; 31 | #define AO_TS_VAL_t AO_BYTE_TS_val 32 | #define AO_TS_CLEAR AO_BYTE_TS_clear 33 | #define AO_TS_SET AO_BYTE_TS_set 34 | 35 | #define AO_CHAR_TS_T 1 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /multiThread/fast_fair/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | g++ -O3 -std=c++11 -DNDEBUG -DMUTEX -m64 -D_REENTRANT -fno-strict-aliasing -I./atomic_ops -DINTEL -Wno-unused-value -Wno-format -o ./main-gu-zipfian main-gu-zipfian.c -m64 -lpmemobj -lpmem -lpthread -lprofiler 4 | -------------------------------------------------------------------------------- /multiThread/fast_fair/main-gu-zipfian: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/multiThread/fast_fair/main-gu-zipfian -------------------------------------------------------------------------------- /multiThread/fast_fair/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for skewness in 99 #0 90 99 4 | do 5 | 6 | for thread_num in 36 #1 4 8 12 16 20 24 28 32 36 7 | do 8 | 9 | echo thread_num = ${thread_num} skewness = ${skewness} 10 | ./main-gu-zipfian -t ${thread_num} -d 5000 -i 10000000 -u 100 -f 0 #> result_0706/u100_0.${skewness}_${thread_num}.txt 11 | rm ../../mount/pmem0/main_pool 12 | rm ../../mount/pmem0/pool-* 13 | rm ../../mount/pmem1/pool-* 14 | 15 | sleep 3 16 | done 17 | done 18 | 19 | 20 | -------------------------------------------------------------------------------- /multiThread/fptree/atomic_ops/AUTHORS: -------------------------------------------------------------------------------- 1 | Originally written by Hans Boehm, with some platform-dependent code 2 | imported from the Boehm-Demers-Weiser GC, where it was contributed 3 | by many others. 4 | 5 | -------------------------------------------------------------------------------- /multiThread/fptree/atomic_ops/README: -------------------------------------------------------------------------------- 1 | This directory contains a stripped-down (support only gcc) version of libatomic_ops by Hans Boehm. 2 | The official release is available from http://www.hpl.hp.com/research/linux/atomic_ops/. 3 | -------------------------------------------------------------------------------- /multiThread/fptree/atomic_ops/aligned_atomic_load_store.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * Definitions for architectures on which loads and stores of AO_t are 25 | * atomic fo all legal alignments. 26 | */ 27 | 28 | AO_INLINE AO_t 29 | AO_load(const volatile AO_t *addr) 30 | { 31 | assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0); 32 | /* Cast away the volatile for architectures where */ 33 | /* volatile adds barrier semantics. */ 34 | return *(AO_t *)addr; 35 | } 36 | 37 | #define AO_HAVE_load 38 | 39 | AO_INLINE void 40 | AO_store(volatile AO_t *addr, AO_t new_val) 41 | { 42 | assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0); 43 | (*(AO_t *)addr) = new_val; 44 | } 45 | 46 | #define AO_HAVE_store 47 | -------------------------------------------------------------------------------- /multiThread/fptree/atomic_ops/standard_ao_double_t.h: -------------------------------------------------------------------------------- 1 | /* NEC LE-IT: For 64Bit OS we extend the double type to hold two int64's 2 | * 3 | * x86-64: __m128 serves as placeholder which also requires the compiler 4 | * to align it on 16 byte boundary (as required by cmpxchg16. 5 | * Similar things could be done for PowerPC 64bit using a VMX data type... */ 6 | 7 | #if (defined(__x86_64__) && defined(__GNUC__)) || defined(_WIN64) 8 | # include 9 | typedef __m128 double_ptr_storage; 10 | #elif defined(_WIN32) && !defined(__GNUC__) 11 | typedef unsigned __int64 double_ptr_storage; 12 | #else 13 | typedef unsigned long long double_ptr_storage; 14 | #endif 15 | 16 | # define AO_HAVE_DOUBLE_PTR_STORAGE 17 | 18 | typedef union { 19 | double_ptr_storage AO_whole; 20 | struct {AO_t AO_v1; AO_t AO_v2;} AO_parts; 21 | } AO_double_t; 22 | 23 | #define AO_HAVE_double_t 24 | #define AO_val1 AO_parts.AO_v1 25 | #define AO_val2 AO_parts.AO_v2 26 | -------------------------------------------------------------------------------- /multiThread/fptree/atomic_ops/test_and_set_t_is_ao_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * These are common definitions for architectures on which test_and_set 25 | * operates on pointer-sized quantities, the "clear" value contains 26 | * all zeroes, and the "set" value contains only one lowest bit set. 27 | * This can be used if test_and_set is synthesized from compare_and_swap. 28 | */ 29 | typedef enum {AO_TS_clear = 0, AO_TS_set = 1} AO_TS_val; 30 | #define AO_TS_VAL_t AO_TS_val 31 | #define AO_TS_CLEAR AO_TS_clear 32 | #define AO_TS_SET AO_TS_set 33 | 34 | #define AO_TS_t AO_t 35 | 36 | #define AO_AO_TS_T 1 37 | -------------------------------------------------------------------------------- /multiThread/fptree/atomic_ops/test_and_set_t_is_char.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * These are common definitions for architectures on which test_and_set 25 | * operates on byte sized quantities, the "clear" value contains 26 | * all zeroes, and the "set" value contains all ones. 27 | */ 28 | 29 | #define AO_TS_t unsigned char 30 | typedef enum {AO_BYTE_TS_clear = 0, AO_BYTE_TS_set = 0xff} AO_BYTE_TS_val; 31 | #define AO_TS_VAL_t AO_BYTE_TS_val 32 | #define AO_TS_CLEAR AO_BYTE_TS_clear 33 | #define AO_TS_SET AO_BYTE_TS_set 34 | 35 | #define AO_CHAR_TS_T 1 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /multiThread/fptree/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gcc -O3 -DNDEBUG -DMUTEX -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -c -o gc/ptst.o gc/ptst.c 4 | g++ -O0 -DNDEBUG -DMUTEX -m64 -g -D_REENTRANT -fno-strict-aliasing -I./atomic_ops -DINTEL -Wno-unused-value -Wno-format -fPIC -c -o fptree.o fptree.cpp -m64 -lpthread 5 | ar crv libfptree.a fptree.o gc/ptst.o 6 | g++ -O3 -std=c++11 -DNDEBUG -DMUTEX -m64 -D_REENTRANT -fno-strict-aliasing -I./atomic_ops -DINTEL -Wno-unused-value -Wno-format -o ./main-gu-zipfian gc/ptst.o main-gu-zipfian.c -m64 -L. -lfptree -lpmemobj -lpmem -lpthread 7 | -------------------------------------------------------------------------------- /multiThread/fptree/gc/set.h: -------------------------------------------------------------------------------- 1 | #ifndef __SET_H__ 2 | #define __SET_H__ 3 | 4 | /************************************* 5 | * INTERNAL DEFINITIONS 应该是这个 */ 6 | 7 | /* Internal key values with special meanings. */ 8 | #define INVALID_FIELD (0) /* Uninitialised field value. */ 9 | #define SENTINEL_KEYMIN (1UL) /* Key value of first dummy node. */ 10 | #define SENTINEL_KEYMAX (~0UL) /* Key value of last dummy node. */ 11 | #define BLIST_SPLIT_KEY (2UL) 12 | 13 | /* Used internally be set access functions, so that callers can use 14 | * key values 0 and 1, without knowing these have special meanings. */ 15 | #define CALLER_TO_INTERNAL_KEY(_k) ((_k) + 3) 16 | 17 | /* SUPPORT FOR WEAK ORDERING OF MEMORY ACCESSES */ 18 | #ifdef WEAK_MEM_ORDER 19 | 20 | /* Read field @_f into variable @_x. */ 21 | #define READ_FIELD(_x,_f) \ 22 | do { \ 23 | (_x) = (_f); \ 24 | if ( (_x) == INVALID_FIELD ) { RMB(); (_x) = (_f); } \ 25 | assert((_x) != INVALID_FIELD); \ 26 | } while ( 0 ) 27 | 28 | #else 29 | 30 | /* Read field @_f into variable @_x. */ 31 | #define READ_FIELD(_x,_f) ((_x) = (_f)) 32 | 33 | #endif 34 | 35 | /************************************* 36 | * PUBLIC DEFINITIONS */ 37 | 38 | /* Key range accepted by set functions. 39 | * We lose three values (conveniently at top end of key space). 40 | * - Known invalid value to which all fields are initialised. 41 | * - Sentinel key values for up to two dummy nodes. */ 42 | #define KEY_MIN ( 0U) 43 | #define KEY_MAX ((~0U) - 3) 44 | 45 | #endif /* __SET_H__ */ 46 | -------------------------------------------------------------------------------- /multiThread/fptree/main-gu-zipfian: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/multiThread/fptree/main-gu-zipfian -------------------------------------------------------------------------------- /multiThread/fptree/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for skewness in 99 #0 90 99 4 | do 5 | 6 | for thread_num in 1 4 8 12 16 20 24 28 32 36 7 | do 8 | 9 | echo thread_num = ${thread_num} skewness = ${skewness} 10 | ./main-gu-zipfian -t ${thread_num} -d 5000 -i 10000000 -u 5 -f 0 > result/u5_0.${skewness}_${thread_num}.txt 11 | rm ../../mount/pmem0/main_pool 12 | rm ../../mount/pmem0/pool-* 13 | rm ../../mount/pmem1/pool-* 14 | 15 | sleep 3 16 | done 17 | done 18 | 19 | 20 | -------------------------------------------------------------------------------- /multiThread/utree/atomic_ops/AUTHORS: -------------------------------------------------------------------------------- 1 | Originally written by Hans Boehm, with some platform-dependent code 2 | imported from the Boehm-Demers-Weiser GC, where it was contributed 3 | by many others. 4 | 5 | -------------------------------------------------------------------------------- /multiThread/utree/atomic_ops/README: -------------------------------------------------------------------------------- 1 | This directory contains a stripped-down (support only gcc) version of libatomic_ops by Hans Boehm. 2 | The official release is available from http://www.hpl.hp.com/research/linux/atomic_ops/. 3 | -------------------------------------------------------------------------------- /multiThread/utree/atomic_ops/aligned_atomic_load_store.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * Definitions for architectures on which loads and stores of AO_t are 25 | * atomic fo all legal alignments. 26 | */ 27 | 28 | AO_INLINE AO_t 29 | AO_load(const volatile AO_t *addr) 30 | { 31 | assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0); 32 | /* Cast away the volatile for architectures where */ 33 | /* volatile adds barrier semantics. */ 34 | return *(AO_t *)addr; 35 | } 36 | 37 | #define AO_HAVE_load 38 | 39 | AO_INLINE void 40 | AO_store(volatile AO_t *addr, AO_t new_val) 41 | { 42 | assert(((size_t)addr & (sizeof(AO_t) - 1)) == 0); 43 | (*(AO_t *)addr) = new_val; 44 | } 45 | 46 | #define AO_HAVE_store 47 | -------------------------------------------------------------------------------- /multiThread/utree/atomic_ops/standard_ao_double_t.h: -------------------------------------------------------------------------------- 1 | /* NEC LE-IT: For 64Bit OS we extend the double type to hold two int64's 2 | * 3 | * x86-64: __m128 serves as placeholder which also requires the compiler 4 | * to align it on 16 byte boundary (as required by cmpxchg16. 5 | * Similar things could be done for PowerPC 64bit using a VMX data type... */ 6 | 7 | #if (defined(__x86_64__) && defined(__GNUC__)) || defined(_WIN64) 8 | # include 9 | typedef __m128 double_ptr_storage; 10 | #elif defined(_WIN32) && !defined(__GNUC__) 11 | typedef unsigned __int64 double_ptr_storage; 12 | #else 13 | typedef unsigned long long double_ptr_storage; 14 | #endif 15 | 16 | # define AO_HAVE_DOUBLE_PTR_STORAGE 17 | 18 | typedef union { 19 | double_ptr_storage AO_whole; 20 | struct {AO_t AO_v1; AO_t AO_v2;} AO_parts; 21 | } AO_double_t; 22 | 23 | #define AO_HAVE_double_t 24 | #define AO_val1 AO_parts.AO_v1 25 | #define AO_val2 AO_parts.AO_v2 26 | -------------------------------------------------------------------------------- /multiThread/utree/atomic_ops/test_and_set_t_is_ao_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * These are common definitions for architectures on which test_and_set 25 | * operates on pointer-sized quantities, the "clear" value contains 26 | * all zeroes, and the "set" value contains only one lowest bit set. 27 | * This can be used if test_and_set is synthesized from compare_and_swap. 28 | */ 29 | typedef enum {AO_TS_clear = 0, AO_TS_set = 1} AO_TS_val; 30 | #define AO_TS_VAL_t AO_TS_val 31 | #define AO_TS_CLEAR AO_TS_clear 32 | #define AO_TS_SET AO_TS_set 33 | 34 | #define AO_TS_t AO_t 35 | 36 | #define AO_AO_TS_T 1 37 | -------------------------------------------------------------------------------- /multiThread/utree/atomic_ops/test_and_set_t_is_char.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * These are common definitions for architectures on which test_and_set 25 | * operates on byte sized quantities, the "clear" value contains 26 | * all zeroes, and the "set" value contains all ones. 27 | */ 28 | 29 | #define AO_TS_t unsigned char 30 | typedef enum {AO_BYTE_TS_clear = 0, AO_BYTE_TS_set = 0xff} AO_BYTE_TS_val; 31 | #define AO_TS_VAL_t AO_BYTE_TS_val 32 | #define AO_TS_CLEAR AO_BYTE_TS_clear 33 | #define AO_TS_SET AO_BYTE_TS_set 34 | 35 | #define AO_CHAR_TS_T 1 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /multiThread/utree/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | g++ -O3 -g -std=c++11 -m64 -D_REENTRANT -fno-strict-aliasing -I./atomic_ops -DINTEL -Wno-unused-value -Wno-format -o ./main-gu-zipfian main-gu-zipfian.c -m64 -lpmemobj -lpmem -lpthread 4 | -------------------------------------------------------------------------------- /multiThread/utree/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for skewness in 99 #0 90 99 4 | do 5 | for thread_num in 20 #1 4 8 12 16 20 24 28 32 36 6 | do 7 | 8 | echo thread_num = ${thread_num} skewness = ${skewness} 9 | ./main-gu-zipfian -t ${thread_num} -d 5000 -i 10000000 -u 5 -f 0 #> result/u5_0.${skewness}_${thread_num}.txt 10 | 11 | sleep 3 12 | done 13 | done 14 | 15 | -------------------------------------------------------------------------------- /singleThread/FPTree/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | g++ -O3 -g -DNDEBUG -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -o ./main main.cpp -lpmemobj -lpmem -lprofiler -------------------------------------------------------------------------------- /singleThread/FPTree/main: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/singleThread/FPTree/main -------------------------------------------------------------------------------- /singleThread/FPTree/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | numactl --cpunodebind=1 ./main 4 | rm /home/fkd/CPTree-202006/mount/pool -------------------------------------------------------------------------------- /singleThread/NV_tree/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | g++ -O3 -g -DNDEBUG -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -o ./main main.cpp -lpmemobj -lpmem -lprofiler 4 | -------------------------------------------------------------------------------- /singleThread/NV_tree/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | numactl --cpunodebind=1 ./main 4 | rm /home/fkd/CPTree-202006/mount/pool -------------------------------------------------------------------------------- /singleThread/RNTree/atomic_ops/AUTHORS: -------------------------------------------------------------------------------- 1 | Originally written by Hans Boehm, with some platform-dependent code 2 | imported from the Boehm-Demers-Weiser GC, where it was contributed 3 | by many others. 4 | 5 | -------------------------------------------------------------------------------- /singleThread/RNTree/atomic_ops/README: -------------------------------------------------------------------------------- 1 | This directory contains a stripped-down (support only gcc) version of libatomic_ops by Hans Boehm. 2 | The official release is available from http://www.hpl.hp.com/research/linux/atomic_ops/. 3 | -------------------------------------------------------------------------------- /singleThread/RNTree/atomic_ops/standard_ao_double_t.h: -------------------------------------------------------------------------------- 1 | /* NEC LE-IT: For 64Bit OS we extend the double type to hold two int64's 2 | * 3 | * x86-64: __m128 serves as placeholder which also requires the compiler 4 | * to align it on 16 byte boundary (as required by cmpxchg16. 5 | * Similar things could be done for PowerPC 64bit using a VMX data type... */ 6 | 7 | #if (defined(__x86_64__) && defined(__GNUC__)) || defined(_WIN64) 8 | # include 9 | typedef __m128 double_ptr_storage; 10 | #elif defined(_WIN32) && !defined(__GNUC__) 11 | typedef unsigned __int64 double_ptr_storage; 12 | #else 13 | typedef unsigned long long double_ptr_storage; 14 | #endif 15 | 16 | # define AO_HAVE_DOUBLE_PTR_STORAGE 17 | 18 | typedef union { 19 | double_ptr_storage AO_whole; 20 | struct {AO_t AO_v1; AO_t AO_v2;} AO_parts; 21 | } AO_double_t; 22 | 23 | #define AO_HAVE_double_t 24 | #define AO_val1 AO_parts.AO_v1 25 | #define AO_val2 AO_parts.AO_v2 26 | -------------------------------------------------------------------------------- /singleThread/RNTree/atomic_ops/test_and_set_t_is_ao_t.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * These are common definitions for architectures on which test_and_set 25 | * operates on pointer-sized quantities, the "clear" value contains 26 | * all zeroes, and the "set" value contains only one lowest bit set. 27 | * This can be used if test_and_set is synthesized from compare_and_swap. 28 | */ 29 | typedef enum {AO_TS_clear = 0, AO_TS_set = 1} AO_TS_val; 30 | #define AO_TS_VAL_t AO_TS_val 31 | #define AO_TS_CLEAR AO_TS_clear 32 | #define AO_TS_SET AO_TS_set 33 | 34 | #define AO_TS_t AO_t 35 | 36 | #define AO_AO_TS_T 1 37 | -------------------------------------------------------------------------------- /singleThread/RNTree/atomic_ops/test_and_set_t_is_char.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Hewlett-Packard Development Company, L.P. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | * SOFTWARE. 21 | */ 22 | 23 | /* 24 | * These are common definitions for architectures on which test_and_set 25 | * operates on byte sized quantities, the "clear" value contains 26 | * all zeroes, and the "set" value contains all ones. 27 | */ 28 | 29 | #define AO_TS_t unsigned char 30 | typedef enum {AO_BYTE_TS_clear = 0, AO_BYTE_TS_set = 0xff} AO_BYTE_TS_val; 31 | #define AO_TS_VAL_t AO_BYTE_TS_val 32 | #define AO_TS_CLEAR AO_BYTE_TS_clear 33 | #define AO_TS_SET AO_BYTE_TS_set 34 | 35 | #define AO_CHAR_TS_T 1 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_C.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/singleThread/RNTree/build/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_C.bin -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_CXX.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/singleThread/RNTree/build/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_CXX.bin -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/3.10.2/CMakeSystem.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_HOST_SYSTEM "Linux-4.15.0-106-generic") 2 | set(CMAKE_HOST_SYSTEM_NAME "Linux") 3 | set(CMAKE_HOST_SYSTEM_VERSION "4.15.0-106-generic") 4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") 5 | 6 | 7 | 8 | set(CMAKE_SYSTEM "Linux-4.15.0-106-generic") 9 | set(CMAKE_SYSTEM_NAME "Linux") 10 | set(CMAKE_SYSTEM_VERSION "4.15.0-106-generic") 11 | set(CMAKE_SYSTEM_PROCESSOR "x86_64") 12 | 13 | set(CMAKE_CROSSCOMPILING "FALSE") 14 | 15 | set(CMAKE_SYSTEM_LOADED 1) 16 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/CMakeDirectoryInformation.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | # Relative path conversion top directories. 5 | set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/fkd/CPTree-202006/singleThread/RNTree") 6 | set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/fkd/CPTree-202006/singleThread/RNTree/build") 7 | 8 | # Force unix paths in dependencies. 9 | set(CMAKE_FORCE_UNIX_PATHS 1) 10 | 11 | 12 | # The C and CXX include file regular expressions for this directory. 13 | set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") 14 | set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") 15 | set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) 16 | set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) 17 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/cmake.check_cache: -------------------------------------------------------------------------------- 1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file 2 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/feature_tests.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thustorage/nvm-datastructure/c57b27f92baf9737e291b29378090da8feb166ce/singleThread/RNTree/build/CMakeFiles/feature_tests.bin -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/feature_tests.c: -------------------------------------------------------------------------------- 1 | 2 | const char features[] = {"\n" 3 | "C_FEATURE:" 4 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 5 | "1" 6 | #else 7 | "0" 8 | #endif 9 | "c_function_prototypes\n" 10 | "C_FEATURE:" 11 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 12 | "1" 13 | #else 14 | "0" 15 | #endif 16 | "c_restrict\n" 17 | "C_FEATURE:" 18 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L 19 | "1" 20 | #else 21 | "0" 22 | #endif 23 | "c_static_assert\n" 24 | "C_FEATURE:" 25 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 26 | "1" 27 | #else 28 | "0" 29 | #endif 30 | "c_variadic_macros\n" 31 | 32 | }; 33 | 34 | int main(int argc, char** argv) { (void)argv; return features[argc]; } 35 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/fptree_main.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | "CXX" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | set(CMAKE_DEPENDS_CHECK_CXX 7 | "/home/fkd/CPTree-202006/singleThread/RNTree/src/nvm_mgr.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/fptree_main.dir/src/nvm_mgr.o" 8 | "/home/fkd/CPTree-202006/singleThread/RNTree/src/threadinfo.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/fptree_main.dir/src/threadinfo.o" 9 | "/home/fkd/CPTree-202006/singleThread/RNTree/src/util.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/fptree_main.dir/src/util.o" 10 | "/home/fkd/CPTree-202006/singleThread/RNTree/test/fptree_main.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/fptree_main.dir/test/fptree_main.o" 11 | ) 12 | set(CMAKE_CXX_COMPILER_ID "GNU") 13 | 14 | # The include file search paths: 15 | set(CMAKE_CXX_TARGET_INCLUDE_PATH 16 | "../third-party-lib" 17 | "../include" 18 | "../test" 19 | "../atomic_ops" 20 | ) 21 | 22 | # Targets to which this target links. 23 | set(CMAKE_TARGET_LINKED_INFO_FILES 24 | ) 25 | 26 | # Fortran module output directory. 27 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 28 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/fptree_main.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/fptree_main.dir/test/fptree_main.o" 3 | "CMakeFiles/fptree_main.dir/src/util.o" 4 | "CMakeFiles/fptree_main.dir/src/threadinfo.o" 5 | "CMakeFiles/fptree_main.dir/src/nvm_mgr.o" 6 | "fptree_main.pdb" 7 | "fptree_main" 8 | ) 9 | 10 | # Per-language clean rules from dependency scanning. 11 | foreach(lang CXX) 12 | include(CMakeFiles/fptree_main.dir/cmake_clean_${lang}.cmake OPTIONAL) 13 | endforeach() 14 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/fptree_main.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | # compile CXX with /usr/bin/c++ 5 | CXX_FLAGS = -O3 -g -std=c++11 -DNDEBUG -DMUTEX -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -lpthread -mrtm 6 | 7 | CXX_DEFINES = 8 | 9 | CXX_INCLUDES = -I/home/fkd/CPTree-202006/singleThread/RNTree/third-party-lib -I/home/fkd/CPTree-202006/singleThread/RNTree/include -I/home/fkd/CPTree-202006/singleThread/RNTree/test -I/home/fkd/CPTree-202006/singleThread/RNTree/atomic_ops 10 | 11 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/fptree_main.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 1 2 | CMAKE_PROGRESS_2 = 2 3 | CMAKE_PROGRESS_3 = 3 4 | CMAKE_PROGRESS_4 = 4 5 | CMAKE_PROGRESS_5 = 5 6 | 7 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/main-gu-zipfian.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | "CXX" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | set(CMAKE_DEPENDS_CHECK_CXX 7 | "/home/fkd/CPTree-202006/singleThread/RNTree/src/nvm_mgr.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/main-gu-zipfian.dir/src/nvm_mgr.o" 8 | "/home/fkd/CPTree-202006/singleThread/RNTree/src/threadinfo.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/main-gu-zipfian.dir/src/threadinfo.o" 9 | "/home/fkd/CPTree-202006/singleThread/RNTree/src/util.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/main-gu-zipfian.dir/src/util.o" 10 | "/home/fkd/CPTree-202006/singleThread/RNTree/test/main-gu-zipfian.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/main-gu-zipfian.dir/test/main-gu-zipfian.o" 11 | ) 12 | set(CMAKE_CXX_COMPILER_ID "GNU") 13 | 14 | # The include file search paths: 15 | set(CMAKE_CXX_TARGET_INCLUDE_PATH 16 | "../third-party-lib" 17 | "../include" 18 | "../test" 19 | "../atomic_ops" 20 | ) 21 | 22 | # Targets to which this target links. 23 | set(CMAKE_TARGET_LINKED_INFO_FILES 24 | ) 25 | 26 | # Fortran module output directory. 27 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 28 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/main-gu-zipfian.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/main-gu-zipfian.dir/test/main-gu-zipfian.o" 3 | "CMakeFiles/main-gu-zipfian.dir/src/util.o" 4 | "CMakeFiles/main-gu-zipfian.dir/src/threadinfo.o" 5 | "CMakeFiles/main-gu-zipfian.dir/src/nvm_mgr.o" 6 | "main-gu-zipfian.pdb" 7 | "main-gu-zipfian" 8 | ) 9 | 10 | # Per-language clean rules from dependency scanning. 11 | foreach(lang CXX) 12 | include(CMakeFiles/main-gu-zipfian.dir/cmake_clean_${lang}.cmake OPTIONAL) 13 | endforeach() 14 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/main-gu-zipfian.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | # compile CXX with /usr/bin/c++ 5 | CXX_FLAGS = -O3 -std=c++11 -DNDEBUG -DMUTEX -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -lpthread -mrtm 6 | 7 | CXX_DEFINES = 8 | 9 | CXX_INCLUDES = -I/home/fkd/CPTree-202006/singleThread/RNTree/third-party-lib -I/home/fkd/CPTree-202006/singleThread/RNTree/include -I/home/fkd/CPTree-202006/singleThread/RNTree/test -I/home/fkd/CPTree-202006/singleThread/RNTree/atomic_ops 10 | 11 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/main-gu-zipfian.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 6 2 | CMAKE_PROGRESS_2 = 7 3 | CMAKE_PROGRESS_3 = 8 4 | CMAKE_PROGRESS_4 = 9 5 | CMAKE_PROGRESS_5 = 10 6 | 7 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/nvtree_main.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | "CXX" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | set(CMAKE_DEPENDS_CHECK_CXX 7 | "/home/fkd/CPTree-202006/singleThread/RNTree/src/nvm_mgr.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/nvtree_main.dir/src/nvm_mgr.o" 8 | "/home/fkd/CPTree-202006/singleThread/RNTree/src/threadinfo.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/nvtree_main.dir/src/threadinfo.o" 9 | "/home/fkd/CPTree-202006/singleThread/RNTree/src/util.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/nvtree_main.dir/src/util.o" 10 | "/home/fkd/CPTree-202006/singleThread/RNTree/test/nvtree_main.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/nvtree_main.dir/test/nvtree_main.o" 11 | ) 12 | set(CMAKE_CXX_COMPILER_ID "GNU") 13 | 14 | # The include file search paths: 15 | set(CMAKE_CXX_TARGET_INCLUDE_PATH 16 | "../third-party-lib" 17 | "../include" 18 | "../test" 19 | "../atomic_ops" 20 | ) 21 | 22 | # Targets to which this target links. 23 | set(CMAKE_TARGET_LINKED_INFO_FILES 24 | ) 25 | 26 | # Fortran module output directory. 27 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 28 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/nvtree_main.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/nvtree_main.dir/test/nvtree_main.o" 3 | "CMakeFiles/nvtree_main.dir/src/util.o" 4 | "CMakeFiles/nvtree_main.dir/src/threadinfo.o" 5 | "CMakeFiles/nvtree_main.dir/src/nvm_mgr.o" 6 | "nvtree_main.pdb" 7 | "nvtree_main" 8 | ) 9 | 10 | # Per-language clean rules from dependency scanning. 11 | foreach(lang CXX) 12 | include(CMakeFiles/nvtree_main.dir/cmake_clean_${lang}.cmake OPTIONAL) 13 | endforeach() 14 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/nvtree_main.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | # compile CXX with /usr/bin/c++ 5 | CXX_FLAGS = -O3 -g -std=c++11 -DNDEBUG -DMUTEX -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -lpthread -mrtm 6 | 7 | CXX_DEFINES = 8 | 9 | CXX_INCLUDES = -I/home/fkd/CPTree-202006/singleThread/RNTree/third-party-lib -I/home/fkd/CPTree-202006/singleThread/RNTree/include -I/home/fkd/CPTree-202006/singleThread/RNTree/test -I/home/fkd/CPTree-202006/singleThread/RNTree/atomic_ops 10 | 11 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/nvtree_main.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 6 2 | CMAKE_PROGRESS_2 = 7 3 | CMAKE_PROGRESS_3 = 8 4 | CMAKE_PROGRESS_4 = 9 5 | CMAKE_PROGRESS_5 = 10 6 | 7 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 15 2 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/wb+tree_main.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | "CXX" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | set(CMAKE_DEPENDS_CHECK_CXX 7 | "/home/fkd/CPTree-202006/singleThread/RNTree/src/nvm_mgr.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/wb+tree_main.dir/src/nvm_mgr.o" 8 | "/home/fkd/CPTree-202006/singleThread/RNTree/src/threadinfo.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/wb+tree_main.dir/src/threadinfo.o" 9 | "/home/fkd/CPTree-202006/singleThread/RNTree/src/util.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/wb+tree_main.dir/src/util.o" 10 | "/home/fkd/CPTree-202006/singleThread/RNTree/test/wb+tree_main.cpp" "/home/fkd/CPTree-202006/singleThread/RNTree/build/CMakeFiles/wb+tree_main.dir/test/wb+tree_main.o" 11 | ) 12 | set(CMAKE_CXX_COMPILER_ID "GNU") 13 | 14 | # The include file search paths: 15 | set(CMAKE_CXX_TARGET_INCLUDE_PATH 16 | "../third-party-lib" 17 | "../include" 18 | "../test" 19 | "../atomic_ops" 20 | ) 21 | 22 | # Targets to which this target links. 23 | set(CMAKE_TARGET_LINKED_INFO_FILES 24 | ) 25 | 26 | # Fortran module output directory. 27 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 28 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/wb+tree_main.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/wb+tree_main.dir/test/wb+tree_main.o" 3 | "CMakeFiles/wb+tree_main.dir/src/util.o" 4 | "CMakeFiles/wb+tree_main.dir/src/threadinfo.o" 5 | "CMakeFiles/wb+tree_main.dir/src/nvm_mgr.o" 6 | "wb+tree_main.pdb" 7 | "wb+tree_main" 8 | ) 9 | 10 | # Per-language clean rules from dependency scanning. 11 | foreach(lang CXX) 12 | include(CMakeFiles/wb+tree_main.dir/cmake_clean_${lang}.cmake OPTIONAL) 13 | endforeach() 14 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/wb+tree_main.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | # compile CXX with /usr/bin/c++ 5 | CXX_FLAGS = -O3 -g -std=c++11 -DNDEBUG -DMUTEX -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -lpthread -mrtm 6 | 7 | CXX_DEFINES = 8 | 9 | CXX_INCLUDES = -I/home/fkd/CPTree-202006/singleThread/RNTree/third-party-lib -I/home/fkd/CPTree-202006/singleThread/RNTree/include -I/home/fkd/CPTree-202006/singleThread/RNTree/test -I/home/fkd/CPTree-202006/singleThread/RNTree/atomic_ops 10 | 11 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/CMakeFiles/wb+tree_main.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 11 2 | CMAKE_PROGRESS_2 = 12 3 | CMAKE_PROGRESS_3 = 13 4 | CMAKE_PROGRESS_4 = 14 5 | CMAKE_PROGRESS_5 = 15 6 | 7 | -------------------------------------------------------------------------------- /singleThread/RNTree/build/cmake_install.cmake: -------------------------------------------------------------------------------- 1 | # Install script for directory: /home/fkd/CPTree-202006/singleThread/RNTree 2 | 3 | # Set the install prefix 4 | if(NOT DEFINED CMAKE_INSTALL_PREFIX) 5 | set(CMAKE_INSTALL_PREFIX "/usr/local") 6 | endif() 7 | string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") 8 | 9 | # Set the install configuration name. 10 | if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) 11 | if(BUILD_TYPE) 12 | string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" 13 | CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") 14 | else() 15 | set(CMAKE_INSTALL_CONFIG_NAME "") 16 | endif() 17 | message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") 18 | endif() 19 | 20 | # Set the component getting installed. 21 | if(NOT CMAKE_INSTALL_COMPONENT) 22 | if(COMPONENT) 23 | message(STATUS "Install component: \"${COMPONENT}\"") 24 | set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") 25 | else() 26 | set(CMAKE_INSTALL_COMPONENT) 27 | endif() 28 | endif() 29 | 30 | # Install shared libraries without execute permission? 31 | if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) 32 | set(CMAKE_INSTALL_SO_NO_EXE "1") 33 | endif() 34 | 35 | # Is this installation the result of a crosscompile? 36 | if(NOT DEFINED CMAKE_CROSSCOMPILING) 37 | set(CMAKE_CROSSCOMPILING "FALSE") 38 | endif() 39 | 40 | if(CMAKE_INSTALL_COMPONENT) 41 | set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") 42 | else() 43 | set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") 44 | endif() 45 | 46 | string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT 47 | "${CMAKE_INSTALL_MANIFEST_FILES}") 48 | file(WRITE "/home/fkd/CPTree-202006/singleThread/RNTree/build/${CMAKE_INSTALL_MANIFEST}" 49 | "${CMAKE_INSTALL_MANIFEST_CONTENT}") 50 | -------------------------------------------------------------------------------- /singleThread/RNTree/include/benchmarks.h: -------------------------------------------------------------------------------- 1 | #ifndef _BENCHMARKS_H_ 2 | #define _BENCHMARKS_H_ 3 | 4 | #include "microbench.h" 5 | #include "config.h" 6 | 7 | static Benchmark* getBenchmark(Config conf){ 8 | switch (conf.benchmark){ 9 | case READ_ONLY: 10 | return new ReadOnlyBench(conf); 11 | case INSERT_ONLY: 12 | return new InsertOnlyBench(conf); 13 | case UPDATE_ONLY: 14 | return new UpdateOnlyBench(conf); 15 | case DELETE_ONLY: 16 | return new DeleteOnlyBench(conf); 17 | case MIXED_BENCH: 18 | return new MixedBench(conf); 19 | case YCSB_A: 20 | return new YSCBA(conf); 21 | case YCSB_B: 22 | return new YSCBB(conf); 23 | case YCSB_C: 24 | return new YSCBC(conf); 25 | case YCSB_D: 26 | return new YSCBD(conf); 27 | case YCSB_E: 28 | return new YSCBE(conf); 29 | case SCAN_BENCH: 30 | return new ScanBench(conf); 31 | case RECOVERY_BENCH: 32 | return new UpdateOnlyBench(conf); 33 | default: 34 | printf("none support benchmark %d\n", conf.benchmark); 35 | exit(0); 36 | } 37 | return NULL; 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /singleThread/RNTree/include/index.h: -------------------------------------------------------------------------------- 1 | #ifndef index_h 2 | #define index_h 3 | 4 | #include "util.h" 5 | #include "timer.h" 6 | #include 7 | template 8 | class Index{ 9 | public: 10 | virtual ~Index(){} 11 | virtual bool insert(K a, V b) = 0; 12 | virtual bool remove(K a) = 0; 13 | virtual V get(K v, double t[3]) = 0; 14 | virtual bool update(K a, V b, double t[3]) = 0; 15 | virtual void scan(K key, bool (*function)(K key, V value)) = 0; 16 | virtual void rebuild(){ } 17 | bool time_on; 18 | }; 19 | 20 | //#define PERF_LATENCY 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /singleThread/RNTree/include/index_factory.h: -------------------------------------------------------------------------------- 1 | #ifndef index_factory 2 | #define index_factory 3 | 4 | #include "index.h" 5 | #include "config.h" 6 | #include "nv_tree.h" 7 | #include "rtm_tree.h" 8 | #include "rtm_tree_r.h" 9 | #include "wbtree.h" 10 | #include "wbtree2.h" 11 | #include "fptree.h" 12 | 13 | 14 | namespace nvindex{ 15 | 16 | template 17 | static Index* getIndex(IndexType type){ 18 | Index* btree = nullptr; 19 | switch (type){ 20 | case NV_TREE: 21 | btree = new NV_tree::Btree(); 22 | break; 23 | case FP_TREE: 24 | btree = new FP_tree::Btree(); 25 | break; 26 | case RN_TREE: 27 | btree = new RN_tree::Btree(); 28 | break; 29 | case RN_TREE_R: 30 | btree = new RN_treeR::Btree(); 31 | break; 32 | case WB_TREE: 33 | btree = new WBTREE::Btree(); 34 | break; 35 | case WB_TREE_2: 36 | btree = new WBTREE_2::Btree(); 37 | break; 38 | default: 39 | printf("unknown index type\n"); 40 | exit(-1); 41 | } 42 | return btree; 43 | } 44 | 45 | } // namespace nvindex 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /singleThread/RNTree/include/pmalloc_wrap.h: -------------------------------------------------------------------------------- 1 | #ifndef pmalloc_wrap_h 2 | #define pmalloc_wrap_h 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "nvm_mgr.h" 10 | //#define USE_NVM_MALLOC 11 | 12 | namespace nvindex{ 13 | 14 | class PMBlockAllocator{ 15 | int alignment = 64; 16 | NVMMgr* mgr; 17 | public: 18 | PMBlockAllocator(){ 19 | mgr = NULL; 20 | } 21 | 22 | void* alloc_block(int size){ 23 | #ifdef USE_NVM_MALLOC 24 | if (mgr == NULL){ 25 | mgr = get_nvm_mgr(); 26 | } 27 | return mgr->alloc_block((size+4095)/4096); 28 | #else 29 | return aligned_alloc(alignment, size); 30 | #endif // USE_NVM_MALLOC 31 | } 32 | 33 | void free_block(void* block){ 34 | assert(0); 35 | } 36 | }; 37 | 38 | } //nvindex 39 | #endif 40 | -------------------------------------------------------------------------------- /singleThread/RNTree/include/threadinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef thread_info_h 2 | #define thread_info_h 3 | #include 4 | 5 | const uint64_t SPACE_PER_THREAD = 680ULL * 1024ULL * 1024ULL * 1024ULL; 6 | const uint64_t SPACE_OF_MAIN_THREAD = 2ULL * 1024ULL * 1024ULL * 1024ULL; 7 | extern char *per_thread_start_addr; 8 | extern char *curr_addr; 9 | 10 | namespace nvindex{ 11 | /* 12 | * Persistent leaf management 13 | * NOTE: PMFreeList is not thread-safe, only used for ThreadInfo 14 | * 15 | * TODO: support leaf node recycling by add freed node to the free list. 16 | */ 17 | class PMFreeList{ 18 | void** pm_free_list; 19 | void* pm_block; 20 | int list_cursor; 21 | int list_capacity; 22 | int block_cursor; 23 | public: 24 | PMFreeList(); 25 | 26 | void* alloc_leaf(); 27 | void free_leaf(void* leaf); 28 | }; 29 | 30 | 31 | struct ThreadInfo{ 32 | int id; 33 | volatile int _lock; 34 | struct ThreadInfo* next; 35 | PMFreeList* pm_free_list; 36 | char padding[8]; 37 | char static_log[4072]; // 整个 ThreadInfo的长度为 4096,所以剩下的内存 4096-32 = 4064 都可以用来做 static log。 38 | } __attribute__((aligned(64))); 39 | 40 | 41 | void register_threadinfo(); 42 | void unregister_threadinfo(); 43 | 44 | void* alloc_leaf(); 45 | void set_leaf_size(int); 46 | 47 | void* static_leaf(); 48 | 49 | } // nvindex 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /singleThread/RNTree/include/timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "util.h" 6 | namespace nvindex{ 7 | 8 | class timer { 9 | public: 10 | 11 | timer() { 12 | total.tv_sec = total.tv_usec = 0; 13 | diff.tv_sec = diff.tv_usec = 0; 14 | } 15 | 16 | double duration() { 17 | double duration; 18 | 19 | duration = (total.tv_sec) * 1000000.0; // sec to us 20 | duration += (total.tv_usec); // us 21 | 22 | return duration*1000.0; //ns 23 | } 24 | 25 | void start() { 26 | gettimeofday(&t1, NULL); 27 | } 28 | 29 | void end() { 30 | gettimeofday(&t2, NULL); 31 | timersub(&t2, &t1, &diff); 32 | timeradd(&diff, &total, &total); 33 | } 34 | 35 | void reset(){ 36 | total.tv_sec = total.tv_usec = 0; 37 | diff.tv_sec = diff.tv_usec = 0; 38 | } 39 | 40 | timeval t1, t2, diff; 41 | timeval total; 42 | }; 43 | 44 | class cpuCycleTimer{ 45 | public: 46 | long long t1, t2, total; 47 | int count = 0; 48 | 49 | cpuCycleTimer(){ 50 | reset(); 51 | } 52 | void start(){ 53 | t1 = rdtsc(); 54 | } 55 | void end(){ 56 | t2 = rdtsc(); 57 | total += t2 - t1; 58 | count++; 59 | } 60 | void reset(){ 61 | count=t1=t2=total=0; 62 | } 63 | double duration(){ // ns 64 | return total/CPU_FREQUENCY; 65 | } 66 | 67 | }; 68 | 69 | } //nvindex 70 | -------------------------------------------------------------------------------- /singleThread/RNTree/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #numactl --physcpubind=0 ./build/fptree_main #> result_fptree.txt 4 | numactl --physcpubind=0 ./build/nvtree_main #> result_nvtree.txt 5 | #numactl --physcpubind=0 ./build/wb+tree_main #> result_wb+tree.txt 6 | -------------------------------------------------------------------------------- /singleThread/RNTree/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "coordinator.h" 2 | #include "rtm_tree.h" 3 | #include "nv_tree.h" 4 | #include "fptree.h" 5 | #include "config.h" 6 | #include 7 | 8 | using namespace std; 9 | int main(int argc, char** argv){ 10 | Config conf; 11 | parse_arguments(argc, argv, conf); 12 | 13 | nvindex::Coordinator coordinator(conf); 14 | coordinator.run(); 15 | } 16 | -------------------------------------------------------------------------------- /singleThread/RNTree/src/recover_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "rtm_tree.h" 5 | #include "util.h" 6 | #include "coordinator.h" 7 | 8 | 9 | int main(int argc, char **argv) 10 | { 11 | using namespace nvindex; 12 | 13 | int test_mode = 0; 14 | if (argc > 1) 15 | test_mode = atoi(argv[1]); 16 | 17 | unsigned short seeds[3] = {0, 0, 0}; 18 | RandomGenerator rdm; 19 | rdm.setSeed(seeds); 20 | 21 | const int test_size = 10000; 22 | RN_tree::Btree btree; 23 | 24 | register_threadinfo(); 25 | if (test_mode == 0){ 26 | for (int i = 0; i < test_size; i++) 27 | { 28 | int d = rdm.Next() % test_size; 29 | btree.insert(d, d + 1); 30 | } 31 | printf("insert successfully..\n"); 32 | }else{ 33 | double time_breaks[3]; 34 | for (int i = 0; i < test_size; i++){ 35 | int d = rdm.Next() % test_size; 36 | long long r = btree.get(d, time_breaks); 37 | assert(r == d+1); 38 | } 39 | printf("check successfully..\n"); 40 | } 41 | 42 | unregister_threadinfo(); 43 | } 44 | -------------------------------------------------------------------------------- /singleThread/RNTree/third-party-lib/tbb/aligned_space.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2017 Intel Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | 17 | 18 | 19 | */ 20 | 21 | #ifndef __TBB_aligned_space_H 22 | #define __TBB_aligned_space_H 23 | 24 | #include "tbb_stddef.h" 25 | #include "tbb_machine.h" 26 | 27 | namespace tbb { 28 | 29 | //! Block of space aligned sufficiently to construct an array T with N elements. 30 | /** The elements are not constructed or destroyed by this class. 31 | @ingroup memory_allocation */ 32 | template 33 | class aligned_space { 34 | private: 35 | typedef __TBB_TypeWithAlignmentAtLeastAsStrict(T) element_type; 36 | element_type array[(sizeof(T)*N+sizeof(element_type)-1)/sizeof(element_type)]; 37 | public: 38 | //! Pointer to beginning of array 39 | T* begin() const {return internal::punned_cast(this);} 40 | 41 | //! Pointer to one past last element in array. 42 | T* end() const {return begin()+N;} 43 | }; 44 | 45 | } // namespace tbb 46 | 47 | #endif /* __TBB_aligned_space_H */ 48 | -------------------------------------------------------------------------------- /singleThread/RNTree/third-party-lib/tbb/compat/thread: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2017 Intel Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | 17 | 18 | 19 | */ 20 | 21 | #ifndef __TBB_thread_H 22 | #define __TBB_thread_H 23 | 24 | #include "../tbb_config.h" 25 | 26 | #if TBB_IMPLEMENT_CPP0X 27 | 28 | #include "../tbb_thread.h" 29 | 30 | namespace std { 31 | 32 | typedef tbb::tbb_thread thread; 33 | 34 | namespace this_thread { 35 | using tbb::this_tbb_thread::get_id; 36 | using tbb::this_tbb_thread::yield; 37 | 38 | inline void sleep_for(const tbb::tick_count::interval_t& rel_time) { 39 | tbb::internal::thread_sleep_v3( rel_time ); 40 | } 41 | } 42 | 43 | } // namespace std 44 | 45 | #else /* TBB_IMPLEMENT_CPP0X */ 46 | 47 | #define __TBB_COMPAT_THREAD_RECURSION_PROTECTOR 1 48 | #include 49 | #undef __TBB_COMPAT_THREAD_RECURSION_PROTECTOR 50 | 51 | #endif /* TBB_IMPLEMENT_CPP0X */ 52 | 53 | #else /* __TBB_thread_H */ 54 | 55 | #if __TBB_COMPAT_THREAD_RECURSION_PROTECTOR 56 | #error The tbb/compat/thread header attempts to include itself. \ 57 | Please make sure that {TBBROOT}/include/tbb/compat is NOT in include paths. 58 | #endif 59 | 60 | #endif /* __TBB_thread_H */ 61 | -------------------------------------------------------------------------------- /singleThread/RNTree/third-party-lib/tbb/flow_graph_abstractions.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2017 Intel Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | 17 | 18 | 19 | */ 20 | 21 | #ifndef __TBB_flow_graph_abstractions_H 22 | #define __TBB_flow_graph_abstractions_H 23 | 24 | namespace tbb { 25 | namespace flow { 26 | namespace interface10 { 27 | 28 | //! Pure virtual template classes that define interfaces for async communication 29 | class graph_proxy { 30 | public: 31 | //! Inform a graph that messages may come from outside, to prevent premature graph completion 32 | virtual void reserve_wait() = 0; 33 | 34 | //! Inform a graph that a previous call to reserve_wait is no longer in effect 35 | virtual void release_wait() = 0; 36 | 37 | virtual ~graph_proxy() {} 38 | }; 39 | 40 | template 41 | class receiver_gateway : public graph_proxy { 42 | public: 43 | //! Type of inputing data into FG. 44 | typedef Input input_type; 45 | 46 | //! Submit signal from an asynchronous activity to FG. 47 | virtual bool try_put(const input_type&) = 0; 48 | }; 49 | 50 | } //interfaceX 51 | 52 | using interface10::graph_proxy; 53 | using interface10::receiver_gateway; 54 | 55 | } //flow 56 | } //tbb 57 | #endif 58 | -------------------------------------------------------------------------------- /singleThread/RNTree/third-party-lib/tbb/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

Overview

5 | Include files for Intel® Threading Building Blocks classes and functions. 6 | 7 |
Click here to see all files in the directory. 8 | 9 |

Directories

10 |
11 |
compat 12 |
Include files for source level compatibility with other frameworks. 13 |
internal 14 |
Include files with implementation details; not for direct use. 15 |
machine 16 |
Include files for low-level architecture specific functionality; not for direct use. 17 |
18 | 19 |
20 | Up to parent directory 21 |

22 | Copyright © 2005-2017 Intel Corporation. All Rights Reserved. 23 |

24 | Intel is a registered trademark or trademark of Intel Corporation 25 | or its subsidiaries in the United States and other countries. 26 |

27 | * Other names and brands may be claimed as the property of others. 28 | 29 | 30 | -------------------------------------------------------------------------------- /singleThread/RNTree/third-party-lib/tbb/null_mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2017 Intel Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | 17 | 18 | 19 | */ 20 | 21 | #ifndef __TBB_null_mutex_H 22 | #define __TBB_null_mutex_H 23 | 24 | #include "tbb_stddef.h" 25 | 26 | namespace tbb { 27 | 28 | //! A mutex which does nothing 29 | /** A null_mutex does no operation and simulates success. 30 | @ingroup synchronization */ 31 | class null_mutex : internal::mutex_copy_deprecated_and_disabled { 32 | public: 33 | //! Represents acquisition of a mutex. 34 | class scoped_lock : internal::no_copy { 35 | public: 36 | scoped_lock() {} 37 | scoped_lock( null_mutex& ) {} 38 | ~scoped_lock() {} 39 | void acquire( null_mutex& ) {} 40 | bool try_acquire( null_mutex& ) { return true; } 41 | void release() {} 42 | }; 43 | 44 | null_mutex() {} 45 | 46 | // Mutex traits 47 | static const bool is_rw_mutex = false; 48 | static const bool is_recursive_mutex = true; 49 | static const bool is_fair_mutex = true; 50 | }; 51 | 52 | } 53 | 54 | #endif /* __TBB_null_mutex_H */ 55 | -------------------------------------------------------------------------------- /singleThread/RNTree/third-party-lib/tbb/null_rw_mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2017 Intel Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | 17 | 18 | 19 | */ 20 | 21 | #ifndef __TBB_null_rw_mutex_H 22 | #define __TBB_null_rw_mutex_H 23 | 24 | #include "tbb_stddef.h" 25 | 26 | namespace tbb { 27 | 28 | //! A rw mutex which does nothing 29 | /** A null_rw_mutex is a rw mutex that does nothing and simulates successful operation. 30 | @ingroup synchronization */ 31 | class null_rw_mutex : internal::mutex_copy_deprecated_and_disabled { 32 | public: 33 | //! Represents acquisition of a mutex. 34 | class scoped_lock : internal::no_copy { 35 | public: 36 | scoped_lock() {} 37 | scoped_lock( null_rw_mutex& , bool = true ) {} 38 | ~scoped_lock() {} 39 | void acquire( null_rw_mutex& , bool = true ) {} 40 | bool upgrade_to_writer() { return true; } 41 | bool downgrade_to_reader() { return true; } 42 | bool try_acquire( null_rw_mutex& , bool = true ) { return true; } 43 | void release() {} 44 | }; 45 | 46 | null_rw_mutex() {} 47 | 48 | // Mutex traits 49 | static const bool is_rw_mutex = true; 50 | static const bool is_recursive_mutex = true; 51 | static const bool is_fair_mutex = true; 52 | }; 53 | 54 | } 55 | 56 | #endif /* __TBB_null_rw_mutex_H */ 57 | -------------------------------------------------------------------------------- /singleThread/RNTree/third-party-lib/tbb/tbb_disable_exceptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2005-2017 Intel Corporation 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | 17 | 18 | 19 | */ 20 | 21 | //! To disable use of exceptions, include this header before any other header file from the library. 22 | 23 | //! The macro that prevents use of exceptions in the library files 24 | #undef TBB_USE_EXCEPTIONS 25 | #define TBB_USE_EXCEPTIONS 0 26 | 27 | //! Prevent compilers from issuing exception related warnings. 28 | /** Note that the warnings are suppressed for all the code after this header is included. */ 29 | #if _MSC_VER 30 | #if __INTEL_COMPILER 31 | #pragma warning (disable: 583) 32 | #else 33 | #pragma warning (disable: 4530 4577) 34 | #endif 35 | #endif 36 | -------------------------------------------------------------------------------- /singleThread/fast_fair/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | g++ -O3 -DNDEBUG -std=c++11 -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -o ./main main.cpp -lpmemobj -lpmem -lprofiler 4 | -------------------------------------------------------------------------------- /singleThread/fast_fair/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | numactl --cpunodebind=1 ./main 4 | -------------------------------------------------------------------------------- /singleThread/nv-skiplist/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | g++ -O3 -DNDEBUG -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -o ./main main.cpp -lpmemobj -lpmem -lprofiler 4 | -------------------------------------------------------------------------------- /singleThread/nv-skiplist/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | numactl --cpunodebind=1 ./main.cpp -------------------------------------------------------------------------------- /singleThread/uTree/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | g++ -O3 -march=native -std=c++11 -DNDEBUG -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -o ./main ./main.cpp -lprofiler 4 | -------------------------------------------------------------------------------- /singleThread/uTree/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | numactl --physcpubind=0 ./main 4 | -------------------------------------------------------------------------------- /singleThread/wb+tree/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | g++ -O3 -DNDEBUG -m64 -D_REENTRANT -fno-strict-aliasing -DINTEL -Wno-unused-value -Wno-format -o ./main main.cpp -lpmemobj -lpmem -lprofiler 4 | -------------------------------------------------------------------------------- /singleThread/wb+tree/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | numactl --cpunodebind=1 ./main --------------------------------------------------------------------------------