├── masstree ├── masstree_btree.cc ├── AUTHORS ├── CMakeLists.txt ├── kvproto.hh ├── kvstats.hh ├── mtcounters.hh ├── LICENSE ├── timestamp.hh ├── compiler.cc ├── str.cc └── GNUmakefile.in ├── third-party ├── sparsehash │ └── src │ │ ├── stamp-h1 │ │ ├── config.h.include │ │ ├── sparsehash │ │ └── internal │ │ │ └── sparseconfig.h │ │ ├── windows │ │ ├── google │ │ │ └── sparsehash │ │ │ │ └── sparseconfig.h │ │ ├── sparsehash │ │ │ └── internal │ │ │ │ └── sparseconfig.h │ │ └── port.cc │ │ └── google │ │ ├── sparsetable │ │ ├── dense_hash_map │ │ ├── dense_hash_set │ │ ├── sparse_hash_map │ │ ├── sparse_hash_set │ │ ├── template_util.h │ │ ├── type_traits.h │ │ └── sparsehash │ │ ├── densehashtable.h │ │ ├── sparsehashtable.h │ │ ├── hashtable-common.h │ │ └── libc_allocator_with_realloc.h ├── glog │ └── lib │ │ ├── libglog.a │ │ ├── libglog.so │ │ ├── libglog.so.0 │ │ └── libglog.so.0.3.5 └── gflags │ ├── lib │ ├── libgflags.a │ ├── libgflags.so │ ├── libgflags.so.2.2 │ ├── libgflags.so.2.2.2 │ ├── libgflags_nothreads.a │ ├── libgflags_nothreads.so │ ├── libgflags_nothreads.so.2.2 │ └── libgflags_nothreads.so.2.2.2 │ └── include │ └── gflags │ └── defines.h ├── dbcore ├── .gitignore ├── sm-coroutine.cpp ├── mcs_lock.cpp ├── tests │ ├── CMakeLists.txt │ ├── test-xid.cpp │ ├── test-epoch.cpp │ ├── test-dynarray.cpp │ ├── test-cslist.cpp │ ├── test-window-buffer.cpp │ └── test-size-encode.cpp ├── stopwatch.h ├── sm-exceptions.cpp ├── sm-rc.h ├── CMakeLists.txt ├── sm-common.cpp ├── burt-hash.h ├── size-encode.h └── dlog-defs.h ├── benchmarks ├── record │ └── CMakeLists.txt ├── egen │ ├── flat │ │ └── egen_flat_in │ │ │ ├── StatusType.txt │ │ │ ├── TradeType.txt │ │ │ ├── Charge.txt │ │ │ ├── NonTaxableAccountName.txt │ │ │ ├── StreetSuffix.txt │ │ │ ├── Sector.txt │ │ │ ├── TaxableAccountName.txt │ │ │ ├── Exchange.txt │ │ │ ├── CompanySPRate.txt │ │ │ └── TaxRatesCountry.txt │ ├── CMakeLists.txt │ ├── NullLoad_stdafx.h │ ├── EGenBaseLoader_stdafx.h │ ├── ReadRowFunctions.cpp │ ├── unusedflag.h │ ├── EGenNullLoader_stdafx.h │ ├── FlatFileLoad_common.h │ ├── SecurityPriceRange.h │ ├── progressmeterinterface.cpp │ ├── DriverTypes.h │ ├── MEETradeRequestActions.h │ ├── TxnHarnessTradeCleanup.h │ ├── EGenGenerateAndLoad_stdafx.h │ ├── TxnHarnessDataMaintenance.h │ ├── EGenTables_common.h │ ├── TradeTypeIDs.h │ ├── error.cpp │ ├── locking.h │ ├── SyncLockInterface.h │ ├── progressmeterinterface.h │ ├── FlatSectorLoad.h │ ├── EGenError.h │ ├── FlatNewsXRefLoad.h │ ├── FlatWatchListLoad.h │ ├── FlatWatchItemLoad.h │ ├── FlatChargeLoad.h │ ├── FlatStatusTypeLoad.h │ ├── FlatTaxrateLoad.h │ ├── FlatZipCodeLoad.h │ ├── FlatIndustryLoad.h │ ├── Wheel.h │ ├── FlatCustomerTaxrateLoad.h │ ├── FlatHoldingSummaryLoad.h │ ├── Money.cpp │ ├── FlatBrokerLoad.h │ ├── strutil.h │ ├── SectorTable.h │ ├── threading.cpp │ ├── FlatAddressLoad.h │ └── IndustryTable.h ├── CMakeLists.txt ├── run-microbench.sh ├── oddlb-schemas.h └── run.sh ├── tests ├── CMakeLists.txt ├── coroutine │ ├── test_main.cpp │ ├── CMakeLists.txt │ ├── suspend_order.cpp │ ├── resume_order.cpp │ ├── return_complex_type.cpp │ └── coroutine_test_base.h ├── dlog │ ├── CMakeLists.txt │ └── test_dlog.cpp └── masstree │ ├── test_main.cpp │ ├── record.h │ └── gbench_main.cpp ├── tuple.cc ├── .gitmodules ├── .gitignore ├── catalog_mgr.h ├── macros.h ├── LICENSE └── str_arena.h /masstree/masstree_btree.cc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/stamp-h1: -------------------------------------------------------------------------------- 1 | timestamp for src/config.h 2 | -------------------------------------------------------------------------------- /dbcore/.gitignore: -------------------------------------------------------------------------------- 1 | ; automatically generating files 2 | burt-hash.cpp 3 | -------------------------------------------------------------------------------- /benchmarks/record/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set_property(GLOBAL APPEND PROPERTY ALL_SRC 2 | ) 3 | -------------------------------------------------------------------------------- /third-party/glog/lib/libglog.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfu-dis/tesseract/HEAD/third-party/glog/lib/libglog.a -------------------------------------------------------------------------------- /third-party/glog/lib/libglog.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfu-dis/tesseract/HEAD/third-party/glog/lib/libglog.so -------------------------------------------------------------------------------- /third-party/gflags/lib/libgflags.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfu-dis/tesseract/HEAD/third-party/gflags/lib/libgflags.a -------------------------------------------------------------------------------- /third-party/gflags/lib/libgflags.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfu-dis/tesseract/HEAD/third-party/gflags/lib/libgflags.so -------------------------------------------------------------------------------- /third-party/glog/lib/libglog.so.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfu-dis/tesseract/HEAD/third-party/glog/lib/libglog.so.0 -------------------------------------------------------------------------------- /third-party/glog/lib/libglog.so.0.3.5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfu-dis/tesseract/HEAD/third-party/glog/lib/libglog.so.0.3.5 -------------------------------------------------------------------------------- /third-party/gflags/lib/libgflags.so.2.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfu-dis/tesseract/HEAD/third-party/gflags/lib/libgflags.so.2.2 -------------------------------------------------------------------------------- /benchmarks/egen/flat/egen_flat_in/StatusType.txt: -------------------------------------------------------------------------------- 1 | CMPT Completed 2 | ACTV Active 3 | SBMT Submitted 4 | PNDG Pending 5 | CNCL Canceled 6 | -------------------------------------------------------------------------------- /third-party/gflags/lib/libgflags.so.2.2.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfu-dis/tesseract/HEAD/third-party/gflags/lib/libgflags.so.2.2.2 -------------------------------------------------------------------------------- /third-party/gflags/lib/libgflags_nothreads.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfu-dis/tesseract/HEAD/third-party/gflags/lib/libgflags_nothreads.a -------------------------------------------------------------------------------- /third-party/gflags/lib/libgflags_nothreads.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfu-dis/tesseract/HEAD/third-party/gflags/lib/libgflags_nothreads.so -------------------------------------------------------------------------------- /masstree/AUTHORS: -------------------------------------------------------------------------------- 1 | Eddie Kohler 2 | kohler@seas.harvard.edu 3 | 4 | Yandong Mao 5 | ydmao@csail.mit.edu 6 | 7 | Robert Morris 8 | rtm@csail.mit.edu 9 | -------------------------------------------------------------------------------- /third-party/gflags/lib/libgflags_nothreads.so.2.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfu-dis/tesseract/HEAD/third-party/gflags/lib/libgflags_nothreads.so.2.2 -------------------------------------------------------------------------------- /third-party/gflags/lib/libgflags_nothreads.so.2.2.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sfu-dis/tesseract/HEAD/third-party/gflags/lib/libgflags_nothreads.so.2.2.2 -------------------------------------------------------------------------------- /benchmarks/egen/flat/egen_flat_in/TradeType.txt: -------------------------------------------------------------------------------- 1 | TMB Market-Buy 0 1 2 | TMS Market-Sell 1 1 3 | TSL Stop-Loss 1 0 4 | TLS Limit-Sell 1 0 5 | TLB Limit-Buy 0 0 6 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) 2 | 3 | #add_subdirectory(coroutine) 4 | add_subdirectory(dlog) 5 | #add_subdirectory(masstree) 6 | -------------------------------------------------------------------------------- /tests/coroutine/test_main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char **argv) { 4 | ::testing::InitGoogleTest(&argc, argv); 5 | return RUN_ALL_TESTS(); 6 | } 7 | -------------------------------------------------------------------------------- /dbcore/sm-coroutine.cpp: -------------------------------------------------------------------------------- 1 | #include "sm-coroutine.h" 2 | 3 | namespace ermia { 4 | namespace coro { 5 | 6 | thread_local tcalloc coroutine_allocator; 7 | 8 | } // namespace coro 9 | } // namespace ermia 10 | -------------------------------------------------------------------------------- /tests/dlog/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(DLOG_TEST_SRCS 2 | ${CMAKE_SOURCE_DIR}/dbcore/dlog.cpp 3 | test_dlog.cpp 4 | ) 5 | 6 | add_executable(test_dlog ${DLOG_TEST_SRCS}) 7 | target_link_libraries(test_dlog) 8 | 9 | -------------------------------------------------------------------------------- /benchmarks/egen/flat/egen_flat_in/Charge.txt: -------------------------------------------------------------------------------- 1 | TMB 1 5 2 | TMB 2 4.5 3 | TMB 3 2.5 4 | TMS 1 5 5 | TMS 2 4.5 6 | TMS 3 2.5 7 | TSL 1 6.5 8 | TSL 2 5.5 9 | TSL 3 3.5 10 | TLS 1 6 11 | TLS 2 5 12 | TLS 3 3 13 | TLB 1 6 14 | TLB 2 5 15 | TLB 3 3 16 | -------------------------------------------------------------------------------- /benchmarks/egen/flat/egen_flat_in/NonTaxableAccountName.txt: -------------------------------------------------------------------------------- 1 | Traditional IRA 2 | Roth IRA 3 | IRA-SEP 4 | 401(k) 5 | Pension Account 6 | Rollover IRA 7 | Retirement Fund 8 | Roth 401(K) 9 | Flexible Spending 10 | Health Savings 11 | Non-Taxable Trust 12 | -------------------------------------------------------------------------------- /benchmarks/egen/flat/egen_flat_in/StreetSuffix.txt: -------------------------------------------------------------------------------- 1 | 1 Street 2 | 1 Road 3 | 1 Court 4 | 1 Boulevard 5 | 1 Way 6 | 1 Lane 7 | 1 Crescent 8 | 1 Park 9 | 1 Avenue 10 | 1 Rue 11 | 1 Drive 12 | 1 South 13 | 1 North 14 | 1 West 15 | 1 East 16 | 1 Upper 17 | 1 Lower 18 | -------------------------------------------------------------------------------- /benchmarks/egen/flat/egen_flat_in/Sector.txt: -------------------------------------------------------------------------------- 1 | BM Basic Materials 2 | CG Capital Goods 3 | CO Conglomerates 4 | CC Consumer Cyclical 5 | CN Consumer Non-Cyclical 6 | EN Energy 7 | FN Financial 8 | HC Healthcare 9 | SV Services 10 | TC Technology 11 | TR Transportation 12 | UT Utilities 13 | -------------------------------------------------------------------------------- /masstree/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set_property(GLOBAL APPEND PROPERTY ALL_SRC 2 | ${CMAKE_CURRENT_SOURCE_DIR}/masstree_btree.cc 3 | ${CMAKE_CURRENT_SOURCE_DIR}/compiler.cc 4 | ${CMAKE_CURRENT_SOURCE_DIR}/straccum.cc 5 | ${CMAKE_CURRENT_SOURCE_DIR}/str.cc 6 | ${CMAKE_CURRENT_SOURCE_DIR}/string.cc 7 | ) 8 | -------------------------------------------------------------------------------- /benchmarks/egen/flat/egen_flat_in/TaxableAccountName.txt: -------------------------------------------------------------------------------- 1 | Emergency Expenses 2 | Vacation Account 3 | Healthcare Fund 4 | New Car Account 5 | House Money 6 | Individual Account 7 | Family Trust 8 | Custodial Account 9 | Joint Account 10 | Business Account 11 | College Fund 12 | Savings Account 13 | Play Money 14 | -------------------------------------------------------------------------------- /dbcore/mcs_lock.cpp: -------------------------------------------------------------------------------- 1 | #include "mcs_lock.h" 2 | 3 | void mcs_lock::spin_on_waiting(qnode* me) { 4 | while (me->vthis()->_waiting) 5 | ; 6 | } 7 | 8 | mcs_lock::qnode* mcs_lock::spin_on_next(qnode* me) { 9 | qnode* next; 10 | while (!(next = me->vthis()->_next)) 11 | ; 12 | return next; 13 | } 14 | -------------------------------------------------------------------------------- /tuple.cc: -------------------------------------------------------------------------------- 1 | #include "tuple.h" 2 | 3 | #include "txn.h" 4 | 5 | namespace ermia { 6 | 7 | #ifdef SSN 8 | bool dbtuple::is_old(TXN::xid_context *visitor) { // FOR READERS ONLY! 9 | return visitor->xct->is_read_mostly() && 10 | age(visitor) >= config::ssn_read_opt_threshold; 11 | } 12 | #endif 13 | } // namespace ermia 14 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "third-party/googletest"] 2 | path = third-party/googletest 3 | url = https://github.com/google/googletest 4 | [submodule "third-party/benchmark"] 5 | path = third-party/benchmark 6 | url = https://github.com/google/benchmark 7 | [submodule "third-party/spdk"] 8 | path = third-party/spdk 9 | url = https://github.com/spdk/spdk 10 | -------------------------------------------------------------------------------- /benchmarks/egen/flat/egen_flat_in/Exchange.txt: -------------------------------------------------------------------------------- 1 | NYSE New York Stock Exchange 0930 1600 Simulates the New York Stock Exchange 1 2 | NASDAQ NASDAQ (National Association of Security Dealers and Quotations) 0930 1600 Simulates the NASDAQ 2 3 | AMEX American Stock Exchange 0930 1600 Simulates the American Stock Exchange 3 4 | PCX Pacific Exchange 0930 1600 Simulates the Pacific Exchange 4 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.acn 2 | *.acr 3 | *.alg 4 | *.aux 5 | *.bbl 6 | *.blg 7 | *.dvi 8 | *.fdb_latexmk 9 | *.glg 10 | *.glo 11 | *.gls 12 | *.idx 13 | *.ilg 14 | *.ind 15 | *.ist 16 | *.lof 17 | *.log 18 | *.lot 19 | *.maf 20 | *.mtc 21 | *.mtc0 22 | *.nav 23 | *.nlo 24 | *.out 25 | *.pdfsync 26 | *.ps 27 | *.snm 28 | *.synctex.gz 29 | *.toc 30 | *.vrb 31 | *.xdy 32 | *.tdo 33 | build 34 | tags 35 | .vscode 36 | .idea/ 37 | cmake-build-debug/ 38 | -------------------------------------------------------------------------------- /benchmarks/egen/flat/egen_flat_in/CompanySPRate.txt: -------------------------------------------------------------------------------- 1 | 1 A 2 | 1 B 3 | 1 C 4 | 1 AA 5 | 1 AB 6 | 1 AC 7 | 1 BA 8 | 1 BB 9 | 1 BC 10 | 1 CA 11 | 1 CB 12 | 1 CC 13 | 1 AAA 14 | 1 AAB 15 | 1 AAC 16 | 1 ABA 17 | 1 ABB 18 | 1 ABC 19 | 1 ACA 20 | 1 ACB 21 | 1 ACC 22 | 1 BAA 23 | 1 BAB 24 | 1 BAC 25 | 1 BBA 26 | 1 BBB 27 | 1 BBC 28 | 1 BCA 29 | 1 BCB 30 | 1 BCC 31 | 1 CAA 32 | 1 CAB 33 | 1 CAC 34 | 1 CBA 35 | 1 CBB 36 | 1 CBC 37 | 1 CCA 38 | 1 CCB 39 | 1 CCC 40 | -------------------------------------------------------------------------------- /tests/masstree/test_main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char **argv) { 8 | ermia::config::threads = 40; 9 | 10 | ermia::thread::Initialize(); 11 | ermia::config::init(); 12 | ermia::MM::prepare_node_memory(); 13 | 14 | ::testing::InitGoogleTest(&argc, argv); 15 | return RUN_ALL_TESTS(); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /tests/coroutine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(DB_CORE_INCLUDES 2 | ${CMAKE_SOURCE_DIR}/dbcore 3 | ) 4 | 5 | set(TEST_SRCS 6 | test_main.cpp 7 | coroutine_test_base.h 8 | return_primary_type.cpp 9 | return_complex_type.cpp 10 | resume_order.cpp 11 | suspend_order.cpp 12 | ${CMAKE_SOURCE_DIR}/dbcore/sm-coroutine.cpp 13 | ) 14 | 15 | add_executable(test_coroutine ${TEST_SRCS}) 16 | target_include_directories(test_coroutine PRIVATE ${DB_CORE_INCLUDES}) 17 | target_link_libraries(test_coroutine gtest_main) 18 | -------------------------------------------------------------------------------- /benchmarks/egen/flat/egen_flat_in/TaxRatesCountry.txt: -------------------------------------------------------------------------------- 1 | 1 US1 U.S. Income Tax Bracket for the poor 0.15 2 | 1 US2 U.S. Income Tax Bracket for the huddled masses 0.275 3 | 1 US3 U.S. Income Tax Bracket for the masses 0.305 4 | 1 US4 U.S. Income Tax Bracket for the well to do 0.355 5 | 1 US5 U.S. Income Tax Bracket for the filthy rich 0.391 6 | 2 CN1 Canadian Income Tax for the poor 0.16 7 | 2 CN2 Canadian Income Tax for the huddled masses 0.22 8 | 2 CN3 Canadian Income Tax for the well to do 0.26 9 | 2 CN4 Canadian Income Tax for the filthy rich 0.29 10 | -------------------------------------------------------------------------------- /benchmarks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(egen) 2 | add_subdirectory(record) 3 | 4 | set_property(GLOBAL APPEND PROPERTY ALL_SRC 5 | # ${CMAKE_CURRENT_SOURCE_DIR}/tpce.cc 6 | ${CMAKE_CURRENT_SOURCE_DIR}/oddlb.cc 7 | ${CMAKE_CURRENT_SOURCE_DIR}/oddlb-config.cc 8 | ${CMAKE_CURRENT_SOURCE_DIR}/tpcc-common.cc 9 | ${CMAKE_CURRENT_SOURCE_DIR}/tpcc.cc 10 | ${CMAKE_CURRENT_SOURCE_DIR}/tpcc-ddls.cc 11 | #${CMAKE_CURRENT_SOURCE_DIR}/tpcc-cs.cc 12 | ${CMAKE_CURRENT_SOURCE_DIR}/ycsb-config.cc 13 | ${CMAKE_CURRENT_SOURCE_DIR}/ycsb.cc 14 | ${CMAKE_CURRENT_SOURCE_DIR}/ycsb-cs.cc 15 | ${CMAKE_CURRENT_SOURCE_DIR}/ycsb-cs-advance.cc 16 | ${CMAKE_CURRENT_SOURCE_DIR}/bench.cc 17 | ) 18 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/config.h.include: -------------------------------------------------------------------------------- 1 | /*** 2 | *** These are #defines that autoheader puts in config.h.in that we 3 | *** want to show up in sparseconfig.h, the minimal config.h file 4 | *** #included by all our .h files. The reason we don't take 5 | *** everything that autoheader emits is that we have to include a 6 | *** config.h in installed header files, and we want to minimize the 7 | *** number of #defines we make so as to not pollute the namespace. 8 | ***/ 9 | GOOGLE_NAMESPACE 10 | HASH_NAMESPACE 11 | HASH_FUN_H 12 | SPARSEHASH_HASH 13 | HAVE_UINT16_T 14 | HAVE_U_INT16_T 15 | HAVE___UINT16 16 | HAVE_LONG_LONG 17 | HAVE_SYS_TYPES_H 18 | HAVE_STDINT_H 19 | HAVE_INTTYPES_H 20 | HAVE_MEMCPY 21 | _END_GOOGLE_NAMESPACE_ 22 | _START_GOOGLE_NAMESPACE_ 23 | -------------------------------------------------------------------------------- /dbcore/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # TODO(tzwang): generate executables for test cases below 2 | #${CMAKE_CURRENT_SOURCE_DIR}/w_rand.cpp 3 | #${CMAKE_CURRENT_SOURCE_DIR}/test-adler.cpp 4 | #${CMAKE_CURRENT_SOURCE_DIR}/test-dynarray.cpp 5 | #${CMAKE_CURRENT_SOURCE_DIR}/test-epoch.cpp 6 | #${CMAKE_CURRENT_SOURCE_DIR}/test-rcu.cpp 7 | #${CMAKE_CURRENT_SOURCE_DIR}/test-sc-hash.cpp 8 | #${CMAKE_CURRENT_SOURCE_DIR}/test-size-encode.cpp 9 | #${CMAKE_CURRENT_SOURCE_DIR}/test-sm-log-alloc.cpp 10 | #${CMAKE_CURRENT_SOURCE_DIR}/test-sm-log.cpp 11 | #${CMAKE_CURRENT_SOURCE_DIR}/test-sm-log-file.cpp 12 | #${CMAKE_CURRENT_SOURCE_DIR}/test-sm-log-offset.cpp 13 | #${CMAKE_CURRENT_SOURCE_DIR}/test-sm-oid-alloc-impl.cpp 14 | #${CMAKE_CURRENT_SOURCE_DIR}/test-sm-oid.cpp 15 | #${CMAKE_CURRENT_SOURCE_DIR}/test-window-buffer.cpp 16 | #${CMAKE_CURRENT_SOURCE_DIR}/test-xid.cpp 17 | 18 | -------------------------------------------------------------------------------- /benchmarks/run-microbench.sh: -------------------------------------------------------------------------------- 1 | # $1: type ("-random", random read-set or "-static", fixed read-set) 2 | type=$1 3 | EXEC="./out-perf.masstree/benchmarks/dbtest --verbose --runtime 30 --bench tpcc --scale-factor 24 --pin-cpu --log-dir /tmpfs/$USER/silo-log/" 4 | 5 | export TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES="2147483648" 6 | export LD_PRELOAD="/usr/lib/libtcmalloc.so" 7 | 8 | for READ_ROWS in 1000 10000 100000 200000 300000; do 9 | echo $READ_ROWS 10 | DIR=./microbench-results 11 | mkdir -p $DIR 12 | for w_ratio in 0.1 0.01 0.001 0.0001 0.00001; do 13 | w=`echo $READ_ROWS \* $w_ratio | bc -l` 14 | echo read $READ_ROWS rows, write $w rows 15 | for t in 24; do 16 | rm -rf /tmpfs/$USER/silo-log/* 17 | $EXEC --num-threads $t -o "--disable-read-only-snapshot --warehouse-spread=100 --microbench$type --microbench-rows=$READ_ROWS --microbench-wr-rows=$w" &> $DIR/microbench$type-rd-$READ_ROWS-wr-$w-t-$t.txt 18 | done 19 | done 20 | done 21 | 22 | -------------------------------------------------------------------------------- /dbcore/stopwatch.h: -------------------------------------------------------------------------------- 1 | /* -*- mode:C++; c-basic-offset:4 -*- */ 2 | 3 | #ifndef _STOPWATCH_H 4 | #define _STOPWATCH_H 5 | 6 | #include 7 | #include 8 | 9 | /** 10 | * @brief a timer object. 11 | */ 12 | class stopwatch_t { 13 | private: 14 | uint64_t _mark; 15 | 16 | public: 17 | stopwatch_t() { reset(); } 18 | uint64_t time_ns() { 19 | uint64_t old_mark = _mark; 20 | return reset() - old_mark; 21 | } 22 | double time_us() { return time_ns() * 1e-3; } 23 | double time_ms() { return time_ns() * 1e-6; } 24 | double time() { return time_ns() * 1e-9; } 25 | 26 | /* reads the clock without storing the result */ 27 | static uint64_t now() { 28 | struct timespec tv; 29 | clock_gettime(CLOCK_REALTIME, &tv); 30 | return tv.tv_nsec + tv.tv_sec * 1000000000ll; 31 | } 32 | 33 | /* returns whatever was last read */ 34 | uint64_t mark() const { return _mark; } 35 | 36 | operator uint64_t() const { return mark(); } 37 | 38 | /* reads the clock and sets the mark to match */ 39 | uint64_t reset() { return _mark = now(); } 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /tests/masstree/record.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | struct Record { 8 | Record() : key(""), value(0) {} 9 | Record(const std::string & k, ermia::OID v) : key(k), value(v) {} 10 | std::string key; 11 | ermia::OID value; 12 | }; 13 | 14 | // Without setting seed, the default seed is used in all Records generation. 15 | // Sometimes you may want to use the default seed, for example, in small 16 | // perf tests. 17 | void setRandomSeed(uint32_t seed); 18 | 19 | std::vector genSequentialRecords(uint32_t record_num, uint32_t key_len); 20 | 21 | std::vector genRandRecords(uint32_t record_num, 22 | uint32_t key_len_avg=128); 23 | 24 | std::vector genDisjointRecords(const std::vector& ref_records, 25 | uint32_t record_num, 26 | uint32_t key_len=128); 27 | 28 | std::string genKeyNotInRecords(const std::vector& records, 29 | uint32_t key_len=128); 30 | 31 | -------------------------------------------------------------------------------- /catalog_mgr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "benchmarks/bench.h" 4 | #include "engine.h" 5 | 6 | namespace ermia { 7 | 8 | namespace catalog { 9 | 10 | class schematable_loader : public bench_loader { 11 | public: 12 | schematable_loader( 13 | unsigned long seed, ermia::Engine *db, 14 | const std::map &open_tables) 15 | : bench_loader(seed, db, open_tables) {} 16 | 17 | protected: 18 | virtual void load() = 0; 19 | }; 20 | 21 | void create_schema_table(ermia::Engine *db, const char *name); 22 | 23 | void read_schema(transaction *t, ConcurrentMasstreeIndex *schema_table_index, 24 | ConcurrentMasstreeIndex *target_table_index, 25 | const varstr &table_name, varstr &out_schema_value, OID *out_schema_oid); 26 | 27 | rc_t write_schema(transaction *t, ConcurrentMasstreeIndex *schema_table_index, 28 | const varstr &table_name, varstr &schema_value, 29 | OID *out_schema_oid, ddl::ddl_executor *ddl_exe, 30 | bool is_insert = false); 31 | 32 | } // namespace catalog 33 | 34 | } // namespace ermia 35 | -------------------------------------------------------------------------------- /macros.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define USE_VARINT_ENCODING 4 | 5 | #define LG_CACHELINE_SIZE __builtin_ctz(CACHELINE_SIZE) 6 | 7 | // some helpers for cacheline alignment 8 | #define CACHE_ALIGNED __attribute__((aligned(CACHELINE_SIZE))) 9 | 10 | #define __XCONCAT2(a, b) a##b 11 | #define __XCONCAT(a, b) __XCONCAT2(a, b) 12 | #define CACHE_PADOUT \ 13 | char __XCONCAT(__padout, __COUNTER__)[0] \ 14 | __attribute__((aligned(CACHELINE_SIZE))) 15 | #define PACKED __attribute__((packed)) 16 | 17 | #ifndef ALWAYS_INLINE 18 | #define ALWAYS_INLINE __attribute__((always_inline)) inline 19 | #endif 20 | 21 | #define likely(x) __builtin_expect(!!(x), 1) 22 | #define unlikely(x) __builtin_expect(!!(x), 0) 23 | 24 | #ifndef ALWAYS_ASSERT 25 | #define ALWAYS_ASSERT(expr) (likely((expr)) ? (void)0 : abort()) 26 | #endif 27 | 28 | #define MARK_REFERENCED(x) (void)x 29 | 30 | #define COMPILER_MEMORY_FENCE asm volatile("" ::: "memory") 31 | 32 | #define ARRAY_NELEMS(a) (sizeof(a) / sizeof((a)[0])) 33 | 34 | #define VERBOSE(expr) ((void)0) 35 | //#define VERBOSE(expr) (expr) 36 | 37 | #define NOP_PAUSE asm volatile("pause" : :) 38 | -------------------------------------------------------------------------------- /dbcore/sm-exceptions.cpp: -------------------------------------------------------------------------------- 1 | #include "sm-exceptions.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "sm-common.h" 7 | 8 | illegal_argument::illegal_argument(char const volatile *m, ...) { 9 | va_list ap; 10 | va_start(ap, m); 11 | DEFER(va_end(ap)); 12 | 13 | int err = vasprintf(&free_msg, (char const *)m, ap); 14 | if (err < 0) { 15 | msg = ""; 16 | free_msg = 0; 17 | } else { 18 | msg = free_msg; 19 | } 20 | } 21 | 22 | os_error::os_error(int e, char const volatile *m, ...) : err(e) { 23 | va_list ap; 24 | va_start(ap, m); 25 | DEFER(va_end(ap)); 26 | 27 | int err = vasprintf(&free_msg, (char const *)m, ap); 28 | if (err < 0) { 29 | msg = ""; 30 | free_msg = 0; 31 | } else { 32 | msg = free_msg; 33 | } 34 | } 35 | 36 | log_file_error::log_file_error(char const volatile *m, ...) { 37 | va_list ap; 38 | va_start(ap, m); 39 | DEFER(va_end(ap)); 40 | 41 | int err = vasprintf(&free_msg, (char const *)m, ap); 42 | if (err < 0) { 43 | msg = ""; 44 | free_msg = 0; 45 | } else { 46 | msg = free_msg; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/coroutine/suspend_order.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using namespace ermia::dia; 6 | 7 | task CoroutineCall_LevelThree(int *counter) { 8 | (*counter)++; 9 | 10 | co_await std::experimental::suspend_always{}; 11 | 12 | (*counter)--; 13 | co_return; 14 | } 15 | 16 | task CoroutineCall_LevelTwo(int *counter) { 17 | (*counter)++; 18 | 19 | co_await CoroutineCall_LevelThree(counter); 20 | 21 | co_await std::experimental::suspend_always{}; 22 | 23 | (*counter)--; 24 | co_return; 25 | } 26 | 27 | task CoroutineCall_LevelOne(int *counter) { 28 | (*counter)++; 29 | 30 | co_await std::experimental::suspend_always{}; 31 | 32 | co_await CoroutineCall_LevelTwo(counter); 33 | 34 | (*counter)--; 35 | co_return; 36 | } 37 | 38 | TEST(CoroutineSuspendOrder, FixedLogic) { 39 | coro_task_private::memory_pool memory_pool; 40 | 41 | int counter = 0; 42 | task future_task = CoroutineCall_LevelOne(&counter); 43 | future_task.start(); 44 | 45 | ASSERT_EQ(counter, 1); 46 | 47 | future_task.resume(); 48 | ASSERT_EQ(counter, 3); 49 | 50 | future_task.resume(); 51 | ASSERT_EQ(counter, 2); 52 | 53 | future_task.resume(); 54 | ASSERT_EQ(counter, 0); 55 | 56 | ASSERT_TRUE(future_task.done()); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /dbcore/tests/test-xid.cpp: -------------------------------------------------------------------------------- 1 | #include "xid.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | bool done = false; 8 | 9 | extern "C" void* slow_worker(void* t) { 10 | size_t tid = (size_t)t; 11 | while (not volatile_read(done)) { 12 | XID xid = xid_alloc(); 13 | printf("%.10u %.4u\n", xid.epoch(), xid.local()); 14 | usleep(1000); 15 | xid_get_context(xid); 16 | xid_free(xid); 17 | } 18 | return NULL; 19 | } 20 | 21 | extern "C" void* fast_worker(void* t) { 22 | size_t tid = (size_t)t; 23 | while (not volatile_read(done)) { 24 | XID xid = xid_alloc(); 25 | printf("%.10u %.4u\n", xid.epoch(), xid.local()); 26 | usleep(10); 27 | xid_get_context(xid); 28 | xid_free(xid); 29 | } 30 | return NULL; 31 | } 32 | 33 | int main() { 34 | pthread_t fast_thd[4], slow_thd; 35 | 36 | fprintf(stderr, "Creating worker threads\n"); 37 | pthread_create(&slow_thd, NULL, slow_worker, (void*)-1); 38 | for (auto it : enumerate(fast_thd)) 39 | pthread_create(&it.second, NULL, fast_worker, (void*)it.first); 40 | 41 | fprintf(stderr, "Sleeping for 10 seconds...\n"); 42 | sleep(10); 43 | fprintf(stderr, "... back, joining with workers\n"); 44 | done = true; 45 | 46 | for (auto t : fast_thd) pthread_join(t, NULL); 47 | pthread_join(slow_thd, NULL); 48 | fprintf(stderr, "Done!\n"); 49 | } 50 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (C) 2021 Kaisong Huang, Tianxun Hu and Tianzheng Wang 4 | Copyright (C) 2020 Yongjun He and Tianzheng Wang 5 | Copyright (C) 2015 Kangnyeon Kim, Tianzheng Wang, Ryan Johnson and Ippokratis Pandis 6 | Copyright (C) 2013 Stephen Tu and other contributors 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | this software and associated documentation files (the "Software"), to deal in 10 | the Software without restriction, including without limitation the rights to 11 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | of the Software, and to permit persons to whom the Software is furnished to do 13 | so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | -------------------------------------------------------------------------------- /dbcore/sm-rc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | // 8 bits for return code: 5 | // bit meaning 6 | // 8 user requested abort 7 | // 7 there's phantom, tx should abort 8 | // 6 abort due to rw conflict with the read optimization 9 | // 5 SSN/SSI determines tx should abort 10 | // 4 should abort due to SI conflict (first writer wins) 11 | // 3 tx should abort due to internal error (eg got an invalid cstamp) 12 | // 2 abort marker - must be used in conjunction with one of the detailed 13 | // reasons 14 | // 1 false (e.g., read a deleted tuple) 15 | // 0 true (success) 16 | // 17 | // NOTE: SSN/SSI/SI abort code will also have 18 | // the ABORT bit set for easier checking 19 | 20 | #define RC_INVALID 0x0 21 | #define RC_TRUE 0x1 22 | #define RC_FALSE 0x2 23 | #define RC_ABORT 0x4 24 | #define RC_ABORT_INTERNAL (RC_ABORT | 0x8) 25 | #define RC_ABORT_SI_CONFLICT (RC_ABORT | 0x10) 26 | #define RC_ABORT_SERIAL (RC_ABORT | 0x20) 27 | #define RC_ABORT_RW_CONFLICT (RC_ABORT | 0x40) 28 | #define RC_ABORT_PHANTOM (RC_ABORT | 0x80) 29 | #define RC_ABORT_USER (RC_ABORT | 0x100) 30 | 31 | // Operation (e.g., r/w) return code 32 | struct rc_t { 33 | uint16_t _val; 34 | 35 | rc_t() : _val(RC_INVALID) {} 36 | rc_t(uint16_t v) : _val(v) {} 37 | 38 | inline bool IsUserAbort() { return _val == RC_ABORT_USER; } 39 | inline bool IsInvalid() { return _val == RC_INVALID; } 40 | inline bool IsAbort() { return _val & RC_ABORT; } 41 | }; 42 | -------------------------------------------------------------------------------- /dbcore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generate burt-hash.cpp 2 | if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/burt-hash.cpp") 3 | set(BURT_HASH_GEN python2 ${CMAKE_CURRENT_SOURCE_DIR}/burt-hash.py) 4 | execute_process(COMMAND ${BURT_HASH_GEN} ERROR_VARIABLE out OUTPUT_VARIABLE out) 5 | if ("${out}" STREQUAL "") 6 | message(FATAL_ERROR "Generating burt-hash.cpp failed. Please make sure python2 is installed.") 7 | else() 8 | file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/burt-hash.cpp "${out}") 9 | endif() 10 | endif() 11 | 12 | set(DBCORE_SRC 13 | ${CMAKE_CURRENT_SOURCE_DIR}/burt-hash.cpp 14 | ${CMAKE_CURRENT_SOURCE_DIR}/ddl.cpp 15 | ${CMAKE_CURRENT_SOURCE_DIR}/dlog.cpp 16 | ${CMAKE_CURRENT_SOURCE_DIR}/dynarray.cpp 17 | ${CMAKE_CURRENT_SOURCE_DIR}/epoch.cpp 18 | ${CMAKE_CURRENT_SOURCE_DIR}/mcs_lock.cpp 19 | ${CMAKE_CURRENT_SOURCE_DIR}/pcommit.cpp 20 | ${CMAKE_CURRENT_SOURCE_DIR}/rcu.cpp 21 | ${CMAKE_CURRENT_SOURCE_DIR}/serial.cpp 22 | ${CMAKE_CURRENT_SOURCE_DIR}/size-encode.cpp 23 | ${CMAKE_CURRENT_SOURCE_DIR}/sm-alloc.cpp 24 | ${CMAKE_CURRENT_SOURCE_DIR}/sm-common.cpp 25 | ${CMAKE_CURRENT_SOURCE_DIR}/sm-config.cpp 26 | ${CMAKE_CURRENT_SOURCE_DIR}/sm-coroutine.cpp 27 | ${CMAKE_CURRENT_SOURCE_DIR}/sm-exceptions.cpp 28 | ${CMAKE_CURRENT_SOURCE_DIR}/sm-table.cpp 29 | ${CMAKE_CURRENT_SOURCE_DIR}/sm-object.cpp 30 | ${CMAKE_CURRENT_SOURCE_DIR}/sm-oid-alloc.cpp 31 | ${CMAKE_CURRENT_SOURCE_DIR}/sm-oid.cpp 32 | ${CMAKE_CURRENT_SOURCE_DIR}/xid.cpp 33 | ) 34 | 35 | set_property(GLOBAL APPEND PROPERTY ALL_SRC ${DBCORE_SRC}) 36 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/sparsehash/internal/sparseconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NOTE: This file is for internal use only. 3 | * Do not use these #defines in your own program! 4 | */ 5 | 6 | /* Namespace for Google classes */ 7 | #define GOOGLE_NAMESPACE ::google 8 | 9 | /* the location of the header defining hash functions */ 10 | #define HASH_FUN_H 11 | 12 | /* the namespace of the hash<> function */ 13 | #define HASH_NAMESPACE std 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #define HAVE_INTTYPES_H 1 17 | 18 | /* Define to 1 if the system has the type `long long'. */ 19 | #define HAVE_LONG_LONG 1 20 | 21 | /* Define to 1 if you have the `memcpy' function. */ 22 | #define HAVE_MEMCPY 1 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #define HAVE_STDINT_H 1 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #define HAVE_SYS_TYPES_H 1 29 | 30 | /* Define to 1 if the system has the type `uint16_t'. */ 31 | #define HAVE_UINT16_T 1 32 | 33 | /* Define to 1 if the system has the type `u_int16_t'. */ 34 | #define HAVE_U_INT16_T 1 35 | 36 | /* Define to 1 if the system has the type `__uint16'. */ 37 | /* #undef HAVE___UINT16 */ 38 | 39 | /* The system-provided hash function including the namespace. */ 40 | #define SPARSEHASH_HASH HASH_NAMESPACE::hash 41 | 42 | /* Stops putting the code inside the Google namespace */ 43 | #define _END_GOOGLE_NAMESPACE_ } 44 | 45 | /* Puts following code inside the Google namespace */ 46 | #define _START_GOOGLE_NAMESPACE_ namespace google { 47 | -------------------------------------------------------------------------------- /third-party/gflags/include/gflags/defines.h: -------------------------------------------------------------------------------- 1 | /* Generated from defines.h.in during build configuration using CMake. */ 2 | 3 | // Note: This header file is only used internally. It is not part of public interface! 4 | // Any cmakedefine is defined using the -D flag instead when Bazel is used. 5 | // For Bazel, this file is thus not used to avoid a private file in $(GENDIR). 6 | 7 | #ifndef GFLAGS_DEFINES_H_ 8 | #define GFLAGS_DEFINES_H_ 9 | 10 | 11 | // Define if you build this library for a MS Windows OS. 12 | /* #undef OS_WINDOWS */ 13 | 14 | // Define if you have the header file. 15 | #define HAVE_STDINT_H 16 | 17 | // Define if you have the header file. 18 | #define HAVE_SYS_TYPES_H 19 | 20 | // Define if you have the header file. 21 | #define HAVE_INTTYPES_H 22 | 23 | // Define if you have the header file. 24 | #define HAVE_SYS_STAT_H 25 | 26 | // Define if you have the header file. 27 | #define HAVE_UNISTD_H 28 | 29 | // Define if you have the header file. 30 | #define HAVE_FNMATCH_H 31 | 32 | // Define if you have the header file (Windows 2000/XP). 33 | /* #undef HAVE_SHLWAPI_H */ 34 | 35 | // Define if you have the strtoll function. 36 | #define HAVE_STRTOLL 37 | 38 | // Define if you have the strtoq function. 39 | /* #undef HAVE_STRTOQ */ 40 | 41 | // Define if you have the header file. 42 | #define HAVE_PTHREAD 43 | 44 | // Define if your pthread library defines the type pthread_rwlock_t 45 | #define HAVE_RWLOCK 46 | 47 | 48 | #endif // GFLAGS_DEFINES_H_ 49 | -------------------------------------------------------------------------------- /tests/coroutine/resume_order.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "coroutine_test_base.h" 6 | 7 | template 8 | task ChainedCoroCall(int *callLevelCounter) { 9 | (*callLevelCounter)++; 10 | 11 | const int currentLevel = *callLevelCounter; 12 | 13 | // std::cout << *callLevelCounter <(callLevelCounter); 17 | co_await std::experimental::suspend_always{}; 18 | 19 | assert(*callLevelCounter == currentLevel); 20 | 21 | (*callLevelCounter)--; 22 | co_return; 23 | } 24 | 25 | template <> 26 | task ChainedCoroCall<0>(int *callLevelCounter) { 27 | (*callLevelCounter)++; 28 | 29 | const int currentLevel = *callLevelCounter; 30 | 31 | co_await std::experimental::suspend_always{}; 32 | 33 | assert(*callLevelCounter == currentLevel); 34 | 35 | (*callLevelCounter)--; 36 | co_return; 37 | } 38 | 39 | class CoroResumeOrderTest : public CoroutineTestBase { 40 | public: 41 | void run() { 42 | std::array callLevelCounters = {0}; 43 | 44 | addTask(ChainedCoroCall<7>(&callLevelCounters[0])); 45 | addTask(ChainedCoroCall<9>(&callLevelCounters[1])); 46 | addTask(ChainedCoroCall<0>(&callLevelCounters[2])); 47 | addTask(ChainedCoroCall<1>(&callLevelCounters[3])); 48 | addTask(ChainedCoroCall<3>(&callLevelCounters[4])); 49 | 50 | runTasksUntilComplete(); 51 | } 52 | }; 53 | 54 | TEST_F(CoroResumeOrderTest, Run) { run(); } 55 | 56 | -------------------------------------------------------------------------------- /masstree/kvproto.hh: -------------------------------------------------------------------------------- 1 | /* Masstree 2 | * Eddie Kohler, Yandong Mao, Robert Morris 3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College 4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, subject to the conditions 9 | * listed in the Masstree LICENSE file. These conditions include: you must 10 | * preserve this copyright notice, and you cannot mention the copyright 11 | * holders in advertising related to the Software without their permission. 12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This 13 | * notice is a summary of the Masstree LICENSE file; the license in that file 14 | * is legally binding. 15 | */ 16 | #ifndef KVPROTO_HH 17 | #define KVPROTO_HH 18 | #include "compiler.hh" 19 | 20 | enum { 21 | Cmd_None = 0, 22 | Cmd_Get = 2, 23 | Cmd_Scan = 4, 24 | Cmd_Put = 6, 25 | Cmd_Replace = 8, 26 | Cmd_Remove = 10, 27 | Cmd_Checkpoint = 12, 28 | Cmd_Handshake = 14, 29 | Cmd_Max 30 | }; 31 | 32 | enum result_t { 33 | NotFound = -2, 34 | Retry, 35 | OutOfDate, 36 | Inserted, 37 | Updated, 38 | Found, 39 | ScanDone 40 | }; 41 | 42 | enum ckptrav_order_t { ckptrav_inorder = 0, ckptrav_preorder }; 43 | 44 | struct row_marker { 45 | enum { mt_remove = 1, mt_delta = 2 }; 46 | int marker_type_; 47 | }; 48 | 49 | template 50 | inline bool row_is_marker(const R* row) { 51 | return row->timestamp() & 1; 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /tests/coroutine/return_complex_type.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "coroutine_test_base.h" 4 | 5 | template 6 | task returnValueCoroutineChain_LevelTwo(std::unique_ptr *pReturn) { 7 | co_await std::experimental::suspend_always{}; 8 | *pReturn = std::unique_ptr(new T(std::rand())); 9 | co_await std::experimental::suspend_always{}; 10 | co_return *(pReturn->get()); 11 | } 12 | 13 | template 14 | task returnValueInCoroutineChain_LevelOne(std::unique_ptr *pReturn) { 15 | T ret = co_await returnValueCoroutineChain_LevelTwo(pReturn); 16 | co_return ret; 17 | } 18 | 19 | class RAII_Int { 20 | public: 21 | RAII_Int(int value) { data_ = new int(value); } 22 | ~RAII_Int() { delete data_; } 23 | 24 | RAII_Int(const RAII_Int &other) { data_ = new int(other.value()); } 25 | RAII_Int(RAII_Int &&other) : data_(nullptr) { 26 | std::swap(data_, other.data_); 27 | } 28 | 29 | int value() const { return *data_; } 30 | 31 | private: 32 | int *data_; 33 | }; 34 | 35 | class CoroReturnDynamicAllocValue : public CoroutineTestBase { 36 | public: 37 | void run() { 38 | std::unique_ptr returnValueBuf; 39 | 40 | addTask( 41 | returnValueInCoroutineChain_LevelOne(&returnValueBuf)); 42 | 43 | runTasksUntilComplete(); 44 | 45 | std::vector returnValues = getReturnValues(); 46 | 47 | ASSERT_EQ(returnValues.size(), 1); 48 | ASSERT_EQ(returnValues[0].value(), returnValueBuf.get()->value()); 49 | } 50 | }; 51 | 52 | TEST_F(CoroReturnDynamicAllocValue, DynamicInt) { run(); } 53 | 54 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/windows/google/sparsehash/sparseconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NOTE: This file is for internal use only. 3 | * Do not use these #defines in your own program! 4 | */ 5 | 6 | /* Namespace for Google classes */ 7 | #define GOOGLE_NAMESPACE ::google 8 | 9 | /* the location of the header defining hash functions */ 10 | #define HASH_FUN_H 11 | 12 | /* the namespace of the hash<> function */ 13 | #define HASH_NAMESPACE stdext 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_INTTYPES_H 17 | 18 | /* Define to 1 if the system has the type `long long'. */ 19 | #define HAVE_LONG_LONG 1 20 | 21 | /* Define to 1 if you have the `memcpy' function. */ 22 | #define HAVE_MEMCPY 1 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_STDINT_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #define HAVE_SYS_TYPES_H 1 29 | 30 | /* Define to 1 if the system has the type `uint16_t'. */ 31 | #undef HAVE_UINT16_T 32 | 33 | /* Define to 1 if the system has the type `u_int16_t'. */ 34 | #undef HAVE_U_INT16_T 35 | 36 | /* Define to 1 if the system has the type `__uint16'. */ 37 | #define HAVE___UINT16 1 38 | 39 | /* The system-provided hash function including the namespace. */ 40 | #define SPARSEHASH_HASH HASH_NAMESPACE::hash_compare 41 | 42 | /* The system-provided hash function, in namespace HASH_NAMESPACE. */ 43 | #define SPARSEHASH_HASH_NO_NAMESPACE hash_compare 44 | 45 | /* Stops putting the code inside the Google namespace */ 46 | #define _END_GOOGLE_NAMESPACE_ } 47 | 48 | /* Puts following code inside the Google namespace */ 49 | #define _START_GOOGLE_NAMESPACE_ namespace google { 50 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/windows/sparsehash/internal/sparseconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NOTE: This file is for internal use only. 3 | * Do not use these #defines in your own program! 4 | */ 5 | 6 | /* Namespace for Google classes */ 7 | #define GOOGLE_NAMESPACE ::google 8 | 9 | /* the location of the header defining hash functions */ 10 | #define HASH_FUN_H 11 | 12 | /* the namespace of the hash<> function */ 13 | #define HASH_NAMESPACE stdext 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_INTTYPES_H 17 | 18 | /* Define to 1 if the system has the type `long long'. */ 19 | #define HAVE_LONG_LONG 1 20 | 21 | /* Define to 1 if you have the `memcpy' function. */ 22 | #define HAVE_MEMCPY 1 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_STDINT_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #define HAVE_SYS_TYPES_H 1 29 | 30 | /* Define to 1 if the system has the type `uint16_t'. */ 31 | #undef HAVE_UINT16_T 32 | 33 | /* Define to 1 if the system has the type `u_int16_t'. */ 34 | #undef HAVE_U_INT16_T 35 | 36 | /* Define to 1 if the system has the type `__uint16'. */ 37 | #define HAVE___UINT16 1 38 | 39 | /* The system-provided hash function including the namespace. */ 40 | #define SPARSEHASH_HASH HASH_NAMESPACE::hash_compare 41 | 42 | /* The system-provided hash function, in namespace HASH_NAMESPACE. */ 43 | #define SPARSEHASH_HASH_NO_NAMESPACE hash_compare 44 | 45 | /* Stops putting the code inside the Google namespace */ 46 | #define _END_GOOGLE_NAMESPACE_ } 47 | 48 | /* Puts following code inside the Google namespace */ 49 | #define _START_GOOGLE_NAMESPACE_ namespace google { 50 | -------------------------------------------------------------------------------- /dbcore/tests/test-epoch.cpp: -------------------------------------------------------------------------------- 1 | #include "epoch.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #define LOG(msg, ...) fprintf(stderr, msg "\n", ##__VA_ARGS__) 8 | 9 | size_t x = 1; 10 | 11 | void global_init(void *arg) { LOG("Initializing"); } 12 | epoch_mgr::tls_storage *get_tls(void *) { 13 | static __thread epoch_mgr::tls_storage s; 14 | return &s; 15 | } 16 | void *thread_registered(void *) { 17 | LOG("Thread %zd registered", (size_t)pthread_self()); 18 | return 0; 19 | } 20 | void thread_deregistered(void *cookie, void *thread_cookie) { 21 | LOG("Thread %zd deregistered", (size_t)pthread_self()); 22 | } 23 | void *epoch_ended(void *, epoch_mgr::epoch_num x) { 24 | LOG("Epoch %zd ended", x); 25 | return (void *)x; 26 | } 27 | 28 | void *epoch_ended_thread(void *cookie, void *epoch_cookie, 29 | void *thread_cookie) { 30 | return epoch_cookie; 31 | } 32 | void epoch_reclaimed(void *cookie, void *epoch_cookie) { 33 | LOG("Epoch %zd reclaimed", (size_t)epoch_cookie); 34 | } 35 | 36 | struct state {}; 37 | 38 | static state s; 39 | 40 | static epoch_mgr em{{&s, &global_init, &get_tls, &thread_registered, 41 | &thread_deregistered, &epoch_ended, &epoch_ended_thread, 42 | &epoch_reclaimed}}; 43 | 44 | int main() { 45 | em.thread_init(); 46 | LOG("thread_enter"); 47 | em.thread_enter(); 48 | em.new_epoch(); 49 | em.new_epoch(); 50 | em.new_epoch(); 51 | LOG("thread_quiesce"); 52 | em.thread_quiesce(); 53 | em.new_epoch(); 54 | em.new_epoch(); 55 | em.new_epoch(); 56 | LOG("thread_exit"); 57 | em.thread_exit(); 58 | em.new_epoch(); 59 | em.new_epoch(); 60 | em.new_epoch(); 61 | DEFER(em.thread_fini()); 62 | } 63 | -------------------------------------------------------------------------------- /tests/dlog/test_dlog.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "../../dbcore/dlog.h" 4 | #include "../../macros.h" 5 | 6 | void insert_one() { 7 | ermia::dlog::tls_log tlog; 8 | tlog.initialize("./", 0, 0, 1); 9 | 10 | ermia::dlog::log_block zero_lb; 11 | zero_lb.csn = 100; 12 | tlog.insert(&zero_lb); 13 | tlog.uninitialize(); 14 | 15 | int fd = open("tlog-00000000-00000000", O_RDWR, 0644); 16 | ermia::dlog::log_block read_lb; 17 | read_lb.csn = 999; 18 | read_lb.payload_size = 888; 19 | 20 | int ret = read(fd, &read_lb, sizeof(read_lb)); 21 | ALWAYS_ASSERT(ret == sizeof(read_lb)); 22 | ALWAYS_ASSERT(read_lb.csn == 100); 23 | ALWAYS_ASSERT(read_lb.payload_size == 0); 24 | close(fd); 25 | } 26 | 27 | void insert_many() { 28 | ermia::dlog::tls_log tlog; 29 | tlog.initialize("./", 0, 0, 1); 30 | uint64_t log_size = 0; 31 | 32 | for (uint32_t i = 0; i < 10000; ++i) { 33 | ermia::dlog::log_block *lb = (ermia::dlog::log_block *)malloc(sizeof(ermia::dlog::log_block) + 2 * i); 34 | lb->csn = i; 35 | lb->payload_size = i * 2; 36 | tlog.insert(lb); 37 | log_size += lb->total_size(); 38 | printf("Record payload: %u, total: %u\n", lb->payload_size, lb->total_size()); 39 | free(lb); 40 | } 41 | tlog.uninitialize(); 42 | printf("total size = %lu\n", log_size); 43 | 44 | /* 45 | int fd = open("tlog-00000000-00000000", O_RDWR, 0644); 46 | ermia::dlog::log_block read_lb; 47 | read_lb.csn = 999; 48 | read_lb.payload_size = 888; 49 | 50 | int ret = read(fd, &read_lb, sizeof(read_lb)); 51 | ALWAYS_ASSERT(ret == sizeof(read_lb)); 52 | ALWAYS_ASSERT(read_lb.csn == 100); 53 | ALWAYS_ASSERT(read_lb.payload_size == 0); 54 | close(fd); 55 | */ 56 | } 57 | 58 | 59 | int main(int argc, char **argv) { 60 | insert_one(); 61 | insert_many(); 62 | } 63 | 64 | -------------------------------------------------------------------------------- /dbcore/sm-common.cpp: -------------------------------------------------------------------------------- 1 | #include "sm-common.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "rcu.h" 14 | 15 | namespace ermia { 16 | 17 | size_t os_pread(int fd, char *buf, size_t bufsz, off_t offset) { 18 | size_t n = 0; 19 | while (n < bufsz) { 20 | ssize_t m = pread(fd, buf + n, bufsz - n, offset + n); 21 | if (not m) break; 22 | LOG_IF(FATAL, m < 0) << "Error reading " << bufsz 23 | << " bytes from file at offset " << offset; 24 | n += m; 25 | } 26 | return n; 27 | } 28 | 29 | int os_dup(int fd) { 30 | int rval = dup(fd); 31 | THROW_IF(rval < 0, os_error, errno, "Unable to duplicate fd %d", fd); 32 | return rval; 33 | } 34 | 35 | dirent_iterator::dirent_iterator(char const *dname) 36 | : _d(opendir(dname)), used(false) { 37 | THROW_IF(not _d, os_error, errno, "Unable to open/create directory: %s", 38 | dname); 39 | } 40 | 41 | dirent_iterator::~dirent_iterator() { 42 | int err = closedir(_d); 43 | WARN_IF(err, "Closing dirent iterator gave errno %d", errno); 44 | } 45 | 46 | void dirent_iterator::iterator::operator++() { 47 | errno = 0; 48 | _dent = readdir(_d); 49 | if (not _dent) { 50 | THROW_IF(errno, os_error, errno, "Error during directory scan"); 51 | _d = NULL; 52 | } 53 | } 54 | 55 | dirent_iterator::iterator dirent_iterator::begin() { 56 | if (used) rewinddir(_d); 57 | 58 | used = true; 59 | iterator rval{_d, NULL}; 60 | ++rval; // prime it 61 | return rval; 62 | } 63 | 64 | dirent_iterator::iterator dirent_iterator::end() { 65 | return iterator{NULL, NULL}; 66 | } 67 | 68 | int dirent_iterator::dup() { return os_dup(dirfd(_d)); } 69 | } // namespace ermia 70 | -------------------------------------------------------------------------------- /masstree/kvstats.hh: -------------------------------------------------------------------------------- 1 | /* Masstree 2 | * Eddie Kohler, Yandong Mao, Robert Morris 3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College 4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, subject to the conditions 9 | * listed in the Masstree LICENSE file. These conditions include: you must 10 | * preserve this copyright notice, and you cannot mention the copyright 11 | * holders in advertising related to the Software without their permission. 12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This 13 | * notice is a summary of the Masstree LICENSE file; the license in that file 14 | * is legally binding. 15 | */ 16 | #ifndef KVSTATS_HH 17 | #define KVSTATS_HH 1 18 | #include 19 | 20 | struct kvstats { 21 | double min, max, sum, sumsq; 22 | long count; 23 | kvstats() : min(-1), max(-1), sum(0), sumsq(0), count(0) {} 24 | void add(double x) { 25 | if (!count || x < min) min = x; 26 | if (max < x) max = x; 27 | sum += x; 28 | sumsq += x * x; 29 | count += 1; 30 | } 31 | typedef void (kvstats::*unspecified_bool_type)(double); 32 | operator unspecified_bool_type() const { return count ? &kvstats::add : 0; } 33 | void print_report(const char *name) const { 34 | if (count) 35 | printf( 36 | "%s: n %ld, total %.0f, average %.0f, min %.0f, max %.0f, stddev " 37 | "%.0f\n", 38 | name, count, sum, sum / count, min, max, 39 | sqrt((sumsq - sum * sum / count) / (count - 1))); 40 | } 41 | double avg() { 42 | if (count) 43 | return sum / count; 44 | else 45 | return 0; 46 | } 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /tests/coroutine/coroutine_test_base.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | 11 | using namespace ermia::dia; 12 | 13 | template 14 | class CoroutineTestBase : public ::testing::Test { 15 | public: 16 | CoroutineTestBase() {} 17 | ~CoroutineTestBase() {} 18 | 19 | void addTask(task &&task_to_run) { 20 | future_tasks_.emplace_back(std::move(task_to_run)); 21 | } 22 | 23 | void runTasksUntilComplete() { 24 | for(auto & t : future_tasks_) { 25 | t.start(); 26 | } 27 | 28 | while (1) { 29 | bool hasUnfinishedTasks = false; 30 | for (uint32_t i = 0; i < future_tasks_.size(); i++) { 31 | task &task = future_tasks_[i]; 32 | if (!task.done()) { 33 | hasUnfinishedTasks = true; 34 | task.resume(); 35 | } 36 | } 37 | 38 | if (!hasUnfinishedTasks) { 39 | break; 40 | } 41 | } 42 | } 43 | 44 | std::vector getReturnValues() { 45 | std::vector rets; 46 | rets.reserve(future_tasks_.size()); 47 | 48 | for (task &task : future_tasks_) { 49 | assert(task.done()); 50 | rets.emplace_back(task.get_return_value()); 51 | } 52 | 53 | return rets; 54 | } 55 | 56 | virtual void run() = 0; 57 | 58 | virtual void SetUp() override { 59 | std::srand(std::time(nullptr)); 60 | } 61 | virtual void TearDown() override { 62 | for (task &task : future_tasks_) { 63 | task.destroy(); 64 | } 65 | } 66 | 67 | private: 68 | std::vector> future_tasks_; 69 | coro_task_private::memory_pool memory_pool_; 70 | }; 71 | 72 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/google/sparsetable: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Header files have moved from the google directory to the sparsehash 31 | // directory. This forwarding file is provided only for backwards 32 | // compatibility. Use in all new code. 33 | 34 | #include 35 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/google/dense_hash_map: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Header files have moved from the google directory to the sparsehash 31 | // directory. This forwarding file is provided only for backwards 32 | // compatibility. Use in all new code. 33 | 34 | #include 35 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/google/dense_hash_set: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Header files have moved from the google directory to the sparsehash 31 | // directory. This forwarding file is provided only for backwards 32 | // compatibility. Use in all new code. 33 | 34 | #include 35 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/google/sparse_hash_map: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Header files have moved from the google directory to the sparsehash 31 | // directory. This forwarding file is provided only for backwards 32 | // compatibility. Use in all new code. 33 | 34 | #include 35 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/google/sparse_hash_set: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Header files have moved from the google directory to the sparsehash 31 | // directory. This forwarding file is provided only for backwards 32 | // compatibility. Use in all new code. 33 | 34 | #include 35 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/google/template_util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Header files have moved from the google directory to the sparsehash 31 | // directory. This forwarding file is provided only for backwards 32 | // compatibility. Use in all new code. 33 | 34 | #include 35 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/google/type_traits.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Header files have moved from the google directory to the sparsehash 31 | // directory. This forwarding file is provided only for backwards 32 | // compatibility. Use in all new code. 33 | 34 | #include 35 | -------------------------------------------------------------------------------- /benchmarks/oddlb-schemas.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "record/encoder.h" 4 | #include "record/inline_str.h" 5 | 6 | #define ODDLB_KEY_FIELDS(x, y) x(uint64_t, o_key) 7 | #define ODDLB_VALUE_1_FIELDS(x, y) \ 8 | x(uint64_t, o_value_version) y(uint64_t, o_value_a) y(uint64_t, o_value_b) 9 | DO_STRUCT(oddlb_kv_1, ODDLB_KEY_FIELDS, ODDLB_VALUE_1_FIELDS); 10 | 11 | #define ODDLB_VALUE_2_FIELDS(x, y) \ 12 | x(uint64_t, o_value_version) y(uint64_t, o_value_a) y(uint64_t, o_value_b) \ 13 | y(uint64_t, o_value_c) 14 | DO_STRUCT(oddlb_kv_2, ODDLB_KEY_FIELDS, ODDLB_VALUE_2_FIELDS); 15 | 16 | #define ODDLB_VALUE_3_FIELDS(x, y) \ 17 | x(uint64_t, o_value_version) y(uint64_t, o_value_a) y(uint64_t, o_value_b) \ 18 | y(uint64_t, o_value_c) y(uint64_t, o_value_d) 19 | DO_STRUCT(oddlb_kv_3, ODDLB_KEY_FIELDS, ODDLB_VALUE_3_FIELDS); 20 | 21 | #define ODDLB_VALUE_4_FIELDS(x, y) \ 22 | x(uint64_t, o_value_version) y(uint64_t, o_value_a) y(uint64_t, o_value_b) \ 23 | y(uint64_t, o_value_c) y(uint64_t, o_value_d) y(uint64_t, o_value_e) 24 | DO_STRUCT(oddlb_kv_4, ODDLB_KEY_FIELDS, ODDLB_VALUE_4_FIELDS); 25 | 26 | #define ODDLB_VALUE_5_FIELDS(x, y) \ 27 | x(uint64_t, o_value_version) y(uint64_t, o_value_a) y(uint64_t, o_value_b) \ 28 | y(uint64_t, o_value_c) y(uint64_t, o_value_d) y(uint64_t, o_value_e) \ 29 | y(uint64_t, o_value_f) 30 | DO_STRUCT(oddlb_kv_5, ODDLB_KEY_FIELDS, ODDLB_VALUE_5_FIELDS); 31 | 32 | #define ODDLB_VALUE_6_FIELDS(x, y) \ 33 | x(uint64_t, o_value_version) y(uint64_t, o_value_a) y(uint64_t, o_value_b) \ 34 | y(uint64_t, o_value_c) y(uint64_t, o_value_d) y(uint64_t, o_value_e) \ 35 | y(uint64_t, o_value_f) y(uint64_t, o_value_g) 36 | DO_STRUCT(oddlb_kv_6, ODDLB_KEY_FIELDS, ODDLB_VALUE_6_FIELDS); 37 | -------------------------------------------------------------------------------- /masstree/mtcounters.hh: -------------------------------------------------------------------------------- 1 | /* Masstree 2 | * Eddie Kohler, Yandong Mao, Robert Morris 3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College 4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, subject to the conditions 9 | * listed in the Masstree LICENSE file. These conditions include: you must 10 | * preserve this copyright notice, and you cannot mention the copyright 11 | * holders in advertising related to the Software without their permission. 12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This 13 | * notice is a summary of the Masstree LICENSE file; the license in that file 14 | * is legally binding. 15 | */ 16 | #ifndef MTCOUNTERS_HH 17 | #define MTCOUNTERS_HH 1 18 | 19 | enum memtag { 20 | memtag_none = 0x0, 21 | memtag_value = 0x1, 22 | memtag_limbo = 0x5, 23 | memtag_masstree_leaf = 0x10, 24 | memtag_masstree_internode = 0x11, 25 | memtag_masstree_ksuffixes = 0x12, 26 | memtag_masstree_gc = 0x13 27 | }; 28 | 29 | enum threadcounter { 30 | // order is important among tc_alloc constants: 31 | tc_alloc, 32 | tc_alloc_value = tc_alloc, 33 | tc_alloc_other = tc_alloc + 1, 34 | // end tc_alloc constants 35 | tc_gc, 36 | tc_limbo_slots, 37 | tc_replay_create_delta, 38 | tc_replay_remove_delta, 39 | tc_root_retry, 40 | tc_internode_retry, 41 | tc_leaf_retry, 42 | tc_leaf_walk, 43 | // order is important among tc_stable constants: 44 | tc_stable, 45 | tc_stable_internode_insert = tc_stable + 0, 46 | tc_stable_internode_split = tc_stable + 1, 47 | tc_stable_leaf_insert = tc_stable + 2, 48 | tc_stable_leaf_split = tc_stable + 3, 49 | // end tc_stable constants 50 | tc_internode_lock, 51 | tc_leaf_lock, 52 | tc_max 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /benchmarks/egen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set_property(GLOBAL APPEND PROPERTY ALL_SRC 2 | ${CMAKE_CURRENT_SOURCE_DIR}/AddressTable.cpp 3 | ${CMAKE_CURRENT_SOURCE_DIR}/BaseLogger.cpp 4 | ${CMAKE_CURRENT_SOURCE_DIR}/bucketsimulator.cpp 5 | ${CMAKE_CURRENT_SOURCE_DIR}/CE.cpp 6 | ${CMAKE_CURRENT_SOURCE_DIR}/CETxnInputGenerator.cpp 7 | ${CMAKE_CURRENT_SOURCE_DIR}/CETxnMixGenerator.cpp 8 | ${CMAKE_CURRENT_SOURCE_DIR}/CustomerSelection.cpp 9 | ${CMAKE_CURRENT_SOURCE_DIR}/CustomerTable.cpp 10 | ${CMAKE_CURRENT_SOURCE_DIR}/DateTime.cpp 11 | ${CMAKE_CURRENT_SOURCE_DIR}/DM.cpp 12 | ${CMAKE_CURRENT_SOURCE_DIR}/EGenGenerateAndLoad.cpp 13 | ${CMAKE_CURRENT_SOURCE_DIR}/EGenLoader.cpp 14 | ${CMAKE_CURRENT_SOURCE_DIR}/EGenLogFormatterTab.cpp 15 | ${CMAKE_CURRENT_SOURCE_DIR}/EGenValidate.cpp 16 | ${CMAKE_CURRENT_SOURCE_DIR}/EGenVersion.cpp 17 | ${CMAKE_CURRENT_SOURCE_DIR}/error.cpp 18 | ${CMAKE_CURRENT_SOURCE_DIR}/FlatFileLoader.cpp 19 | ${CMAKE_CURRENT_SOURCE_DIR}/InputFlatFilesStructure.cpp 20 | ${CMAKE_CURRENT_SOURCE_DIR}/locking.cpp 21 | ${CMAKE_CURRENT_SOURCE_DIR}/MEE.cpp 22 | ${CMAKE_CURRENT_SOURCE_DIR}/MEEPriceBoard.cpp 23 | ${CMAKE_CURRENT_SOURCE_DIR}/MEESecurity.cpp 24 | ${CMAKE_CURRENT_SOURCE_DIR}/MEETickerTape.cpp 25 | ${CMAKE_CURRENT_SOURCE_DIR}/MEETradingFloor.cpp 26 | ${CMAKE_CURRENT_SOURCE_DIR}/Money.cpp 27 | ${CMAKE_CURRENT_SOURCE_DIR}/Person.cpp 28 | ${CMAKE_CURRENT_SOURCE_DIR}/progressmeter.cpp 29 | ${CMAKE_CURRENT_SOURCE_DIR}/progressmeterinterface.cpp 30 | ${CMAKE_CURRENT_SOURCE_DIR}/Random.cpp 31 | ${CMAKE_CURRENT_SOURCE_DIR}/ReadRowFunctions.cpp 32 | #${CMAKE_CURRENT_SOURCE_DIR}/ReadRowFunctions_istream.cpp 33 | #${CMAKE_CURRENT_SOURCE_DIR}/ReadRowFunctions_sscanf.cpp 34 | ${CMAKE_CURRENT_SOURCE_DIR}/strutil.cpp 35 | ${CMAKE_CURRENT_SOURCE_DIR}/threading.cpp 36 | ${CMAKE_CURRENT_SOURCE_DIR}/TradeGen.cpp 37 | ${CMAKE_CURRENT_SOURCE_DIR}/WheelTime.cpp 38 | ) 39 | file(COPY flat DESTINATION ${CMAKE_BINARY_DIR}/benchmarks/egen) 40 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/google/sparsehash/densehashtable.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Header files have moved from the google directory to the sparsehash 31 | // directory. This forwarding file is provided only for backwards 32 | // compatibility. Use in all new code. 33 | 34 | #include 35 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/google/sparsehash/sparsehashtable.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Header files have moved from the google directory to the sparsehash 31 | // directory. This forwarding file is provided only for backwards 32 | // compatibility. Use in all new code. 33 | 34 | #include 35 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/google/sparsehash/hashtable-common.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Header files have moved from the google directory to the sparsehash 31 | // directory. This forwarding file is provided only for backwards 32 | // compatibility. Use in all new code. 33 | 34 | #include 35 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/google/sparsehash/libc_allocator_with_realloc.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // Header files have moved from the google directory to the sparsehash 31 | // directory. This forwarding file is provided only for backwards 32 | // compatibility. Use in all new code. 33 | 34 | #include 35 | -------------------------------------------------------------------------------- /masstree/LICENSE: -------------------------------------------------------------------------------- 1 | This software is subject to the license below, which is referenced 2 | elsewhere using the phrase "the Masstree LICENSE file". This license 3 | is an MIT license, plus a clause (taken from the W3C license) 4 | requiring prior written permission to use our names in publicity. The 5 | AUTHORS file lists the people who have contributed to this software. 6 | 7 | =========================================================================== 8 | 9 | (c) 2011-2013 President and Fellows of Harvard College 10 | (c) 2010-2011 Regents of the University of California 11 | (c) 2010-2013 Massachusetts Institute of Technology 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a 14 | copy of this software and associated documentation files (the "Software"), 15 | to deal in the Software without restriction, including without limitation 16 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 17 | and/or sell copies of the Software, and to permit persons to whom the 18 | Software is furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in 21 | all copies or substantial portions of the Software. 22 | 23 | The name and trademarks of copyright holders may NOT be used in advertising 24 | or publicity pertaining to the Software without specific, written prior 25 | permission. Title to copyright in this Software and any associated 26 | documentation will at all times remain with copyright holders. 27 | 28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 31 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 33 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 34 | DEALINGS IN THE SOFTWARE. 35 | -------------------------------------------------------------------------------- /benchmarks/egen/NullLoad_stdafx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Sergey Vasilevskiy 35 | */ 36 | 37 | #ifndef EGEN_NULLLOADER_STDAFX_H 38 | #define EGEN_NULLLOADER_STDAFX_H 39 | 40 | #include "NullLoader.h" 41 | #include "NullLoaderFactory.h" 42 | 43 | #endif // #ifndef EGEN_NULLLOADER_STDAFX_H 44 | -------------------------------------------------------------------------------- /benchmarks/egen/EGenBaseLoader_stdafx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Sergey Vasilevskiy 35 | */ 36 | 37 | #ifndef EGEN_BASELOADER_STDAFX_H 38 | #define EGEN_BASELOADER_STDAFX_H 39 | 40 | #include "BaseLoader.h" 41 | #include "BaseLoaderFactory.h" 42 | 43 | #endif // #ifndef EGEN_BASELOADER_STDAFX_H 44 | -------------------------------------------------------------------------------- /dbcore/tests/test-dynarray.cpp: -------------------------------------------------------------------------------- 1 | #include "dynarray.h" 2 | 3 | #include "sm-common.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | sigjmp_buf jbuf; 12 | 13 | extern "C" void handler(int, siginfo_t *si, void *) { 14 | ASSERT(si->si_code); 15 | siglongjmp(jbuf, si->si_code); 16 | } 17 | 18 | static void access(dynarray &d, size_t offset, bool should_fault) { 19 | fprintf(stderr, "About to make an access, should %sfault\n", 20 | should_fault ? "" : "not "); 21 | #ifdef __CYGWIN__ 22 | if (should_fault) { 23 | /* Our code enters an infinite loop on cygwin due to 24 | repeatedly retrying the same seg fault. The handler is 25 | never called. 26 | */ 27 | fprintf(stderr, 28 | " (Never mind. Skipping because Cygwin can't catch SIGSEGV.)\n"); 29 | return; 30 | } 31 | #endif 32 | if (int err = sigsetjmp(jbuf, 1)) { 33 | ASSERT(should_fault); 34 | ASSERT(err == SEGV_ACCERR); 35 | fprintf(stderr, " Faulted, as designed\n"); 36 | } else { 37 | // first time 38 | d[offset] = 0; 39 | ASSERT(not should_fault); 40 | fprintf(stderr, " No fault, as designed\n"); 41 | } 42 | } 43 | 44 | int main() { 45 | dynarray dummy; 46 | 47 | // test movable status 48 | dummy = dynarray(1024 * 1024, 1); 49 | 50 | // not copyable 51 | // dynarray d2(dummy); 52 | 53 | // swappable 54 | dynarray d; 55 | swap(dummy, d); 56 | 57 | struct sigaction sa; 58 | memset(&sa, 0, sizeof(sa)); 59 | sa.sa_sigaction = &handler; 60 | sa.sa_flags = SA_SIGINFO; 61 | sigemptyset(&sa.sa_mask); 62 | int err = sigaction(SIGSEGV, &sa, NULL); 63 | THROW_IF(err, os_error, errno, "Call to sigaction() failed"); 64 | 65 | access(d, d.size() - 1, false); 66 | access(d, d.size(), true); 67 | 68 | access(d, d.size() - 1, false); 69 | access(d, d.size(), true); 70 | 71 | d.resize(2 * d.size()); 72 | access(d, d.size() - 1, false); 73 | access(d, d.size(), true); 74 | 75 | d.truncate(d.size() / 2); 76 | access(d, d.size() - 1, false); 77 | access(d, d.size(), true); 78 | } 79 | -------------------------------------------------------------------------------- /masstree/timestamp.hh: -------------------------------------------------------------------------------- 1 | /* Masstree 2 | * Eddie Kohler, Yandong Mao, Robert Morris 3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College 4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, subject to the conditions 9 | * listed in the Masstree LICENSE file. These conditions include: you must 10 | * preserve this copyright notice, and you cannot mention the copyright 11 | * holders in advertising related to the Software without their permission. 12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This 13 | * notice is a summary of the Masstree LICENSE file; the license in that file 14 | * is legally binding. 15 | */ 16 | #ifndef TIMESTAMP_HH 17 | #define TIMESTAMP_HH 18 | #include 19 | #include 20 | #include 21 | 22 | #include "compiler.hh" 23 | 24 | #if HAVE_INT64_T_IS_LONG_LONG 25 | #define PRIuKVTS "llu" 26 | #else 27 | #define PRIuKVTS "lu" 28 | #endif 29 | #define PRIKVTSPARTS "%lu.%06lu" 30 | 31 | #define KVTS_HIGHPART(t) ((unsigned long)((t) >> 32)) 32 | #define KVTS_LOWPART(t) ((unsigned long)(uint32_t)(t)) 33 | 34 | typedef uint64_t kvtimestamp_t; 35 | 36 | inline kvtimestamp_t timestamp() { 37 | struct timeval tv; 38 | gettimeofday(&tv, 0); 39 | return ((kvtimestamp_t)tv.tv_sec << 32) | (unsigned int)tv.tv_usec; 40 | } 41 | 42 | inline kvtimestamp_t timestamp_sub(kvtimestamp_t a, kvtimestamp_t b) { 43 | a -= b; 44 | if (KVTS_LOWPART(a) > 999999) a -= ((kvtimestamp_t)1 << 32) - 1000000; 45 | return a; 46 | } 47 | 48 | extern kvtimestamp_t initial_timestamp; 49 | 50 | inline double now() { 51 | struct timeval tv; 52 | gettimeofday(&tv, 0); 53 | return tv.tv_sec + tv.tv_usec / 1000000.0; 54 | } 55 | 56 | inline struct timespec &set_timespec(struct timespec &x, double y) { 57 | double ipart = floor(y); 58 | x.tv_sec = (long)ipart; 59 | x.tv_nsec = (long)((y - ipart) * 1e9); 60 | return x; 61 | } 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /benchmarks/egen/ReadRowFunctions.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Matt Emmerton 35 | */ 36 | 37 | /* 38 | * This file allows compile-time selection of the type of ReadRowFunctions to 39 | * use at runtime - C++-style istream (the default) or C-style sscanf. 40 | */ 41 | 42 | #ifdef READROW_SSCANF 43 | #include "ReadRowFunctions_sscanf.cpp" 44 | #else 45 | #include "ReadRowFunctions_istream.cpp" 46 | #endif 47 | -------------------------------------------------------------------------------- /tests/masstree/gbench_main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | void ermia_init() { 9 | ermia::config::node_memory_gb = 10; 10 | ermia::config::num_backups = 0; 11 | 12 | // FIXME: hack to cover all the numa nodes 13 | ermia::config::numa_spread = true; 14 | ermia::config::physical_workers_only = true; 15 | ermia::config::threads = 4; 16 | 17 | ermia::thread::Initialize(); 18 | ermia::config::init(); 19 | ermia::MM::prepare_node_memory(); 20 | } 21 | 22 | int main(int argc, char** argv) { 23 | const char PERF_EVENT[] = "--perf_record_event"; 24 | const char ENABLE_PERF[] = "--enable_perf"; 25 | bool FLAGS_enable_perf = false; 26 | std::string FLAGS_perf_record_event = ""; 27 | for(uint32_t i = 1; i < argc; i++) { 28 | std::string curArg = std::string(argv[i]); 29 | if(curArg == ENABLE_PERF) { 30 | FLAGS_enable_perf = true; 31 | continue; 32 | } 33 | if(curArg.size() > strlen(PERF_EVENT) && 34 | curArg.substr(0, strlen(PERF_EVENT)) == PERF_EVENT && 35 | curArg[strlen(PERF_EVENT)] == '=') { 36 | FLAGS_perf_record_event = curArg.substr(strlen(PERF_EVENT) + 1); 37 | } 38 | } 39 | std::cout << "perf event: " << FLAGS_perf_record_event << std::endl; 40 | 41 | if (FLAGS_enable_perf) { 42 | std::vector nargv; 43 | for (uint32_t i = 0; i < argc; i++) { 44 | nargv.emplace_back(argv[i]); 45 | } 46 | 47 | // ensure each perf runs only 1 iteration 48 | std::string ss = "--benchmark_min_time=0"; 49 | nargv.emplace_back(const_cast(ss.c_str())); 50 | 51 | ermia::config::enable_perf = FLAGS_enable_perf; 52 | ermia::config::perf_record_event = FLAGS_perf_record_event; 53 | 54 | int nargc = nargv.size(); 55 | ::benchmark::Initialize(&nargc, nargv.data()); 56 | } else { 57 | ::benchmark::Initialize(&argc, argv); 58 | } 59 | 60 | ermia_init(); 61 | ::benchmark::RunSpecifiedBenchmarks(); 62 | } 63 | 64 | -------------------------------------------------------------------------------- /benchmarks/egen/unusedflag.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Christopher Chan-Nui 35 | */ 36 | /* 37 | * This file is only to provide a define which can hint some compilers that 38 | * certain parameters are unused. 39 | */ 40 | #ifndef UNUSEDFLAG_H_INCLUDED 41 | #define UNUSEDFLAG_H_INCLUDED 42 | #ifdef __GNUC__ 43 | #define UNUSED __attribute__((unused)) 44 | #else 45 | #define UNUSED 46 | #endif 47 | #endif // UNUSEDFLAG_H_INCLUDED 48 | -------------------------------------------------------------------------------- /dbcore/tests/test-cslist.cpp: -------------------------------------------------------------------------------- 1 | #include "cslist.h" 2 | 3 | #include 4 | #include 5 | 6 | #define LOG(msg, ...) fprintf(stderr, msg, ##__VA_ARGS__) 7 | struct node { 8 | node *next; 9 | int payload; 10 | }; 11 | typedef cslist mylist; 12 | int main() { 13 | mylist list; 14 | 15 | static size_t const nnodes = 7; 16 | node nodes[nnodes]; 17 | LOG("Pushing %zd nodes at the tail of the list, for popping in FIFO order\n", 18 | nnodes); 19 | for (size_t i = 0; i < nnodes; i++) { 20 | nodes[i].payload = i + 1; 21 | list.push_tail(nodes + i); 22 | } 23 | 24 | LOG("Popping the list until empty.\n\tExpected: 1 2 ... %zd\n\tFound: ", 25 | nnodes); 26 | while (node *n = list.pop_head()) { 27 | LOG(" %d", n->payload); 28 | } 29 | 30 | LOG("\n\nPushing %zd nodes at the head of the list, for popping in LIFO " 31 | "order\n", 32 | nnodes); 33 | for (size_t i = 0; i < nnodes; i++) { 34 | nodes[i].payload = i + 1; 35 | list.push_head(nodes + i); 36 | } 37 | 38 | LOG("Popping the list until empty.\n\tExpected: %zd ... 2 1\n\tFound: ", 39 | nnodes); 40 | while (node *n = list.pop_head()) { 41 | LOG(" %d", n->payload); 42 | } 43 | 44 | LOG("\n\nAlternating pushes to head and tail\n"); 45 | for (size_t i = 0; i < nnodes; i++) { 46 | nodes[i].payload = i + 1; 47 | if (i % 2) 48 | list.push_head(nodes + i); 49 | else 50 | list.push_tail(nodes + i); 51 | } 52 | 53 | LOG("Iterating over the list.\n\tExpected: %zd ... 2 1 3 ... %zd\n\tFound: " 54 | " ", 55 | nnodes - 1, nnodes); 56 | for (mylist::iterator it = list.begin(); it != list.end(); ++it) { 57 | LOG(" %d", it->payload); 58 | } 59 | 60 | LOG("\nPopping the list until empty.\n\tExpected: %zd ... 2 1 3 ... " 61 | "%zd\n\tFound: ", 62 | nnodes - 1, nnodes); 63 | while (node *n = list.pop_head()) { 64 | LOG(" %d", n->payload); 65 | } 66 | 67 | LOG("\n\nThe list should be empty now: %s\n", 68 | list.empty() ? "true" : "false"); 69 | LOG("Iterating over the empty list.\n\tExpected: \n\tFound: "); 70 | for (mylist::iterator it = list.begin(); it != list.end(); ++it) { 71 | LOG(" %d", it->payload); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /benchmarks/egen/EGenNullLoader_stdafx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Sergey Vasilevskiy 35 | */ 36 | 37 | // stdafx.h : include file for standard system include files, 38 | // or project specific include files that are used frequently, but 39 | // are changed infrequently 40 | // 41 | 42 | #ifndef EGEN_NULLLOADER_STDAFX_H 43 | #define EGEN_NULLLOADER_STDAFX_H 44 | 45 | #include "NullLoader.h" 46 | #include "NullLoaderFactory.h" 47 | 48 | #endif // #ifndef EGEN_NULLLOADER_STDAFX_H 49 | -------------------------------------------------------------------------------- /masstree/compiler.cc: -------------------------------------------------------------------------------- 1 | /* Masstree 2 | * Eddie Kohler, Yandong Mao, Robert Morris 3 | * Copyright (c) 2012-2014 President and Fellows of Harvard College 4 | * Copyright (c) 2012-2014 Massachusetts Institute of Technology 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, subject to the conditions 9 | * listed in the Masstree LICENSE file. These conditions include: you must 10 | * preserve this copyright notice, and you cannot mention the copyright 11 | * holders in advertising related to the Software without their permission. 12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This 13 | * notice is a summary of the Masstree LICENSE file; the license in that file 14 | * is legally binding. 15 | */ 16 | #include "compiler.hh" 17 | 18 | #include 19 | #include 20 | 21 | void fail_always_assert(const char* file, int line, const char* assertion, 22 | const char* message) { 23 | if (message) 24 | fprintf(stderr, "assertion \"%s\" [%s] failed: file \"%s\", line %d\n", 25 | message, assertion, file, line); 26 | else 27 | fprintf(stderr, "assertion \"%s\" failed: file \"%s\", line %d\n", 28 | assertion, file, line); 29 | abort(); 30 | } 31 | 32 | void fail_masstree_invariant(const char* file, int line, const char* assertion, 33 | const char* message) { 34 | if (message) 35 | fprintf(stderr, "invariant \"%s\" [%s] failed: file \"%s\", line %d\n", 36 | message, assertion, file, line); 37 | else 38 | fprintf(stderr, "invariant \"%s\" failed: file \"%s\", line %d\n", 39 | assertion, file, line); 40 | abort(); 41 | } 42 | 43 | void fail_masstree_precondition(const char* file, int line, 44 | const char* assertion, const char* message) { 45 | if (message) 46 | fprintf(stderr, "precondition \"%s\" [%s] failed: file \"%s\", line %d\n", 47 | message, assertion, file, line); 48 | else 49 | fprintf(stderr, "precondition \"%s\" failed: file \"%s\", line %d\n", 50 | assertion, file, line); 51 | abort(); 52 | } 53 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatFileLoad_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Chris Ruemmler 35 | */ 36 | 37 | #ifndef FLAT_FILE_LOAD_COMMON_H 38 | #define FLAT_FILE_LOAD_COMMON_H 39 | 40 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 41 | 42 | #include 43 | #include 44 | #include 45 | 46 | #include "FlatFileLoader.h" 47 | #include "Table_Defs.h" 48 | #include "DateTime.h" 49 | #include "error.h" 50 | 51 | #endif // #ifndef FLAT_FILE_LOAD_COMMON_H 52 | -------------------------------------------------------------------------------- /masstree/str.cc: -------------------------------------------------------------------------------- 1 | /* Masstree 2 | * Eddie Kohler, Yandong Mao, Robert Morris 3 | * Copyright (c) 2012-2013 President and Fellows of Harvard College 4 | * Copyright (c) 2012-2013 Massachusetts Institute of Technology 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, subject to the conditions 9 | * listed in the Masstree LICENSE file. These conditions include: you must 10 | * preserve this copyright notice, and you cannot mention the copyright 11 | * holders in advertising related to the Software without their permission. 12 | * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This 13 | * notice is a summary of the Masstree LICENSE file; the license in that file 14 | * is legally binding. 15 | */ 16 | #include "str.hh" 17 | namespace lcdf { 18 | 19 | const Str Str::maxkey( 20 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 21 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 22 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 23 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 24 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 25 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 26 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 27 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 28 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 29 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 30 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 31 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 32 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 33 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 34 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 35 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 36 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 37 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 38 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 39 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 40 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 41 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 42 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 43 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 44 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 45 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 46 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 47 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 48 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 49 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 50 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 51 | "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" 52 | "\xFF", 53 | 257); 54 | 55 | } // namespace lcdf 56 | -------------------------------------------------------------------------------- /benchmarks/egen/SecurityPriceRange.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /****************************************************************************** 38 | * Description: Minimum and maximum values for a security's price range 39 | ******************************************************************************/ 40 | 41 | #ifndef SECURITY_PRICE_RANGE_H 42 | #define SECURITY_PRICE_RANGE_H 43 | 44 | namespace TPCE 45 | { 46 | 47 | const double fMinSecPrice = 20.00; 48 | const double fMaxSecPrice = 30.00; 49 | 50 | } //namespace TPCE 51 | 52 | #endif //SECURITY_PRICE_RANGE_H 53 | -------------------------------------------------------------------------------- /dbcore/burt-hash.h: -------------------------------------------------------------------------------- 1 | // -*- mode:c++ -*- 2 | #pragma once 3 | 4 | #include 5 | 6 | #include 7 | 8 | /* A family of fast, high-quality integer hashes due to Bob Jenkins 9 | [1]. He identifies 35 compact functions that achieve "full 10 | avalanche" status where toggling any bit of the input toggles 11 | 25-75% of output bits. These hashes are thus especially useful with 12 | power of two-sized hash tables. The integer versions require 13 | roughly 20 machine instructions and employ only shift, add/sub, and 14 | xor operations. The SIMD version is just as fast, but applies the 15 | hash function to four values simultaneously. 16 | 17 | [1] http://burtleburtle.net/bob/hash/integer.html 18 | */ 19 | struct burt_hash { 20 | typedef uint32_t(function)(uint32_t); 21 | 22 | static function *select_hash(uint32_t selector); 23 | 24 | burt_hash(uint32_t selector = 0) : fn(select_hash(selector)) {} 25 | 26 | uint32_t operator()(uint32_t x) const { return fn(x); } 27 | 28 | function *fn; 29 | }; 30 | 31 | struct burt_hash4 { 32 | typedef __v4si(function)(__v4si); 33 | 34 | static function *select_hash(uint32_t selector); 35 | 36 | burt_hash4(uint32_t selector = 0) : fn(select_hash(selector)) {} 37 | 38 | /* Emulate hashing one value with four different functions by 39 | hashing four different byte-permutations of the input. To avoid 40 | interacting badly with hash functions' habit of using 41 | bidirectional shifts (= rotations, if you squint), no two 42 | permutations are rotations of each other and no byte is placed 43 | in the same position twice. 44 | 45 | The first computed value is equivalent to the one computed by 46 | the integer function. 47 | 48 | The hope is that this will work well, given high-quality hash 49 | functions, but that has not been verified empirically. 50 | */ 51 | __v4si operator()(int32_t xi) const { 52 | __v4si x = {xi}; 53 | #ifdef __clang__ 54 | x = (__v4si)__builtin_shufflevector((__v16qi)x, (__v16qi)x, 0, 1, 2, 3, 3, 55 | 2, 0, 1, 2, 3, 1, 0, 1, 0, 3, 2); 56 | #else 57 | __v16qi k = {0, 1, 2, 3, 3, 2, 0, 1, 2, 3, 1, 0, 1, 0, 3, 2}; 58 | x = (__v4si)__builtin_shuffle((__v16qi)x, k); 59 | #endif 60 | return operator()(x); 61 | } 62 | 63 | __v4si operator()(__v4si x) const { return fn(x); } 64 | 65 | function *fn; 66 | }; 67 | -------------------------------------------------------------------------------- /benchmarks/egen/progressmeterinterface.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Christopher Chan-Nui 35 | */ 36 | 37 | #include "progressmeterinterface.h" 38 | #include "unusedflag.h" 39 | 40 | namespace TPCE 41 | { 42 | 43 | // Dummy implementation in case someone wants to have a null progress meter 44 | ProgressMeterInterface::~ProgressMeterInterface() 45 | { 46 | } 47 | 48 | void ProgressMeterInterface::display() const 49 | { 50 | } 51 | 52 | void ProgressMeterInterface::inc(int count UNUSED) 53 | { 54 | } 55 | 56 | void ProgressMeterInterface::message(const std::string& mesg UNUSED, int level UNUSED) 57 | { 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /benchmarks/egen/DriverTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Matt Emmerton 35 | */ 36 | 37 | /****************************************************************************** 38 | * Description: Driver types and names 39 | ******************************************************************************/ 40 | 41 | #ifndef DRIVER_TYPES_H 42 | #define DRIVER_TYPES_H 43 | 44 | namespace TPCE 45 | { 46 | 47 | enum eDriverType 48 | { 49 | eDriverEGenLoader, 50 | eDriverAll, 51 | eDriverCE, 52 | eDriverMEE, 53 | eDriverDM, 54 | eDriverMax 55 | }; 56 | 57 | extern char szDriverTypeNames[eDriverMax][14]; 58 | } // namespace TPCE 59 | 60 | 61 | #endif // DRIVER_TYPES_H 62 | -------------------------------------------------------------------------------- /benchmarks/egen/MEETradeRequestActions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /****************************************************************************** 38 | * Description: These are the different actions the MEE can take 39 | * with an inbound trade request. 40 | ******************************************************************************/ 41 | 42 | #ifndef MEE_TRADE_REQUEST_ACTIONS_H 43 | #define MEE_TRADE_REQUEST_ACTIONS_H 44 | 45 | namespace TPCE 46 | { 47 | 48 | enum eMEETradeRequestAction 49 | { 50 | eMEEProcessOrder = 0, 51 | eMEESetLimitOrderTrigger 52 | }; 53 | 54 | } //namespace TPCE 55 | 56 | #endif //MEE_TRADE_REQUEST_ACTIONS_H 57 | -------------------------------------------------------------------------------- /dbcore/tests/test-window-buffer.cpp: -------------------------------------------------------------------------------- 1 | #include "window-buffer.h" 2 | 3 | #include "sm-defs.h" 4 | #include "w_rand.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | int main() { 11 | try { 12 | window_buffer buf(1 << 16); 13 | 14 | // test ability to fill and then empty 15 | size_t wstart = buf.write_begin(); 16 | char *wbuf = buf.write_buf(wstart, buf.available_to_write()); 17 | ASSERT(wbuf); 18 | for (size_t i = 0; i < buf.available_to_write(); i++) wbuf[i] = (char)i; 19 | 20 | buf.advance_writer(buf.write_end()); 21 | 22 | size_t rstart = buf.read_begin(); 23 | char const *rbuf = buf.read_buf(rstart, buf.available_to_read()); 24 | ASSERT(rbuf); 25 | for (size_t i = 0; i < buf.available_to_read(); i++) 26 | ASSERT(rbuf[i] == (char)i); 27 | 28 | buf.advance_reader(buf.read_end()); 29 | ASSERT(buf.available_to_write() == buf.window_size()); 30 | 31 | // now mix it up 32 | w_rand rng; 33 | size_t rbytes = buf.read_begin(); 34 | size_t wbytes = buf.write_begin(); 35 | std::deque reference; 36 | while (rbytes < 128 * 1024 * 1024) { 37 | if (rng.randn(2)) { 38 | // try to write some number of bytes 39 | size_t avail = buf.available_to_write(); 40 | if (not avail) continue; 41 | 42 | size_t nbytes = rng.randn(1, avail); 43 | char *wbuf = buf.write_buf(wbytes, nbytes); 44 | for (size_t i = 0; i < nbytes; i++) { 45 | char val = (char)rng.randn(256); 46 | reference.push_back(val); 47 | wbuf[i] = val; 48 | } 49 | wbytes += nbytes; 50 | buf.advance_writer(wbytes); 51 | } else { 52 | // try to read some bytes 53 | size_t avail = buf.available_to_read(); 54 | if (not avail) continue; 55 | 56 | size_t nbytes = rng.randn(1, avail); 57 | char const *rbuf = buf.read_buf(rbytes, nbytes); 58 | for (size_t i = 0; i < nbytes; i++) { 59 | char val = reference.front(); 60 | reference.pop_front(); 61 | ASSERT(rbuf[i] == val); 62 | } 63 | rbytes += nbytes; 64 | buf.advance_reader(rbytes); 65 | } 66 | } 67 | while (not reference.empty()) { 68 | char val = reference.front(); 69 | reference.pop_front(); 70 | ASSERT(val == *buf.read_buf(rbytes, 1)); 71 | rbytes++; 72 | buf.advance_reader(rbytes); 73 | } 74 | } catch (...) { 75 | fprintf(stderr, "Yikes!\n"); 76 | exit(-1); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /benchmarks/egen/TxnHarnessTradeCleanup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Matt Emmerton 35 | */ 36 | 37 | #ifndef TXN_HARNESS_TRADE_CLEANUP_H 38 | #define TXN_HARNESS_TRADE_CLEANUP_H 39 | 40 | #include "TxnHarnessDBInterface.h" 41 | 42 | namespace TPCE 43 | { 44 | 45 | class CTradeCleanup 46 | { 47 | CTradeCleanupDBInterface* m_db; 48 | 49 | public: 50 | CTradeCleanup(CTradeCleanupDBInterface *pDB) 51 | : m_db(pDB) 52 | { 53 | } 54 | 55 | rc_t DoTxn( PTradeCleanupTxnInput pTxnInput, PTradeCleanupTxnOutput pTxnOutput) 56 | { 57 | TXN_HARNESS_SET_STATUS_SUCCESS; 58 | 59 | TryReturn(m_db->DoTradeCleanupFrame1(pTxnInput)); 60 | return rc_t{RC_TRUE}; 61 | } 62 | }; 63 | 64 | } // namespace TPCE 65 | 66 | #endif //TXN_HARNESS_TRADE_CLEANUP_H 67 | -------------------------------------------------------------------------------- /dbcore/size-encode.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "sm-defs.h" 7 | 8 | namespace ermia { 9 | 10 | /* 11 | Encode a non-negative size in 8 bits, using a format similar to 12 | floating point. As with a floating point representation, precision 13 | decreases as the magnitude increases. Also as with floating point, 14 | the encoding is order-preserving and codes can be compared directly. 15 | 16 | The encoding can represent values ranging from 0 (0x00) to 950272 17 | (0xfe); 0xff is reserved as NaN/invalid. To avoid clipping objects, 18 | the input is always rounded up to the next representable value 19 | before encoding it, with a maximum rounding error of 6.25%. 20 | 21 | Notably, the encoding represents nearly all k*2**i <= 928k exactly, 22 | for integer 0 < k < 32 and integer 0 <= i < 20. The only exceptions 23 | are: 25*2 (52), 27*2 (56), 29*2 (60), 31*2 (64), 29*4 (120), 31*4 24 | (128), 31*8 (256). It also represents several other "interesting" k 25 | exactly because those k often contain powers of two. For example 26 | 100*2**i = 25*2**(i+2) is always exact. 27 | 28 | Encoding is somewhat expensive (in no small part due to the 29 | requirement that we round up), but decoding is quite fast, requiring 30 | only 13 machine instructions (one branch) on x86_64 31 | */ 32 | uint8_t encode_size(size_t sz); 33 | 34 | /* Encode a size, aligning it to the power of two given (in bits) and 35 | rounding up to the nearest value that can be encoded exactly. 36 | 37 | Also, update [sz] to the aligned/rounded size. 38 | */ 39 | uint8_t encode_size_aligned(size_t &sz, 40 | size_t align_bits = DEFAULT_ALIGNMENT_BITS); 41 | 42 | /* Decode a size code returned by encode_size. 43 | 44 | Size codes are used to size allocations, and because they are 45 | approximate the allocation may be slightly larger than the object 46 | that occupies it. If this matters, the user (or the object) is 47 | responsible to track the object's true size in some other way. 48 | 49 | A value of zero decodes to zero, and INVALID_SIZE_CODE decodes to 50 | INVALID_SIZE; all other values decode to something between 1 and 51 | 950272. 52 | */ 53 | size_t decode_size(uint8_t code); 54 | 55 | static inline size_t decode_size_aligned( 56 | uint8_t code, size_t align_bits = DEFAULT_ALIGNMENT_BITS) { 57 | return decode_size(code) << align_bits; 58 | } 59 | 60 | static uint8_t const INVALID_SIZE_CODE = 0xff; 61 | static size_t const MAX_ENCODABLE_SIZE = 950272; 62 | static size_t const INVALID_SIZE = -1; 63 | 64 | } // namespace ermia 65 | -------------------------------------------------------------------------------- /benchmarks/egen/EGenGenerateAndLoad_stdafx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Sergey Vasilevskiy 35 | */ 36 | 37 | #ifndef EGEN_GENERATE_AND_LOAD_STDAFX_H 38 | #define EGEN_GENERATE_AND_LOAD_STDAFX_H 39 | 40 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | using namespace std; 52 | 53 | #include "EGenTables_stdafx.h" 54 | #include "EGenBaseLoader_stdafx.h" 55 | #include "EGenGenerateAndLoadBaseOutput.h" 56 | #include "EGenGenerateAndLoadStandardOutput.h" 57 | #include "DriverParamSettings.h" 58 | #include "EGenLogger.h" 59 | #include "EGenGenerateAndLoad.h" 60 | 61 | #endif // #ifndef EGEN_GENERATE_AND_LOAD_STDAFX_H 62 | -------------------------------------------------------------------------------- /benchmarks/egen/TxnHarnessDataMaintenance.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Sergey Vasilevskiy 35 | */ 36 | 37 | #ifndef TXN_HARNESS_DATA_MAINTENANCE_H 38 | #define TXN_HARNESS_DATA_MAINTENANCE_H 39 | 40 | #include "TxnHarnessDBInterface.h" 41 | 42 | namespace TPCE 43 | { 44 | 45 | class CDataMaintenance 46 | { 47 | CDataMaintenanceDBInterface* m_db; 48 | 49 | public: 50 | CDataMaintenance(CDataMaintenanceDBInterface *pDB) 51 | : m_db(pDB) 52 | { 53 | }; 54 | 55 | rc_t DoTxn( PDataMaintenanceTxnInput pTxnInput, PDataMaintenanceTxnOutput pTxnOutput ) 56 | { 57 | TXN_HARNESS_SET_STATUS_SUCCESS; 58 | 59 | // Execute Frame 1 60 | TryReturn(m_db->DoDataMaintenanceFrame1(pTxnInput)); 61 | return rc_t{RC_TRUE}; 62 | } 63 | }; 64 | 65 | } // namespace TPCE 66 | 67 | #endif //TXN_HARNESS_DATA_MAINTENANCE_H 68 | -------------------------------------------------------------------------------- /benchmarks/egen/EGenTables_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Chris Ruemmler 35 | */ 36 | 37 | #ifndef EGEN_TABLES_COMMON_H 38 | #define EGEN_TABLES_COMMON_H 39 | 40 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | 54 | using namespace std; 55 | 56 | #include "EGenStandardTypes.h" 57 | #include "EGenUtilities_stdafx.h" 58 | #include "Table_Defs.h" 59 | #include "TableTemplate.h" 60 | #include "InputFlatFilesDeclarations.h" 61 | #include "InputFlatFilesStructure.h" 62 | #include "InputFileNoWeight.h" 63 | #include "Person.h" 64 | #include "CustomerSelection.h" 65 | 66 | #endif // #ifndef EGEN_TABLES_COMMON_H 67 | -------------------------------------------------------------------------------- /benchmarks/egen/TradeTypeIDs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /****************************************************************************** 38 | * Description: Trade Type IDs corresponding to the TradeType.txt flat 39 | * file. 40 | * Note: The order of enumeration members must match the 41 | * order of rows in the TradeType.txt flat file. 42 | ******************************************************************************/ 43 | 44 | #ifndef TRADE_TYPE_IDS_H 45 | #define TRADE_TYPE_IDS_H 46 | 47 | namespace TPCE 48 | { 49 | 50 | enum eTradeTypeID 51 | { 52 | eMarketBuy = 0, 53 | eMarketSell, 54 | eStopLoss, 55 | eLimitSell, 56 | eLimitBuy, 57 | 58 | eMaxTradeTypeID // should be the last - contains the number of items in the enumeration 59 | }; 60 | 61 | } //namespace TPCE 62 | 63 | #endif //TRADE_TYPE_IDS_H 64 | -------------------------------------------------------------------------------- /benchmarks/egen/error.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Sergey Vasilevskiy 35 | */ 36 | 37 | #include "EGenUtilities_stdafx.h" // Windows-specific error file 38 | 39 | using namespace TPCE; 40 | 41 | CSystemErr::CSystemErr(Action eAction, char const * szLocation) 42 | : CBaseErr(szLocation) 43 | , m_eAction(eAction) 44 | { 45 | #ifdef WIN32 46 | m_idMsg = GetLastError(); //for Windows 47 | #elif (__unix) || (_AIX) 48 | m_idMsg = errno; //for Unix 49 | #else 50 | #error No system error routine defined. 51 | #endif 52 | } 53 | 54 | CSystemErr::CSystemErr(int iError, Action eAction, char const * szLocation) 55 | : CBaseErr(szLocation) 56 | , m_eAction(eAction) 57 | { 58 | // This constructor is provided for registry functions where the function return code 59 | // is the error code. 60 | m_idMsg = iError; 61 | } 62 | 63 | const char * CSystemErr::ErrorText() const 64 | { 65 | return strerror(m_idMsg); 66 | } 67 | -------------------------------------------------------------------------------- /dbcore/tests/test-size-encode.cpp: -------------------------------------------------------------------------------- 1 | #include "size-encode.h" 2 | 3 | // Intentional -- tester needs access to private state... 4 | #include "size-encode.cpp" 5 | 6 | #include "sm-defs.h" 7 | 8 | #include 9 | 10 | int main() { 11 | for (auto it : enumerate(_encode_size_tab)) { 12 | printf("%6d ", (int)it.second); 13 | if (not((it.first + 1) % 8)) printf("\n"); 14 | } 15 | 16 | printf("FYI: min/max representable values: %zd %zd\n", decode_size(0x00), 17 | decode_size(0xfe)); 18 | printf("Verify that code -> value -> code is consistent...\n"); 19 | for (int i = 0; i < 256; i++) { 20 | int x = decode_size(i); 21 | int j = encode_size(x); 22 | if (j != i) 23 | printf("\tOops! Non-reversible code: %02x -> %6d -> %02x\n", i, x, j); 24 | } 25 | 26 | printf("Verify decoding of the two edge cases...\n"); 27 | int val; 28 | if ((val = decode_size(0))) 29 | printf("\tOops! Zero code decodes to %d (instead of 0)\n", val); 30 | if ((val = decode_size(0xff)) != -1) 31 | printf("\tOops! Invalid code decodes to %d (instead of (-1)\n", val); 32 | 33 | printf("Verify encoding of the two edge cases...\n"); 34 | int code; 35 | if ((code = encode_size(0))) printf("\tOops! Zero encodes to %02x\n", code); 36 | if ((code = encode_size(decode_size(0xff))) != 0xff) 37 | printf("\tOops! Out of range value %zd encodes to %02x\n", 38 | decode_size(0xff), code); 39 | 40 | printf("Verify we always round sizes up...\n"); 41 | for (int i = EFIRST(0); i < (int)ELAST(15); i++) { 42 | uint8_t code = encode_size(i); 43 | int j = decode_size(code); 44 | if (j < i) printf("\tOops! %6d -> %02x -> %6d\n", i, code, j); 45 | } 46 | 47 | printf("Verify we don't round sizes up too far...\n"); 48 | for (int i = EFIRST(1); i < (int)ELAST(15); i++) { 49 | uint8_t code = encode_size(i); 50 | int j = decode_size(code - 1); 51 | if (j >= i) 52 | printf("\tOops! %6d -> %02x, but %02x -> %6d\n", i, code, code - 1, j); 53 | } 54 | 55 | printf("Verify that codes are ordered the same as their decoded values...\n"); 56 | for (int i = 1; i < 255; i++) { 57 | int a = decode_size(i - 1); 58 | int b = decode_size(i); 59 | if (a >= b) printf("\tOops! %02x < %02x -> %d >= %d\n", i - 1, i, a, b); 60 | } 61 | 62 | printf( 63 | "Check whether any multiples of powers of two are not represented " 64 | "exactly (expect 7)...\n"); 65 | for (size_t i = 2; decode_size(encode_size(i)) == i; i *= 2) { 66 | for (int j = 2; j < 32 and encode_size(j * i) != 0xff; j++) { 67 | if (decode_size(encode_size(j * i)) != j * i) 68 | printf("\t%d * %zd = %zd -> %zd\n", j, i, j * i, 69 | decode_size(encode_size(j * i))); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /benchmarks/egen/locking.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Christopher Chan-Nui, Matt Emmerton 35 | */ 36 | 37 | #ifndef LOCKING_H_INCLUDED 38 | #define LOCKING_H_INCLUDED 39 | 40 | #include "EGenStandardTypes.h" 41 | 42 | namespace TPCE 43 | { 44 | 45 | // Standard mutex 46 | class CMutex 47 | { 48 | private: 49 | TMutex mutex_; 50 | TMutex* mutex(); 51 | public: 52 | CMutex(); 53 | ~CMutex(); 54 | void lock(); 55 | void unlock(); 56 | }; 57 | 58 | // Provide a RAII style lock for any class which supports 59 | // lock() and unlock() 60 | template 61 | class Locker 62 | { 63 | private: 64 | T& mutex_; 65 | 66 | public: 67 | explicit Locker(T& mutex) 68 | : mutex_(mutex) 69 | { 70 | mutex_.lock(); 71 | } 72 | 73 | ~Locker() { 74 | mutex_.unlock(); 75 | } 76 | }; 77 | 78 | } 79 | 80 | #endif // LOCKING_H_INCLUDED 81 | -------------------------------------------------------------------------------- /benchmarks/egen/SyncLockInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a preliminary 5 | * version of a benchmark specification being developed by the TPC. The 6 | * Work is being made available to the public for review and comment only. 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Sergey Vasilevskiy 35 | */ 36 | 37 | #ifndef SYNCLOCK_H 38 | #define SYNCLOCK_H 39 | 40 | #include 41 | 42 | /* 43 | * Syncronization lock that lets only one thread acquire it. 44 | */ 45 | 46 | namespace TPCE 47 | { 48 | 49 | class CSyncLock 50 | { 51 | pthread_mutex_t mutex; 52 | public: 53 | CSyncLock() { 54 | pthread_mutex_init(&mutex, NULL); 55 | } 56 | ~CSyncLock() { 57 | pthread_mutex_destroy(&mutex); 58 | } 59 | 60 | // Acquire lock or block until it is available 61 | void ClaimLock() { 62 | pthread_mutex_lock(&mutex); 63 | } 64 | 65 | // Release lock so that it can be acquired again 66 | void ReleaseLock() { 67 | pthread_mutex_unlock(&mutex); 68 | } 69 | }; 70 | 71 | } // namespace TPCE 72 | 73 | #endif // #ifndef SYNCLOCK_H 74 | -------------------------------------------------------------------------------- /masstree/GNUmakefile.in: -------------------------------------------------------------------------------- 1 | AR = ar 2 | CC = @CC@ 3 | CXX = @CXX@ 4 | CFLAGS = -g -W -Wall -O3 5 | DEPSDIR := .deps 6 | DEPCFLAGS = -MD -MF $(DEPSDIR)/$*.d -MP 7 | ifeq ($(strip $(MEMMGR)), ) 8 | MEMMGR = @MALLOC_LIBS@ 9 | endif 10 | ifneq ($(strip $(KEYSWAP)), ) 11 | CFLAGS += -DKEYSWAP 12 | endif 13 | ifneq ($(strip $(NOPREFETCH)), ) 14 | CFLAGS += -DNOPREFETCH 15 | endif 16 | ifneq ($(strip $(NOSUPERPAGE)), ) 17 | CFLAGS += -DNOSUPERPAGE 18 | endif 19 | LIBS = @LIBS@ -lpthread -lm 20 | LDFLAGS = @LDFLAGS@ 21 | 22 | all: test_atomics mtd mtclient mttest 23 | 24 | %.o: %.c config.h $(DEPSDIR)/stamp 25 | $(CXX) $(CFLAGS) $(DEPCFLAGS) -include config.h -c -o $@ $< 26 | 27 | %.o: %.cc config.h $(DEPSDIR)/stamp 28 | $(CXX) $(CFLAGS) $(DEPCFLAGS) -include config.h -c -o $@ $< 29 | 30 | %.S: %.o 31 | objdump -S $< > $@ 32 | 33 | libjson.a: json.o string.o straccum.o str.o msgpack.o \ 34 | clp.o kvrandom.o compiler.o kvthread.o 35 | @/bin/rm -f $@ 36 | $(AR) cru $@ $^ 37 | 38 | KVTREES = query_masstree.o \ 39 | value_string.o value_array.o value_versioned_array.o \ 40 | string_slice.o 41 | 42 | mtd: mtd.o log.o checkpoint.o file.o misc.o $(KVTREES) \ 43 | kvio.o libjson.a 44 | $(CXX) $(CFLAGS) -o $@ $^ $(MEMMGR) $(LDFLAGS) $(LIBS) 45 | 46 | mtclient: mtclient.o misc.o testrunner.o kvio.o libjson.a 47 | $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) 48 | 49 | mttest: mttest.o misc.o checkpoint.o $(KVTREES) testrunner.o \ 50 | kvio.o libjson.a 51 | $(CXX) $(CFLAGS) -o $@ $^ $(MEMMGR) $(LDFLAGS) $(LIBS) 52 | 53 | test_string: test_string.o string.o straccum.o compiler.o 54 | $(CXX) $(CFLAGS) -o $@ $^ $(MEMMGR) $(LDFLAGS) $(LIBS) 55 | 56 | test_atomics: test_atomics.o string.o straccum.o kvrandom.o \ 57 | json.o compiler.o kvio.o 58 | $(CXX) $(CFLAGS) -o $@ $^ $(MEMMGR) $(LDFLAGS) $(LIBS) 59 | 60 | jsontest: jsontest.o string.o straccum.o json.o compiler.o 61 | $(CXX) $(CFLAGS) -o $@ $^ $(MEMMGR) $(LDFLAGS) $(LIBS) 62 | 63 | msgpacktest: msgpacktest.o string.o straccum.o json.o compiler.o msgpack.o 64 | $(CXX) $(CFLAGS) -o $@ $^ $(MEMMGR) $(LDFLAGS) $(LIBS) 65 | 66 | config.h: stamp-h 67 | 68 | GNUmakefile: GNUmakefile.in config.status 69 | CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status 70 | 71 | configure config.h.in: configure.ac 72 | autoreconf -i 73 | touch config.h.in 74 | 75 | config.status: configure 76 | ./configure @ac_configure_args@ 77 | 78 | $(DEPSDIR)/stamp: 79 | mkdir -p $(DEPSDIR) 80 | touch $@ 81 | 82 | stamp-h: config.h.in config.status 83 | CONFIG_FILES= $(SHELL) ./config.status 84 | echo > stamp-h 85 | 86 | clean: 87 | rm -f mtd mtclient mttest test_string test_atomics *.o libjson.a 88 | rm -rf .deps 89 | 90 | DEPFILES := $(wildcard $(DEPSDIR)/*.d) 91 | ifneq ($(DEPFILES),) 92 | include $(DEPFILES) 93 | endif 94 | 95 | .PHONY: clean all 96 | -------------------------------------------------------------------------------- /benchmarks/egen/progressmeterinterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Christopher Chan-Nui 35 | */ 36 | 37 | #ifndef PROGRESSMETERINTERFACE_H_INCLUDED 38 | #define PROGRESSMETERINTERFACE_H_INCLUDED 39 | 40 | #include 41 | 42 | namespace TPCE 43 | { 44 | 45 | // Interface to provide a simple progress indicator 46 | // Also an interface to display messages through. 47 | class ProgressMeterInterface 48 | { 49 | public: 50 | virtual ~ProgressMeterInterface(); 51 | 52 | // Display the current work status. 53 | virtual void display() const; 54 | 55 | // Mark some work done 56 | // count - amount of "work" completed 57 | virtual void inc(int count=1); 58 | 59 | // Print out an arbitrary message 60 | // mesg - message to display 61 | // level - level of message for verbosity filtering 62 | virtual void message(const std::string& mesg, int level=0); 63 | }; 64 | 65 | } 66 | 67 | #endif // PROGRESSMETER_H_INCLUDED 68 | -------------------------------------------------------------------------------- /benchmarks/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # $1 - executable 3 | # $2 - benchmark 4 | # $3 - scale factor (not applicable to TPC-E*) 5 | # $4 - num of threads 6 | # $5 - runtime 7 | # $6 - other parameters like --retry-aborted-transactions 8 | # $7 - other parameters for the workload, e.g., --fast-new-order-id-gen 9 | 10 | if [[ $# -lt 5 ]]; then 11 | echo "Too few arguments. " 12 | echo "Usage $0 " 13 | exit 14 | fi 15 | 16 | LOGDIR=/dev/shm/$USER/ermia-log 17 | mkdir -p $LOGDIR 18 | trap "rm -f $LOGDIR/*" EXIT 19 | 20 | exe=$1; shift 21 | workload=$1; shift 22 | sf=$1; shift # TPCE default sf=500 23 | threads=$1; shift 24 | runtime=$1; shift 25 | 26 | bench=${workload:0:4} 27 | 28 | if [[ "$bench" != "oddl" && "$bench" != "tpce" && "$bench" != "ycsb" && "$bench" != "tpcc" ]]; then 29 | echo "Unsupported benchmark $bench." 30 | fi 31 | 32 | if [ -z ${logbuf_kb+x} ]; then 33 | logbuf_kb=1024 34 | echo "logbuf_kb is unset, using $logbuf_kb"; 35 | else 36 | echo "logbuf_kb is set to $logbuf_kb"; 37 | fi 38 | 39 | options="$exe $1 -verbose=1 -benchmark $bench -threads $threads -scale_factor $sf -seconds $runtime \ 40 | -log_data_dir $LOGDIR -log_buffer_kb=$logbuf_kb -parallel_loading" 41 | echo $options 42 | if [ "$bench" == "tpcc" ]; then 43 | btype=${workload:4:1} 44 | wh_spread=0 45 | if [ "$btype" == "h" ]; then 46 | suppliers_x=${workload:5} 47 | suppliers=`expr $suppliers_x \* 100` 48 | $options -benchmark_options "--workload-mix="40,38,0,4,4,4,10,0" --suppliers=$suppliers --warehouse-spread=$wh_spread $2" 49 | elif [ "$btype" == "+" ]; then 50 | $options -benchmark_options "--workload-mix="41,43,4,4,4,4,0,0" --warehouse-spread=$wh_spread $2" 51 | elif [ "$btype" == "r" ]; then 52 | $options -benchmark_options "--workload-mix="0,0,0,0,50,50,0,0" --warehouse-spread=$wh_spread $2" 53 | else 54 | if [ "$workload" == "tpcc_contention" ]; then 55 | wh_spread="100" 56 | fi 57 | $options -benchmark_options "--workload-mix="45,43,0,4,4,4,0,0" --warehouse-spread=$wh_spread $2" 58 | fi 59 | elif [ "$bench" == "tpce" ]; then 60 | if [ "$workload" == "tpce_org" ]; then 61 | $options -benchmark_options "--egen-dir ./benchmarks/egen/flat/egen_flat_in --customer 5000 --working-days 10 --workload-mix="4.9,13,1,18,14,8,10.1,10,19,2,0" $2" 62 | else 63 | query_rng=${workload:4} 64 | $options -benchmark_options "--query-range $query_rng --egen-dir ./benchmarks/egen/flat/egen_flat_in --customer 5000 --working-days 10 --workload-mix="4.9,8,1,13,14,8,10.1,10,9,2,20" $2" 65 | fi 66 | elif [ "$bench" == "ycsb" ]; then 67 | $options -benchmark_options "$2" 68 | elif [ "$bench" == "oddl" ]; then 69 | $options -benchmark_options "$2" 70 | else 71 | echo "Unspported benchmark $bench." 72 | fi 73 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatSectorLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for SECTOR. 39 | */ 40 | #ifndef FLAT_SECTOR_LOAD_H 41 | #define FLAT_SECTOR_LOAD_H 42 | 43 | #include "FlatFileLoad_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CFlatSectorLoad : public CFlatFileLoader 49 | { 50 | public: 51 | CFlatSectorLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode){}; 52 | 53 | /* 54 | * Writes a record to the file. 55 | */ 56 | void WriteNextRecord(PT next_record) 57 | { 58 | int rc = fprintf( hOutFile, SectorRowFmt, 59 | next_record->SC_ID, 60 | next_record->SC_NAME 61 | ); 62 | if (rc < 0) { 63 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatSectorLoad::WriteNextRecord"); 64 | } 65 | } 66 | }; 67 | 68 | } // namespace TPCE 69 | 70 | #endif //FLAT_SECTOR_LOAD_H 71 | -------------------------------------------------------------------------------- /str_arena.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "dbcore/sm-common.h" 7 | #include "dbcore/sm-config.h" 8 | #include "varstr.h" 9 | 10 | namespace ermia { 11 | class str_arena { 12 | public: 13 | static const size_t MinStrReserveLength = 2 * CACHELINE_SIZE; 14 | str_arena(uint32_t size_mb) : n(0) { 15 | // Make sure arena is only initialized after config is initialized so we 16 | // have a valid size 17 | ALWAYS_ASSERT(size_mb == config::arena_size_mb); 18 | 19 | // adler32 (log checksum) needs it aligned 20 | ALWAYS_ASSERT(not posix_memalign((void **)&str, DEFAULT_ALIGNMENT, 21 | size_mb * config::MB)); 22 | memset(str, '\0', config::arena_size_mb * config::MB); 23 | reset(); 24 | } 25 | 26 | // non-copyable/non-movable for the time being 27 | str_arena(str_arena &&) = delete; 28 | str_arena(const str_arena &) = delete; 29 | str_arena &operator=(const str_arena &) = delete; 30 | 31 | inline void reset() { 32 | ASSERT(n < config::arena_size_mb * config::MB); 33 | n = 0; 34 | } 35 | 36 | varstr *next(uint64_t size) { 37 | uint64_t off = n; 38 | n += align_up(size + sizeof(varstr)); 39 | ASSERT(n < config::arena_size_mb * config::MB); 40 | varstr *ret = new (str + off) varstr(str + off + sizeof(varstr), size); 41 | return ret; 42 | } 43 | 44 | // Assume the caller is the benchmark using str(Size(v)) 45 | inline void return_space(uint64_t size) { 46 | n -= (align_up(size + sizeof(varstr))); 47 | } 48 | 49 | varstr *atomic_next(uint64_t size) { 50 | uint64_t off = __atomic_fetch_add(&n, align_up(size + sizeof(varstr)), 51 | __ATOMIC_ACQ_REL); 52 | ASSERT(n < config::arena_size_mb * config::MB); 53 | varstr *ret = new (str + off) varstr(str + off + sizeof(varstr), size); 54 | return ret; 55 | } 56 | 57 | inline varstr *operator()(uint64_t size) { return next(size); } 58 | 59 | bool manages(const varstr *px) const { 60 | return (const char *)px >= str and 61 | (uint64_t) px->data() + px->size() <= (uint64_t)str + n; 62 | } 63 | 64 | private: 65 | char *str; 66 | size_t n; 67 | }; 68 | 69 | class scoped_str_arena { 70 | public: 71 | scoped_str_arena(str_arena *arena) : arena(arena) {} 72 | 73 | scoped_str_arena(str_arena &arena) : arena(&arena) {} 74 | 75 | scoped_str_arena(scoped_str_arena &&) = default; 76 | 77 | // non-copyable 78 | scoped_str_arena(const scoped_str_arena &) = delete; 79 | scoped_str_arena &operator=(const scoped_str_arena &) = delete; 80 | 81 | ~scoped_str_arena() { 82 | if (arena) arena->reset(); 83 | } 84 | 85 | ALWAYS_INLINE str_arena *get() { return arena; } 86 | 87 | private: 88 | str_arena *arena; 89 | }; 90 | } // namespace ermia 91 | -------------------------------------------------------------------------------- /benchmarks/egen/EGenError.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /****************************************************************************** 38 | * Description: Error handling functionality for the EGen package. 39 | ******************************************************************************/ 40 | 41 | #ifndef EGEN_ERROR_H 42 | #define EGEN_ERROR_H 43 | 44 | #include 45 | 46 | using namespace std; 47 | 48 | namespace TPCE 49 | { 50 | 51 | class CEGenErrorMessages 52 | { 53 | private: 54 | public: 55 | }; 56 | 57 | class CEGenErrorException 58 | { 59 | private: 60 | string m_Msg; 61 | 62 | public: 63 | CEGenErrorException( string Msg ) 64 | { 65 | m_Msg = Msg; 66 | } 67 | 68 | ~CEGenErrorException( void ) 69 | { 70 | } 71 | 72 | void AddMsg( string Msg ) 73 | { 74 | m_Msg += Msg; 75 | } 76 | 77 | string Msg( void ) 78 | { 79 | return( m_Msg ); 80 | } 81 | }; 82 | 83 | } // namespace TPCE 84 | 85 | #endif //EGEN_ERROR_H 86 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatNewsXRefLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for NEWS_XREF. 39 | */ 40 | #ifndef FLAT_NEWS_XREF_LOAD_H 41 | #define FLAT_NEWS_XREF_LOAD_H 42 | 43 | #include "FlatFileLoad_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CFlatNewsXRefLoad : public CFlatFileLoader 49 | { 50 | public: 51 | CFlatNewsXRefLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode) {}; 52 | 53 | /* 54 | * Writes a record to the file. 55 | */ 56 | void WriteNextRecord(PT next_record) 57 | { 58 | int rc = fprintf( hOutFile, NewsXRefRowFmt, 59 | next_record->NX_NI_ID, 60 | next_record->NX_CO_ID 61 | ); 62 | if (rc < 0) { 63 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatNewsXRefLoad::WriteNextRecord"); 64 | } 65 | } 66 | }; 67 | 68 | } // namespace TPCE 69 | 70 | #endif //FLAT_NEWS_XREF_LOAD_H 71 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatWatchListLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for WATCH_LIST. 39 | */ 40 | #ifndef FLAT_WATCH_LIST_LOAD_H 41 | #define FLAT_WATCH_LIST_LOAD_H 42 | 43 | #include "FlatFileLoad_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CFlatWatchListLoad : public CFlatFileLoader 49 | { 50 | public: 51 | CFlatWatchListLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode){}; 52 | 53 | /* 54 | * Writes a record to the file. 55 | */ 56 | void WriteNextRecord(PT next_record) 57 | { 58 | int rc = fprintf( hOutFile, WatchListRowFmt, 59 | next_record->WL_ID, 60 | next_record->WL_C_ID 61 | ); 62 | if (rc < 0) { 63 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatWatchListLoad::WriteNextRecord"); 64 | } 65 | } 66 | }; 67 | 68 | } // namespace TPCE 69 | 70 | #endif //FLAT_WATCH_LIST_LOAD_H 71 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatWatchItemLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for WATCH_ITEM. 39 | */ 40 | #ifndef FLAT_WATCH_ITEM_LOAD_H 41 | #define FLAT_WATCH_ITEM_LOAD_H 42 | 43 | #include "FlatFileLoad_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CFlatWatchItemLoad : public CFlatFileLoader 49 | { 50 | public: 51 | CFlatWatchItemLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode){}; 52 | 53 | /* 54 | * Writes a record to the file. 55 | */ 56 | void WriteNextRecord(PT next_record) 57 | { 58 | int rc = fprintf( hOutFile, WatchItemRowFmt, 59 | next_record->WI_WL_ID, 60 | next_record->WI_S_SYMB 61 | ); 62 | if (rc < 0) { 63 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatWatchItemLoad::WriteNextRecord"); 64 | } 65 | } 66 | }; 67 | 68 | } // namespace TPCE 69 | 70 | #endif //FLAT_WATCH_ITEM_LOAD_H 71 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatChargeLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for CHARGE. 39 | */ 40 | #ifndef FLAT_CHARGE_LOAD_H 41 | #define FLAT_CHARGE_LOAD_H 42 | 43 | #include "FlatFileLoad_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CFlatChargeLoad : public CFlatFileLoader 49 | { 50 | public: 51 | CFlatChargeLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode){}; 52 | 53 | /* 54 | * Writes a record to the file. 55 | */ 56 | void WriteNextRecord(PT next_record) 57 | { 58 | int rc = fprintf( hOutFile, ChargeRowFmt, 59 | next_record->CH_TT_ID, 60 | next_record->CH_C_TIER, 61 | next_record->CH_CHRG 62 | ); 63 | if (rc < 0) { 64 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatChargeLoad::WriteNextRecord"); 65 | } 66 | } 67 | }; 68 | 69 | } // namespace TPCE 70 | 71 | #endif //FLAT_CHARGE_LOAD_H 72 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatStatusTypeLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for STATUS_TYPE. 39 | */ 40 | #ifndef FLAT_STATUS_TYPE_LOAD_H 41 | #define FLAT_STATUS_TYPE_LOAD_H 42 | 43 | #include "FlatFileLoad_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CFlatStatusTypeLoad : public CFlatFileLoader 49 | { 50 | public: 51 | CFlatStatusTypeLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode){}; 52 | 53 | /* 54 | * Writes a record to the file. 55 | */ 56 | void WriteNextRecord(PT next_record) 57 | { 58 | int rc = fprintf( hOutFile, StatusTypeRowFmt, 59 | next_record->ST_ID, 60 | next_record->ST_NAME 61 | ); 62 | if (rc < 0) { 63 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatStatusType::WriteNextRecord"); 64 | } 65 | } 66 | }; 67 | 68 | } // namespace TPCE 69 | 70 | #endif //FLAT_STATUS_TYPE_LOAD_H 71 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatTaxrateLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for TAXRATE. 39 | */ 40 | #ifndef FLAT_TAXRATE_LOAD_H 41 | #define FLAT_TAXRATE_LOAD_H 42 | 43 | #include "FlatFileLoad_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CFlatTaxrateLoad : public CFlatFileLoader 49 | { 50 | public: 51 | CFlatTaxrateLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode){}; 52 | 53 | /* 54 | * Writes a record to the file. 55 | */ 56 | void WriteNextRecord(PT next_record) 57 | { 58 | int rc = fprintf( hOutFile, TaxrateRowFmt, 59 | next_record->TX_ID, 60 | next_record->TX_NAME, 61 | next_record->TX_RATE 62 | ); 63 | if (rc < 0) { 64 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatTaxrateLoad::WriteNextRecord"); 65 | } 66 | } 67 | }; 68 | 69 | } // namespace TPCE 70 | 71 | #endif //FLAT_TAXRATE_LOAD_H 72 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatZipCodeLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for ZIP_CODE. 39 | */ 40 | #ifndef FLAT_ZIP_CODE_LOAD_H 41 | #define FLAT_ZIP_CODE_LOAD_H 42 | 43 | #include "FlatFileLoad_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CFlatZipCodeLoad : public CFlatFileLoader 49 | { 50 | public: 51 | CFlatZipCodeLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode){}; 52 | 53 | /* 54 | * Writes a record to the file. 55 | */ 56 | void WriteNextRecord(PT next_record) 57 | { 58 | int rc = fprintf( hOutFile, ZipCodeRowFmt, 59 | next_record->ZC_CODE, 60 | next_record->ZC_TOWN, 61 | next_record->ZC_DIV 62 | ); 63 | if (rc < 0) { 64 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatZipCodeLoad::WriteNextRecord"); 65 | } 66 | } 67 | }; 68 | 69 | } // namespace TPCE 70 | 71 | #endif //FLAT_ZIP_CODE_LOAD_H 72 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatIndustryLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for INDUSTRY. 39 | */ 40 | #ifndef FLAT_INDUSTRY_LOAD_H 41 | #define FLAT_INDUSTRY_LOAD_H 42 | 43 | #include "FlatFileLoad_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CFlatIndustryLoad : public CFlatFileLoader 49 | { 50 | public: 51 | CFlatIndustryLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode){}; 52 | 53 | /* 54 | * Writes a record to the file. 55 | */ 56 | void WriteNextRecord(PT next_record) 57 | { 58 | int rc = fprintf( hOutFile, IndustryRowFmt, 59 | next_record->IN_ID, 60 | next_record->IN_NAME, 61 | next_record->IN_SC_ID 62 | ); 63 | if (rc < 0) { 64 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatIndustryLoad::WriteNextRecord"); 65 | } 66 | } 67 | }; 68 | 69 | } // namespace TPCE 70 | 71 | #endif //FLAT_INDUSTRY_LOAD_H 72 | -------------------------------------------------------------------------------- /benchmarks/egen/Wheel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /****************************************************************************** 38 | * Description: This file contains items that are common across timer 39 | * wheel, event wheel, and wheel time code. 40 | ******************************************************************************/ 41 | 42 | #ifndef WHEEL_H 43 | #define WHEEL_H 44 | 45 | //Use EGen standard types. 46 | #include "EGenStandardTypes.h" 47 | 48 | namespace TPCE 49 | { 50 | 51 | 52 | // Used to help define "infinitely far into the future" 53 | const INT32 MaxWheelCycles = 999999999; 54 | 55 | typedef struct TWheelConfig 56 | { 57 | INT32 WheelSize; // Total size of the wheel (based on the period and resolution) 58 | INT32 WheelResolution; // Expressed in milliseconds 59 | 60 | TWheelConfig( INT32 Size, INT32 Resolution ) 61 | : WheelSize( Size ) 62 | , WheelResolution( Resolution ) 63 | { 64 | }; 65 | } *PWheelConfig; 66 | 67 | 68 | } // namespace TPCE 69 | 70 | #endif //WHEEL_H 71 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatCustomerTaxrateLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for CUSTOMER_TAXRATE. 39 | */ 40 | #ifndef FLAT_CUSTOMER_TAXRATE_LOAD_H 41 | #define FLAT_CUSTOMER_TAXRATE_LOAD_H 42 | 43 | #include "FlatFileLoad_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CFlatCustomerTaxrateLoad : public CFlatFileLoader 49 | { 50 | public: 51 | CFlatCustomerTaxrateLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode){}; 52 | 53 | /* 54 | * Writes a record to the file. 55 | */ 56 | void WriteNextRecord(PT next_record) 57 | { 58 | int rc = fprintf( hOutFile, CustomerTaxrateRowFmt, 59 | next_record->CX_TX_ID, 60 | next_record->CX_C_ID 61 | ); 62 | if (rc < 0) { 63 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatCustomerTaxrateLoad::WriteNextRecord"); 64 | } 65 | } 66 | }; 67 | 68 | } // namespace TPCE 69 | 70 | #endif //FLAT_CUSTOMER_TAXRATE_LOAD_H 71 | -------------------------------------------------------------------------------- /dbcore/dlog-defs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace ermia { 4 | 5 | namespace dlog { 6 | 7 | // CSNs are 64-bit integers and are global; used for ordering transactions. 8 | // TLog LSNs (not to be confused with the "LSN" defined by sm-common.h and 9 | // encoded in a fat_ptr) are 64-bit integers and are local to a log; the pair uniquely identifies a log record. 11 | // 12 | // Note that out of the 64 bits, an LSN only uses 40 bits out of it, limiting 13 | // the max size of each tlog to 1TB. The rationale is to still be able to fit 14 | // the pair in 48 bits---which is the number of bits available in 15 | // a fat_ptr---so that we can encode a pair in a single fat_ptr. 16 | // Then log ids are 8-bit integers. This allows us to support up to 2^8=256 17 | // tlogs, i.e., 256 cores maximum. Should these limitations become a problem, we 18 | // could expand fat_ptrs to 16B. 19 | typedef uint64_t tlog_csn; 20 | typedef uint64_t tlog_lsn; 21 | static const tlog_csn INVALID_TLOG_CSN = ~uint64_t{0}; 22 | static const tlog_lsn INVALID_TLOG_LSN = ~uint64_t{0}; 23 | 24 | // A log block is the collection of log records generated by a transaction. A 25 | // transaction could have mutliple log blocks or a single one if the log block 26 | // is big enough to hold all the log records, this is further determined by the 27 | // log buffer and segment sizes - we cannot allow a log block to span two log 28 | // buffers or segments. 29 | // 30 | // Note that it is the "user's" job to populate a log block by laying out all 31 | // log records (log_record instances, one of another) in the [payload] part of 32 | // this structure, i.e., the log block here doesn't interpret the content of the 33 | // payload; it doesn't know about concepts such as FIDs and OIDs, which are up 34 | // to the user of dlog to use. Consequently, there is no "log record" concept 35 | // for dlog. This helps us keep a clean separation between dlog and its users. 36 | // 37 | // Upon commit dlog only deals with log blocks and copies log blocks in their 38 | // entirety to the log buffer from the transaction's scratch area (provided by 39 | // the caller). 40 | struct log_block { 41 | // CSN of the transaction who created this log block 42 | tlog_csn csn; 43 | 44 | // Size of this log block in bytes 45 | uint32_t payload_size; 46 | 47 | // Total capacity of this log block (could be greater than payload_size) 48 | uint32_t capacity; 49 | 50 | // Actual data, which in turn is an array of log records; 51 | // must be the last element 52 | char payload[0]; 53 | 54 | log_block(uint32_t cap) 55 | : csn(INVALID_TLOG_CSN), payload_size(0), capacity(cap) {} 56 | ~log_block() {} 57 | 58 | // Size of this whole log block 59 | inline uint32_t total_size() { return sizeof(*this) + payload_size; } 60 | 61 | inline char *get_payload() { return &payload[0]; } 62 | }; 63 | } // namespace dlog 64 | 65 | } // namespace ermia 66 | -------------------------------------------------------------------------------- /third-party/sparsehash/src/windows/port.cc: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007, Google Inc. 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are 6 | * met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following disclaimer 12 | * in the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Google Inc. nor the names of its 15 | * contributors may be used to endorse or promote products derived from 16 | * this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * --- 31 | * Author: Craig Silverstein 32 | */ 33 | 34 | #include 35 | #ifndef WIN32 36 | # error You should only be including windows/port.cc in a windows environment! 37 | #endif 38 | 39 | #include "config.h" 40 | #include // for va_list, va_start, va_end 41 | #include "port.h" 42 | 43 | // Calls the windows _vsnprintf, but always NUL-terminate. 44 | int snprintf(char *str, size_t size, const char *format, ...) { 45 | if (size == 0) // not even room for a \0? 46 | return -1; // not what C99 says to do, but what windows does 47 | str[size-1] = '\0'; 48 | va_list ap; 49 | va_start(ap, format); 50 | const int r = _vsnprintf(str, size-1, format, ap); 51 | va_end(ap); 52 | return r; 53 | } 54 | 55 | std::string TmpFile(const char* basename) { 56 | char tmppath_buffer[1024]; 57 | int tmppath_len = GetTempPathA(sizeof(tmppath_buffer), tmppath_buffer); 58 | if (tmppath_len <= 0 || tmppath_len >= sizeof(tmppath_buffer)) { 59 | return basename; // an error, so just bail on tmppath 60 | } 61 | snprintf(tmppath_buffer + tmppath_len, sizeof(tmppath_buffer) - tmppath_len, 62 | "\\%s", basename); 63 | return tmppath_buffer; 64 | } 65 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatHoldingSummaryLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for HOLDING_SUMMARY. 39 | */ 40 | #ifndef FLAT_HOLDING_SUMMARY_LOAD_H 41 | #define FLAT_HOLDING_SUMMARY_LOAD_H 42 | 43 | #include "FlatFileLoad_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CFlatHoldingSummaryLoad : public CFlatFileLoader 49 | { 50 | public: 51 | CFlatHoldingSummaryLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode){}; 52 | 53 | /* 54 | * Writes a record to the file. 55 | */ 56 | void WriteNextRecord(PT next_record) 57 | { 58 | int rc = fprintf( hOutFile, HoldingSummaryRowFmt, 59 | next_record->HS_CA_ID, 60 | next_record->HS_S_SYMB, 61 | next_record->HS_QTY 62 | ); 63 | if (rc < 0) { 64 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatHoldingSummaryLoad::WriteNextRecord"); 65 | } 66 | } 67 | }; 68 | 69 | } // namespace TPCE 70 | 71 | #endif //FLAT_HOLDING_SUMMARY_LOAD_H 72 | -------------------------------------------------------------------------------- /benchmarks/egen/Money.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Sergey Vasilevskiy 35 | */ 36 | 37 | /****************************************************************************** 38 | * Description: Money type that keeps all calculations in integer 39 | * number of cents. Needed for consistency of initial 40 | * database population. 41 | ******************************************************************************/ 42 | 43 | #include "EGenUtilities_stdafx.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | // Define * operator to make possible integer operand on the left 49 | // 50 | CMoney operator *(int l_i, CMoney r_m) 51 | { 52 | CMoney ret; 53 | 54 | ret = r_m * l_i; 55 | 56 | return ret; 57 | } 58 | 59 | // Define * operator to make possible double operand on the left 60 | // 61 | CMoney operator *(double l_f, CMoney r_m) 62 | { 63 | CMoney ret; 64 | 65 | ret = r_m * l_f; 66 | 67 | return ret; 68 | } 69 | 70 | // Define / operator to make possible double operand on the left 71 | // 72 | double operator /(double l_f, CMoney r_m) 73 | { 74 | return l_f / r_m.DollarAmount(); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatBrokerLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for BROKER. 39 | */ 40 | 41 | #ifndef FLAT_BROKER_LOAD_H 42 | #define FLAT_BROKER_LOAD_H 43 | 44 | #include "FlatFileLoad_common.h" 45 | 46 | namespace TPCE 47 | { 48 | 49 | class CFlatBrokerLoad : public CFlatFileLoader 50 | { 51 | public: 52 | CFlatBrokerLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode){}; 53 | 54 | /* 55 | * Writes a record to the file. 56 | */ 57 | void WriteNextRecord(PT next_record) 58 | { 59 | int rc = fprintf( hOutFile, BrokerRowFmt, 60 | next_record->B_ID, 61 | next_record->B_ST_ID, 62 | next_record->B_NAME, 63 | next_record->B_NUM_TRADES, 64 | next_record->B_COMM_TOTAL 65 | ); 66 | 67 | if (rc < 0) { 68 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatBrokerLoad::WriteNextRecord"); 69 | } 70 | } 71 | }; 72 | 73 | } // namespace TPCE 74 | 75 | #endif //FLAT_BROKER_LOAD_H 76 | -------------------------------------------------------------------------------- /benchmarks/egen/strutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Christopher Chan-Nui 35 | */ 36 | 37 | /* 38 | * Some basic string to number/time utilities 39 | */ 40 | 41 | #ifndef STRUTIL_H_INCLUDED 42 | #define STRUTIL_H_INCLUDED 43 | 44 | #include 45 | #include "EGenStandardTypes.h" 46 | 47 | using namespace std; 48 | 49 | namespace TPCE 50 | { 51 | 52 | // Converts a string to a 64 bit integer, supports the suffixes 53 | // KMG for powers of 1000 multipliers 54 | extern INT64 strtoint64 (const char *ptr); 55 | 56 | // Converts a string to a double, supports the suffixes 57 | // KMG for powers of 1000 multipliers 58 | extern double strtodbl (const char *ptr); 59 | 60 | // Converts a string in HH:MM:SS to a 64 bit integral number of seconds 61 | // HH or HH:MM are optional. Seconds over 60 may be specified. 62 | // (i.e. 1:00:00 and 3600 are equivalent) 63 | extern INT64 timestrtoint64 (const char *ptr); 64 | 65 | // Converts an integral number of seconds to the string HH:MM:SS 66 | // HH or HH:MM may be omitted if the time value is small enough 67 | extern std::string int64totimestr (INT64 val); 68 | } 69 | 70 | #endif // STRUTIL_H_INCLUDED 71 | -------------------------------------------------------------------------------- /benchmarks/egen/SectorTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Class representing the Sector table. 39 | */ 40 | #ifndef SECTOR_TABLE_H 41 | #define SECTOR_TABLE_H 42 | 43 | #include "EGenTables_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CSectorTable : public TableTemplate 49 | { 50 | ifstream InFile; 51 | 52 | public: 53 | CSectorTable( char *szDirName ) 54 | : TableTemplate() 55 | { 56 | char szFileName[iMaxPath]; 57 | 58 | strncpy(szFileName, szDirName, sizeof(szFileName)); 59 | strncat(szFileName, "Sector.txt", sizeof(szFileName) - strlen(szDirName) - 1); 60 | 61 | InFile.open( szFileName ); 62 | }; 63 | 64 | ~CSectorTable( ) 65 | { 66 | InFile.close(); 67 | }; 68 | 69 | /* 70 | * Generates all column values for the next row. 71 | */ 72 | bool GenerateNextRecord() 73 | { 74 | if( InFile.good() ) 75 | { 76 | m_row.Load(InFile); 77 | } 78 | 79 | return ( InFile.eof() ); 80 | } 81 | }; 82 | 83 | } // namespace TPCE 84 | 85 | #endif //SECTOR_TABLE_H 86 | -------------------------------------------------------------------------------- /benchmarks/egen/threading.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Christopher Chan-Nui, Matt Emmerton 35 | */ 36 | 37 | #include "threading.h" 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #include "error.h" 46 | 47 | using std::strerror; 48 | using std::exit; 49 | 50 | namespace TPCE 51 | { 52 | 53 | ThreadBase::~ThreadBase() 54 | { 55 | } 56 | 57 | #ifdef WIN32 58 | DWORD WINAPI start_thread(LPVOID arg) 59 | #else 60 | extern "C" 61 | void* start_thread(void *arg) 62 | #endif 63 | { 64 | ThreadBase* thrd = reinterpret_cast(arg); 65 | // Catch exceptions here again because we're on a new stack 66 | // so any previous try/catch blocks won't catch exceptions 67 | // thrown in this thread. 68 | try { 69 | thrd->invoke(); 70 | return NULL; 71 | } catch (std::exception& e) { 72 | std::cerr << "Caught Exception: " << e.what() << std::endl; 73 | } catch (...) { 74 | std::cerr << "Caught Exception: Unknown" << std::endl; 75 | } 76 | exit (1); 77 | return NULL; // Keep xlC happy with a return code... 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /benchmarks/egen/FlatAddressLoad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Flat file loader for Address. 39 | */ 40 | 41 | #ifndef FLAT_ADDRESS_LOAD_H 42 | #define FLAT_ADDRESS_LOAD_H 43 | 44 | #include "FlatFileLoad_common.h" 45 | 46 | namespace TPCE 47 | { 48 | 49 | class CFlatAddressLoad : public CFlatFileLoader 50 | { 51 | public: 52 | CFlatAddressLoad( char *szFileName, FlatFileOutputModes FlatFileOutputMode ) : CFlatFileLoader(szFileName, FlatFileOutputMode){}; 53 | 54 | /* 55 | * Writes a record to the file. 56 | */ 57 | void WriteNextRecord(PT next_record) 58 | { 59 | int rc = fprintf( hOutFile, AddressRowFmt, 60 | next_record->AD_ID, 61 | next_record->AD_LINE1, 62 | next_record->AD_LINE2, 63 | next_record->AD_ZC_CODE, 64 | next_record->AD_CTRY 65 | ); 66 | 67 | if (rc < 0) { 68 | throw CSystemErr(CSystemErr::eWriteFile, "CFlatAddressLoad::WriteNextRecord"); 69 | } 70 | } 71 | }; 72 | 73 | } // namespace TPCE 74 | 75 | #endif //FLAT_ADDRESS_LOAD_H 76 | -------------------------------------------------------------------------------- /benchmarks/egen/IndustryTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Legal Notice 3 | * 4 | * This document and associated source code (the "Work") is a part of a 5 | * benchmark specification maintained by the TPC. 6 | * 7 | * The TPC reserves all right, title, and interest to the Work as provided 8 | * under U.S. and international laws, including without limitation all patent 9 | * and trademark rights therein. 10 | * 11 | * No Warranty 12 | * 13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION 14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE 15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER 16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, 17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, 18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR 19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF 20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. 21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, 22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT 23 | * WITH REGARD TO THE WORK. 24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO 25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE 26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS 27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, 28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, 29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT 30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD 31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. 32 | * 33 | * Contributors 34 | * - Doug Johnson 35 | */ 36 | 37 | /* 38 | * Class representing the Industry table. 39 | */ 40 | #ifndef INDUSTRY_TABLE_H 41 | #define INDUSTRY_TABLE_H 42 | 43 | #include "EGenTables_common.h" 44 | 45 | namespace TPCE 46 | { 47 | 48 | class CIndustryTable : public TableTemplate 49 | { 50 | ifstream InFile; 51 | 52 | public: 53 | CIndustryTable( char *szDirName ) 54 | : TableTemplate() 55 | { 56 | char szFileName[iMaxPath]; 57 | 58 | strncpy(szFileName, szDirName, sizeof(szFileName)); 59 | strncat(szFileName, "Industry.txt", sizeof(szFileName) - strlen(szDirName) - 1); 60 | 61 | InFile.open( szFileName ); 62 | }; 63 | 64 | ~CIndustryTable( ) 65 | { 66 | InFile.close(); 67 | }; 68 | 69 | /* 70 | * Generates all column values for the next row. 71 | */ 72 | bool GenerateNextRecord() 73 | { 74 | if( InFile.good() ) 75 | { 76 | m_row.Load(InFile); 77 | } 78 | 79 | return ( InFile.eof() ); 80 | } 81 | }; 82 | 83 | } // namespace TPCE 84 | 85 | #endif //INDUSTRY_TABLE_H 86 | --------------------------------------------------------------------------------