├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .travis.yml ├── COPYING ├── ChangeLog ├── Dockerfile ├── Makefile.am ├── README.md ├── autogen.sh ├── config └── config.rpath ├── configure.ac ├── debian ├── changelog ├── compat ├── control ├── copyright ├── dirs ├── docs ├── install ├── rules └── source │ └── format ├── install-sh ├── m4 ├── ac_check_aio.m4 ├── ac_check_pgsql.m4 ├── acx_pthread.m4 ├── ax_check_compile_flag.m4 ├── ax_compiler_vendor.m4 ├── ax_gcc_archflag.m4 ├── ax_gcc_func_attribute.m4 ├── ax_gcc_x86_cpuid.m4 ├── ax_tls.m4 ├── extensions.m4 ├── host-cpu-c-abi.m4 ├── lib-ld.m4 ├── lib-link.m4 ├── lib-prefix.m4 ├── pkg.m4 ├── sb_autoconf_compat.m4 ├── sb_check_mysql.m4 ├── sb_concurrency_kit.m4 └── sb_luajit.m4 ├── missing ├── mkinstalldirs ├── rpm └── sysbench.spec ├── scripts └── buildpack.sh ├── snap └── snapcraft.yaml.in ├── src ├── Makefile.am ├── db_driver.c ├── db_driver.h ├── drivers │ ├── Makefile.am │ ├── mysql │ │ ├── Makefile.am │ │ └── drv_mysql.c │ └── pgsql │ │ ├── Makefile.am │ │ └── drv_pgsql.c ├── lua │ ├── Makefile.am │ ├── bulk_insert.lua │ ├── empty-test.lua │ ├── internal │ │ ├── Makefile.am │ │ ├── sysbench.cmdline.lua │ │ ├── sysbench.histogram.lua │ │ ├── sysbench.lua │ │ ├── sysbench.rand.lua │ │ └── sysbench.sql.lua │ ├── oltp_common.lua │ ├── oltp_delete.lua │ ├── oltp_insert.lua │ ├── oltp_point_select.lua │ ├── oltp_read_only.lua │ ├── oltp_read_write.lua │ ├── oltp_update_index.lua │ ├── oltp_update_non_index.lua │ ├── oltp_write_only.lua │ ├── prime-test.lua │ ├── select_random_points.lua │ └── select_random_ranges.lua ├── sb_barrier.c ├── sb_barrier.h ├── sb_ck_pr.h ├── sb_counter.c ├── sb_counter.h ├── sb_global.h ├── sb_histogram.c ├── sb_histogram.h ├── sb_list.h ├── sb_logger.c ├── sb_logger.h ├── sb_lua.c ├── sb_lua.h ├── sb_options.c ├── sb_options.h ├── sb_rand.c ├── sb_rand.h ├── sb_thread.c ├── sb_thread.h ├── sb_timer.c ├── sb_timer.h ├── sb_util.c ├── sb_util.h ├── sysbench.c ├── sysbench.h ├── tests │ ├── Makefile.am │ ├── cpu │ │ ├── Makefile.am │ │ └── sb_cpu.c │ ├── fileio │ │ ├── Makefile.am │ │ ├── crc32.c │ │ ├── crc32.h │ │ ├── crc32tbl.h │ │ └── sb_fileio.c │ ├── memory │ │ ├── Makefile.am │ │ └── sb_memory.c │ ├── mutex │ │ ├── Makefile.am │ │ └── sb_mutex.c │ ├── sb_cpu.h │ ├── sb_fileio.h │ ├── sb_memory.h │ ├── sb_mutex.h │ ├── sb_threads.h │ └── threads │ │ ├── Makefile.am │ │ └── sb_threads.c └── xoroshiro128plus.h ├── tests ├── Makefile.am ├── README.md ├── include │ ├── api_sql_common.sh │ ├── config.sh.in │ ├── drv_common.sh │ ├── inspect.lua │ ├── mysql_common.sh │ ├── pgsql_common.sh │ ├── script_bulk_insert_common.sh │ ├── script_oltp_common.sh │ └── script_select_random_common.sh ├── t │ ├── 1st.t │ ├── api_basic.t │ ├── api_histogram.t │ ├── api_rand.t │ ├── api_reports.t │ ├── api_sql_mysql.t │ ├── api_sql_pgsql.t │ ├── cmd_cleanup.t │ ├── cmd_help.t │ ├── cmd_prepare.t │ ├── cmd_run.t │ ├── cmdline.t │ ├── commands.t │ ├── drivers.t │ ├── drv_mysql.t │ ├── drv_pgsql.t │ ├── help_drv_mysql.t │ ├── help_drv_pgsql.t │ ├── opt_help.t │ ├── opt_histogram.t │ ├── opt_luajit_cmd.t │ ├── opt_rate.t │ ├── opt_report_checkpoints.t │ ├── opt_report_interval.t │ ├── opt_version.t │ ├── opt_warmup_time.t │ ├── script_bulk_insert_mysql.t │ ├── script_bulk_insert_pgsql.t │ ├── script_oltp_delete_mysql.t │ ├── script_oltp_delete_pgsql.t │ ├── script_oltp_general_mysql.t │ ├── script_oltp_help.t │ ├── script_oltp_insert_mysql.t │ ├── script_oltp_insert_pgsql.t │ ├── script_oltp_point_select_mysql.t │ ├── script_oltp_point_select_pgsql.t │ ├── script_oltp_read_write_mysql.t │ ├── script_oltp_read_write_pgsql.t │ ├── script_select_random_mysql.t │ ├── script_select_random_pgsql.t │ ├── test_cpu.t │ ├── test_fileio.t │ ├── test_memory.t │ ├── test_mutex.t │ ├── test_threads.t │ └── tests.t └── test_run.sh └── third_party ├── concurrency_kit ├── Makefile.am └── ck │ ├── .gitignore │ ├── LICENSE │ ├── Makefile.in │ ├── README │ ├── build │ ├── ck.build.aarch64 │ ├── ck.build.arm │ ├── ck.build.in │ ├── ck.build.ppc │ ├── ck.build.ppc64 │ ├── ck.build.s390x │ ├── ck.build.sparcv9 │ ├── ck.build.x86 │ ├── ck.build.x86_64 │ ├── ck.pc.in │ ├── ck.spec.in │ └── regressions.build.in │ ├── configure │ ├── doc │ ├── CK_ARRAY_FOREACH │ ├── CK_COHORT_INIT │ ├── CK_COHORT_INSTANCE │ ├── CK_COHORT_LOCK │ ├── CK_COHORT_PROTOTYPE │ ├── CK_COHORT_TRYLOCK │ ├── CK_COHORT_TRYLOCK_PROTOTYPE │ ├── CK_COHORT_UNLOCK │ ├── CK_HS_HASH │ ├── CK_RHS_HASH │ ├── CK_RWCOHORT_INIT │ ├── CK_RWCOHORT_INSTANCE │ ├── CK_RWCOHORT_PROTOTYPE │ ├── CK_RWCOHORT_READ_LOCK │ ├── CK_RWCOHORT_READ_UNLOCK │ ├── CK_RWCOHORT_WRITE_LOCK │ ├── CK_RWCOHORT_WRITE_UNLOCK │ ├── Makefile.in │ ├── ck_array_buffer │ ├── ck_array_commit │ ├── ck_array_deinit │ ├── ck_array_init │ ├── ck_array_initialized │ ├── ck_array_length │ ├── ck_array_put │ ├── ck_array_put_unique │ ├── ck_array_remove │ ├── ck_bitmap_base │ ├── ck_bitmap_bits │ ├── ck_bitmap_bts │ ├── ck_bitmap_buffer │ ├── ck_bitmap_clear │ ├── ck_bitmap_init │ ├── ck_bitmap_iterator_init │ ├── ck_bitmap_next │ ├── ck_bitmap_reset │ ├── ck_bitmap_set │ ├── ck_bitmap_size │ ├── ck_bitmap_test │ ├── ck_bitmap_union │ ├── ck_brlock │ ├── ck_cohort │ ├── ck_elide │ ├── ck_epoch_barrier │ ├── ck_epoch_begin │ ├── ck_epoch_call │ ├── ck_epoch_end │ ├── ck_epoch_init │ ├── ck_epoch_poll │ ├── ck_epoch_reclaim │ ├── ck_epoch_recycle │ ├── ck_epoch_register │ ├── ck_epoch_synchronize │ ├── ck_epoch_unregister │ ├── ck_hs_apply │ ├── ck_hs_count │ ├── ck_hs_destroy │ ├── ck_hs_fas │ ├── ck_hs_gc │ ├── ck_hs_get │ ├── ck_hs_grow │ ├── ck_hs_init │ ├── ck_hs_iterator_init │ ├── ck_hs_move │ ├── ck_hs_next │ ├── ck_hs_put │ ├── ck_hs_put_unique │ ├── ck_hs_rebuild │ ├── ck_hs_remove │ ├── ck_hs_reset │ ├── ck_hs_reset_size │ ├── ck_hs_set │ ├── ck_hs_stat │ ├── ck_ht_count │ ├── ck_ht_destroy │ ├── ck_ht_entry_empty │ ├── ck_ht_entry_key │ ├── ck_ht_entry_key_direct │ ├── ck_ht_entry_key_length │ ├── ck_ht_entry_key_set │ ├── ck_ht_entry_key_set_direct │ ├── ck_ht_entry_set │ ├── ck_ht_entry_set_direct │ ├── ck_ht_entry_value │ ├── ck_ht_entry_value_direct │ ├── ck_ht_gc │ ├── ck_ht_get_spmc │ ├── ck_ht_grow_spmc │ ├── ck_ht_hash │ ├── ck_ht_hash_direct │ ├── ck_ht_init │ ├── ck_ht_iterator_init │ ├── ck_ht_next │ ├── ck_ht_put_spmc │ ├── ck_ht_remove_spmc │ ├── ck_ht_reset_size_spmc │ ├── ck_ht_reset_spmc │ ├── ck_ht_set_spmc │ ├── ck_ht_stat │ ├── ck_pflock │ ├── ck_pr │ ├── ck_pr_add │ ├── ck_pr_and │ ├── ck_pr_barrier │ ├── ck_pr_btc │ ├── ck_pr_btr │ ├── ck_pr_bts │ ├── ck_pr_cas │ ├── ck_pr_dec │ ├── ck_pr_faa │ ├── ck_pr_fas │ ├── ck_pr_fence_acquire │ ├── ck_pr_fence_atomic │ ├── ck_pr_fence_atomic_load │ ├── ck_pr_fence_atomic_store │ ├── ck_pr_fence_load │ ├── ck_pr_fence_load_atomic │ ├── ck_pr_fence_load_depends │ ├── ck_pr_fence_load_store │ ├── ck_pr_fence_memory │ ├── ck_pr_fence_release │ ├── ck_pr_fence_store │ ├── ck_pr_fence_store_atomic │ ├── ck_pr_fence_store_load │ ├── ck_pr_inc │ ├── ck_pr_load │ ├── ck_pr_neg │ ├── ck_pr_not │ ├── ck_pr_or │ ├── ck_pr_rtm │ ├── ck_pr_stall │ ├── ck_pr_store │ ├── ck_pr_sub │ ├── ck_pr_xor │ ├── ck_queue │ ├── ck_rhs_apply │ ├── ck_rhs_count │ ├── ck_rhs_destroy │ ├── ck_rhs_fas │ ├── ck_rhs_gc │ ├── ck_rhs_get │ ├── ck_rhs_grow │ ├── ck_rhs_init │ ├── ck_rhs_iterator_init │ ├── ck_rhs_move │ ├── ck_rhs_next │ ├── ck_rhs_put │ ├── ck_rhs_put_unique │ ├── ck_rhs_rebuild │ ├── ck_rhs_remove │ ├── ck_rhs_reset │ ├── ck_rhs_reset_size │ ├── ck_rhs_set │ ├── ck_rhs_set_load_factor │ ├── ck_rhs_stat │ ├── ck_ring_capacity │ ├── ck_ring_dequeue_spmc │ ├── ck_ring_dequeue_spsc │ ├── ck_ring_enqueue_spmc │ ├── ck_ring_enqueue_spmc_size │ ├── ck_ring_enqueue_spsc │ ├── ck_ring_enqueue_spsc_size │ ├── ck_ring_init │ ├── ck_ring_size │ ├── ck_ring_trydequeue_spmc │ ├── ck_rwcohort │ ├── ck_rwlock │ ├── ck_sequence │ ├── ck_spinlock │ ├── ck_swlock │ ├── ck_tflock │ └── refcheck.pl │ ├── include │ ├── ck_array.h │ ├── ck_backoff.h │ ├── ck_barrier.h │ ├── ck_bitmap.h │ ├── ck_brlock.h │ ├── ck_bytelock.h │ ├── ck_cc.h │ ├── ck_cohort.h │ ├── ck_elide.h │ ├── ck_epoch.h │ ├── ck_fifo.h │ ├── ck_hp.h │ ├── ck_hp_fifo.h │ ├── ck_hp_stack.h │ ├── ck_hs.h │ ├── ck_ht.h │ ├── ck_limits.h │ ├── ck_malloc.h │ ├── ck_md.h.in │ ├── ck_pflock.h │ ├── ck_pr.h │ ├── ck_queue.h │ ├── ck_rhs.h │ ├── ck_ring.h │ ├── ck_rwcohort.h │ ├── ck_rwlock.h │ ├── ck_sequence.h │ ├── ck_spinlock.h │ ├── ck_stack.h │ ├── ck_stdbool.h │ ├── ck_stddef.h │ ├── ck_stdint.h │ ├── ck_stdlib.h │ ├── ck_string.h │ ├── ck_swlock.h │ ├── ck_tflock.h │ ├── gcc │ │ ├── aarch64 │ │ │ ├── ck_f_pr.h │ │ │ ├── ck_pr.h │ │ │ ├── ck_pr_llsc.h │ │ │ └── ck_pr_lse.h │ │ ├── arm │ │ │ ├── ck_f_pr.h │ │ │ └── ck_pr.h │ │ ├── ck_cc.h │ │ ├── ck_f_pr.h │ │ ├── ck_pr.h │ │ ├── ppc │ │ │ ├── ck_f_pr.h │ │ │ └── ck_pr.h │ │ ├── ppc64 │ │ │ ├── ck_f_pr.h │ │ │ └── ck_pr.h │ │ ├── s390x │ │ │ ├── ck_f_pr.h │ │ │ └── ck_pr.h │ │ ├── sparcv9 │ │ │ ├── ck_f_pr.h │ │ │ └── ck_pr.h │ │ ├── x86 │ │ │ ├── ck_f_pr.h │ │ │ └── ck_pr.h │ │ └── x86_64 │ │ │ ├── ck_f_pr.h │ │ │ ├── ck_pr.h │ │ │ └── ck_pr_rtm.h │ └── spinlock │ │ ├── anderson.h │ │ ├── cas.h │ │ ├── clh.h │ │ ├── dec.h │ │ ├── fas.h │ │ ├── hclh.h │ │ ├── mcs.h │ │ └── ticket.h │ ├── regressions │ ├── Makefile │ ├── Makefile.unsupported │ ├── ck_array │ │ └── validate │ │ │ ├── Makefile │ │ │ └── serial.c │ ├── ck_backoff │ │ └── validate │ │ │ ├── Makefile │ │ │ └── validate.c │ ├── ck_barrier │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ └── throughput.c │ │ └── validate │ │ │ ├── Makefile │ │ │ ├── barrier_centralized.c │ │ │ ├── barrier_combining.c │ │ │ ├── barrier_dissemination.c │ │ │ ├── barrier_mcs.c │ │ │ └── barrier_tournament.c │ ├── ck_bitmap │ │ └── validate │ │ │ ├── Makefile │ │ │ └── serial.c │ ├── ck_brlock │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── latency.c │ │ │ └── throughput.c │ │ └── validate │ │ │ ├── Makefile │ │ │ └── validate.c │ ├── ck_bytelock │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ └── latency.c │ │ └── validate │ │ │ ├── Makefile │ │ │ └── validate.c │ ├── ck_cohort │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── ck_cohort.c │ │ │ └── throughput.c │ │ ├── ck_cohort.h │ │ └── validate │ │ │ ├── Makefile │ │ │ └── validate.c │ ├── ck_epoch │ │ └── validate │ │ │ ├── Makefile │ │ │ ├── ck_epoch_call.c │ │ │ ├── ck_epoch_poll.c │ │ │ ├── ck_epoch_section.c │ │ │ ├── ck_epoch_section_2.c │ │ │ ├── ck_epoch_synchronize.c │ │ │ ├── ck_stack.c │ │ │ └── torture.c │ ├── ck_fifo │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ └── latency.c │ │ └── validate │ │ │ ├── Makefile │ │ │ ├── ck_fifo_mpmc.c │ │ │ ├── ck_fifo_mpmc_iterator.c │ │ │ ├── ck_fifo_spsc.c │ │ │ └── ck_fifo_spsc_iterator.c │ ├── ck_hp │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── fifo_latency.c │ │ │ └── stack_latency.c │ │ └── validate │ │ │ ├── Makefile │ │ │ ├── ck_hp_fifo.c │ │ │ ├── ck_hp_fifo_donner.c │ │ │ ├── ck_hp_stack.c │ │ │ ├── nbds_haz_test.c │ │ │ └── serial.c │ ├── ck_hs │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── apply.c │ │ │ ├── parallel_bytestring.c │ │ │ └── serial.c │ │ └── validate │ │ │ ├── Makefile │ │ │ └── serial.c │ ├── ck_ht │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── parallel_bytestring.c │ │ │ ├── parallel_direct.c │ │ │ └── serial.c │ │ └── validate │ │ │ ├── Makefile │ │ │ └── serial.c │ ├── ck_pflock │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── latency.c │ │ │ └── throughput.c │ │ └── validate │ │ │ ├── Makefile │ │ │ └── validate.c │ ├── ck_pr │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── benchmark.h │ │ │ ├── ck_pr_add_64.c │ │ │ ├── ck_pr_cas_64.c │ │ │ ├── ck_pr_cas_64_2.c │ │ │ ├── ck_pr_faa_64.c │ │ │ ├── ck_pr_fas_64.c │ │ │ ├── ck_pr_neg_64.c │ │ │ └── fp.c │ │ └── validate │ │ │ ├── Makefile │ │ │ ├── ck_pr_add.c │ │ │ ├── ck_pr_and.c │ │ │ ├── ck_pr_bin.c │ │ │ ├── ck_pr_btc.c │ │ │ ├── ck_pr_btr.c │ │ │ ├── ck_pr_bts.c │ │ │ ├── ck_pr_btx.c │ │ │ ├── ck_pr_cas.c │ │ │ ├── ck_pr_dec.c │ │ │ ├── ck_pr_faa.c │ │ │ ├── ck_pr_fas.c │ │ │ ├── ck_pr_fax.c │ │ │ ├── ck_pr_inc.c │ │ │ ├── ck_pr_load.c │ │ │ ├── ck_pr_n.c │ │ │ ├── ck_pr_or.c │ │ │ ├── ck_pr_store.c │ │ │ ├── ck_pr_sub.c │ │ │ ├── ck_pr_unary.c │ │ │ └── ck_pr_xor.c │ ├── ck_queue │ │ └── validate │ │ │ ├── Makefile │ │ │ ├── ck_list.c │ │ │ ├── ck_slist.c │ │ │ └── ck_stailq.c │ ├── ck_rhs │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── parallel_bytestring.c │ │ │ └── serial.c │ │ └── validate │ │ │ ├── Makefile │ │ │ └── serial.c │ ├── ck_ring │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ └── latency.c │ │ └── validate │ │ │ ├── Makefile │ │ │ ├── ck_ring_mpmc.c │ │ │ ├── ck_ring_mpmc_template.c │ │ │ ├── ck_ring_spmc.c │ │ │ ├── ck_ring_spmc_template.c │ │ │ └── ck_ring_spsc.c │ ├── ck_rwcohort │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── ck_neutral.c │ │ │ ├── ck_rp.c │ │ │ ├── ck_wp.c │ │ │ ├── latency.h │ │ │ └── throughput.h │ │ ├── ck_neutral.h │ │ ├── ck_rp.h │ │ ├── ck_wp.h │ │ └── validate │ │ │ ├── Makefile │ │ │ ├── ck_neutral.c │ │ │ ├── ck_rp.c │ │ │ ├── ck_wp.c │ │ │ └── validate.h │ ├── ck_rwlock │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── latency.c │ │ │ └── throughput.c │ │ └── validate │ │ │ ├── Makefile │ │ │ └── validate.c │ ├── ck_sequence │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ └── ck_sequence.c │ │ └── validate │ │ │ ├── Makefile │ │ │ └── ck_sequence.c │ ├── ck_spinlock │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── ck_anderson.c │ │ │ ├── ck_cas.c │ │ │ ├── ck_clh.c │ │ │ ├── ck_dec.c │ │ │ ├── ck_fas.c │ │ │ ├── ck_hclh.c │ │ │ ├── ck_mcs.c │ │ │ ├── ck_spinlock.c │ │ │ ├── ck_ticket.c │ │ │ ├── ck_ticket_pb.c │ │ │ ├── latency.h │ │ │ ├── linux_spinlock.c │ │ │ └── throughput.h │ │ ├── ck_anderson.h │ │ ├── ck_cas.h │ │ ├── ck_clh.h │ │ ├── ck_dec.h │ │ ├── ck_fas.h │ │ ├── ck_hclh.h │ │ ├── ck_mcs.h │ │ ├── ck_spinlock.h │ │ ├── ck_ticket.h │ │ ├── ck_ticket_pb.h │ │ ├── linux_spinlock.h │ │ └── validate │ │ │ ├── Makefile │ │ │ ├── ck_anderson.c │ │ │ ├── ck_cas.c │ │ │ ├── ck_clh.c │ │ │ ├── ck_dec.c │ │ │ ├── ck_fas.c │ │ │ ├── ck_hclh.c │ │ │ ├── ck_mcs.c │ │ │ ├── ck_spinlock.c │ │ │ ├── ck_ticket.c │ │ │ ├── ck_ticket_pb.c │ │ │ ├── linux_spinlock.c │ │ │ └── validate.h │ ├── ck_stack │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ └── latency.c │ │ └── validate │ │ │ ├── Makefile │ │ │ ├── pair.c │ │ │ ├── pop.c │ │ │ ├── push.c │ │ │ └── serial.c │ ├── ck_swlock │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── latency.c │ │ │ └── throughput.c │ │ └── validate │ │ │ ├── Makefile │ │ │ └── validate.c │ ├── ck_tflock │ │ ├── benchmark │ │ │ ├── Makefile │ │ │ ├── latency.c │ │ │ └── throughput.c │ │ └── validate │ │ │ ├── Makefile │ │ │ └── validate.c │ └── common.h │ ├── src │ ├── Makefile.in │ ├── ck_array.c │ ├── ck_barrier_centralized.c │ ├── ck_barrier_combining.c │ ├── ck_barrier_dissemination.c │ ├── ck_barrier_mcs.c │ ├── ck_barrier_tournament.c │ ├── ck_epoch.c │ ├── ck_hp.c │ ├── ck_hs.c │ ├── ck_ht.c │ ├── ck_ht_hash.h │ ├── ck_internal.h │ └── ck_rhs.c │ └── tools │ └── feature.sh ├── cram ├── .coveragerc ├── .gitignore ├── .hgignore ├── .hgtags ├── .pylintrc ├── .travis.yml ├── COPYING.txt ├── MANIFEST.in ├── Makefile ├── NEWS.rst ├── README.rst ├── TODO.md ├── contrib │ ├── PKGBUILD │ └── cram.vim ├── cram │ ├── __init__.py │ ├── __main__.py │ ├── _cli.py │ ├── _diff.py │ ├── _encoding.py │ ├── _main.py │ ├── _process.py │ ├── _run.py │ ├── _test.py │ └── _xunit.py ├── examples │ ├── .hidden.t │ ├── .hidden │ │ └── hidden.t │ ├── bare.t │ ├── empty.t │ ├── env.t │ ├── fail.t │ ├── missingeol.t │ ├── skip.t │ └── test.t ├── requirements.txt ├── scripts │ └── cram ├── setup.cfg ├── setup.py └── tests │ ├── config.t │ ├── debug.t │ ├── dist.t │ ├── doctest.t │ ├── encoding.t │ ├── interactive.t │ ├── pep8.t │ ├── pyflakes.t │ ├── run-doctests.py │ ├── setup.sh │ ├── test.t │ ├── usage.t │ └── xunit.t └── luajit ├── Makefile.am └── luajit ├── .gitignore ├── COPYRIGHT ├── Makefile ├── README ├── doc ├── bluequad-print.css ├── bluequad.css ├── contact.html ├── ext_buffer.html ├── ext_c_api.html ├── ext_ffi.html ├── ext_ffi_api.html ├── ext_ffi_semantics.html ├── ext_ffi_tutorial.html ├── ext_jit.html ├── ext_profiler.html ├── extensions.html ├── faq.html ├── img │ └── contact.png ├── install.html ├── luajit.html ├── running.html └── status.html ├── dynasm ├── dasm_arm.h ├── dasm_arm.lua ├── dasm_arm64.h ├── dasm_arm64.lua ├── dasm_mips.h ├── dasm_mips.lua ├── dasm_mips64.lua ├── dasm_ppc.h ├── dasm_ppc.lua ├── dasm_proto.h ├── dasm_x64.lua ├── dasm_x86.h ├── dasm_x86.lua └── dynasm.lua ├── etc ├── luajit.1 └── luajit.pc └── src ├── .gitignore ├── Makefile ├── Makefile.dep ├── host ├── .gitignore ├── README ├── buildvm.c ├── buildvm.h ├── buildvm_asm.c ├── buildvm_fold.c ├── buildvm_lib.c ├── buildvm_libbc.h ├── buildvm_peobj.c ├── genlibbc.lua ├── genminilua.lua └── minilua.c ├── jit ├── .gitignore ├── bc.lua ├── bcsave.lua ├── dis_arm.lua ├── dis_arm64.lua ├── dis_arm64be.lua ├── dis_mips.lua ├── dis_mips64.lua ├── dis_mips64el.lua ├── dis_mips64r6.lua ├── dis_mips64r6el.lua ├── dis_mipsel.lua ├── dis_ppc.lua ├── dis_x64.lua ├── dis_x86.lua ├── dump.lua ├── p.lua ├── v.lua └── zone.lua ├── lauxlib.h ├── lib_aux.c ├── lib_base.c ├── lib_bit.c ├── lib_buffer.c ├── lib_debug.c ├── lib_ffi.c ├── lib_init.c ├── lib_io.c ├── lib_jit.c ├── lib_math.c ├── lib_os.c ├── lib_package.c ├── lib_string.c ├── lib_table.c ├── lj.supp ├── lj_alloc.c ├── lj_alloc.h ├── lj_api.c ├── lj_arch.h ├── lj_asm.c ├── lj_asm.h ├── lj_asm_arm.h ├── lj_asm_arm64.h ├── lj_asm_mips.h ├── lj_asm_ppc.h ├── lj_asm_x86.h ├── lj_assert.c ├── lj_bc.c ├── lj_bc.h ├── lj_bcdump.h ├── lj_bcread.c ├── lj_bcwrite.c ├── lj_buf.c ├── lj_buf.h ├── lj_carith.c ├── lj_carith.h ├── lj_ccall.c ├── lj_ccall.h ├── lj_ccallback.c ├── lj_ccallback.h ├── lj_cconv.c ├── lj_cconv.h ├── lj_cdata.c ├── lj_cdata.h ├── lj_char.c ├── lj_char.h ├── lj_clib.c ├── lj_clib.h ├── lj_cparse.c ├── lj_cparse.h ├── lj_crecord.c ├── lj_crecord.h ├── lj_ctype.c ├── lj_ctype.h ├── lj_debug.c ├── lj_debug.h ├── lj_def.h ├── lj_dispatch.c ├── lj_dispatch.h ├── lj_emit_arm.h ├── lj_emit_arm64.h ├── lj_emit_mips.h ├── lj_emit_ppc.h ├── lj_emit_x86.h ├── lj_err.c ├── lj_err.h ├── lj_errmsg.h ├── lj_ff.h ├── lj_ffrecord.c ├── lj_ffrecord.h ├── lj_frame.h ├── lj_func.c ├── lj_func.h ├── lj_gc.c ├── lj_gc.h ├── lj_gdbjit.c ├── lj_gdbjit.h ├── lj_ir.c ├── lj_ir.h ├── lj_ircall.h ├── lj_iropt.h ├── lj_jit.h ├── lj_lex.c ├── lj_lex.h ├── lj_lib.c ├── lj_lib.h ├── lj_load.c ├── lj_mcode.c ├── lj_mcode.h ├── lj_meta.c ├── lj_meta.h ├── lj_obj.c ├── lj_obj.h ├── lj_opt_dce.c ├── lj_opt_fold.c ├── lj_opt_loop.c ├── lj_opt_mem.c ├── lj_opt_narrow.c ├── lj_opt_sink.c ├── lj_opt_split.c ├── lj_parse.c ├── lj_parse.h ├── lj_prng.c ├── lj_prng.h ├── lj_profile.c ├── lj_profile.h ├── lj_record.c ├── lj_record.h ├── lj_serialize.c ├── lj_serialize.h ├── lj_snap.c ├── lj_snap.h ├── lj_state.c ├── lj_state.h ├── lj_str.c ├── lj_str.h ├── lj_strfmt.c ├── lj_strfmt.h ├── lj_strfmt_num.c ├── lj_strscan.c ├── lj_strscan.h ├── lj_tab.c ├── lj_tab.h ├── lj_target.h ├── lj_target_arm.h ├── lj_target_arm64.h ├── lj_target_mips.h ├── lj_target_ppc.h ├── lj_target_x86.h ├── lj_trace.c ├── lj_trace.h ├── lj_traceerr.h ├── lj_udata.c ├── lj_udata.h ├── lj_vm.h ├── lj_vmevent.c ├── lj_vmevent.h ├── lj_vmmath.c ├── ljamalg.c ├── lua.h ├── lua.hpp ├── luaconf.h ├── luajit.c ├── luajit.h ├── lualib.h ├── msvcbuild.bat ├── nxbuild.bat ├── ps4build.bat ├── ps5build.bat ├── psvitabuild.bat ├── vm_arm.dasc ├── vm_arm64.dasc ├── vm_mips.dasc ├── vm_mips64.dasc ├── vm_ppc.dasc ├── vm_ppc64.dasc ├── vm_x64.dasc ├── vm_x86.dasc ├── xb1build.bat └── xedkbuild.bat /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [push, pull_request] 3 | 4 | jobs: 5 | build: 6 | strategy: 7 | matrix: 8 | os: [ ubuntu-22.04, ubuntu-20.04 ] 9 | runs-on: ${{ matrix.os }} 10 | name: Build on ${{ matrix.os }} 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v3 14 | - name: Autogen 15 | run: ./autogen.sh 16 | - name: Configure 17 | run: ./configure --with-mysql --with-pgsql 18 | - name: Build 19 | run: make 20 | - name: MySQL version 21 | run: mysql_config --version 22 | - name: Sysbench version 23 | run: ./src/sysbench --version 24 | - name: Test 25 | run: make test 26 | 27 | build_mariadb: 28 | runs-on: ubuntu-22.04 29 | name: Build with MariaDB 30 | steps: 31 | - name: Setup MariaDB Repo 32 | run: | 33 | sudo apt-get install software-properties-common 34 | sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 35 | sudo add-apt-repository 'deb [arch=amd64] https://ftp.nluug.nl/db/mariadb/repo/11.0/ubuntu jammy main' 36 | - name: Setup MariaDB Libs 37 | run: sudo apt install libmariadb-dev libmariadb-dev-compat 38 | - name: Checkout 39 | uses: actions/checkout@v3 40 | - name: Autogen 41 | run: ./autogen.sh 42 | - name: Configure 43 | run: ./configure --with-mysql --with-pgsql 44 | - name: Build 45 | run: make 46 | - name: MariaDB version 47 | run: mariadb_config --version 48 | - name: Sysbench version 49 | run: ./src/sysbench --version 50 | - name: Test 51 | run: make test 52 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:xenial 2 | 3 | RUN apt-get update 4 | 5 | RUN apt-get -y install make automake libtool pkg-config libaio-dev git 6 | 7 | # For MySQL support 8 | RUN apt-get -y install libmysqlclient-dev libssl-dev 9 | 10 | # For PostgreSQL support 11 | RUN apt-get -y install libpq-dev 12 | 13 | RUN git clone https://github.com/akopytov/sysbench.git sysbench 14 | 15 | WORKDIR sysbench 16 | RUN ./autogen.sh 17 | RUN ./configure --with-mysql --with-pgsql 18 | RUN make -j 19 | RUN make install 20 | 21 | WORKDIR /root 22 | RUN rm -rf sysbench 23 | 24 | ENTRYPOINT sysbench 25 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # Copyright (C) 2004-2018 Alexey Kopytov 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | ACLOCAL_AMFLAGS = -I m4 19 | AM_DISTCHECK_CONFIGURE_FLAGS = --without-mysql 20 | 21 | if USE_BUNDLED_LUAJIT 22 | LUAJIT_DIR = third_party/luajit 23 | endif 24 | 25 | if USE_BUNDLED_CK 26 | CK_DIR = third_party/concurrency_kit 27 | endif 28 | 29 | SUBDIRS = $(LUAJIT_DIR) $(CK_DIR) src tests 30 | 31 | EXTRA_DIST = autogen.sh README.md ChangeLog \ 32 | snap/snapcraft.yaml.in third_party/cram \ 33 | debian/changelog debian/compat debian/control debian/copyright \ 34 | debian/dirs debian/docs debian/install debian/rules \ 35 | debian/source/format \ 36 | rpm/sysbench.spec \ 37 | scripts/buildpack.sh 38 | 39 | dist-hook: 40 | $(MAKE) -C $(distdir)/third_party/cram clean 41 | 42 | test: 43 | cd tests && $(MAKE) test 44 | 45 | clean-local: 46 | $(MAKE) -C $(top_srcdir)/third_party/cram clean 47 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | autoreconf -vi 4 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | sysbench (1.0.21-1) unstable; urgency=low 2 | 3 | * add libzstd-dev to build dependencies 4 | 5 | -- Alexey Kopytov Sun, 24 Jan 2021 13:16:04 +0300 6 | 7 | sysbench (1.0.18-1) unstable; urgency=low 8 | 9 | * add libssl-dev to build dependencies 10 | 11 | -- Alexey Kopytov Sun, 08 Dec 2019 14:02:01 +0300 12 | 13 | sysbench (1.0.15-2) unstable; urgency=low 14 | 15 | * add libaio-dev to build dependencies 16 | 17 | -- Alexey Kopytov Sat, 09 Jul 2018 09:24:42 +0300 18 | 19 | sysbench (1.0.12-1) unstable; urgency=low 20 | 21 | * remove vim-common from build dependencies 22 | 23 | -- Alexey Kopytov Sat, 06 Jan 2018 10:59:42 +0300 24 | 25 | sysbench (1.0.11-1) unstable; urgency=low 26 | 27 | * add Debian Stretch support by adding optional build dependency on 28 | default-libmysqlclient-dev and replacing python-minimal with python 29 | (as minimal does not provide the shlex module required by cram) 30 | 31 | -- Alexey Kopytov Sat, 09 Dec 2017 19:52:23 +0300 32 | 33 | sysbench (1.0.6-1) unstable; urgency=low 34 | 35 | * Add pkg-config, vim-common and python-minimal and libpq-dev to build dependencies. 36 | * Fix 'clean' target in rules. 37 | * Add ChangeLog and COPYING to docs. 38 | * Remove tests/db/*.lua from install. 39 | * Pass --without-gcc-arch to configure to not override compiler flags 40 | passed by the build system 41 | 42 | -- Alexey Kopytov Thu, 13 Apr 2017 23:04:34 +0300 43 | 44 | sysbench (1.0-1) unstable; urgency=low 45 | 46 | * Initial release 47 | 48 | -- Alexey Kopytov Wed, 10 Aug 2016 18:04:53 +0300 49 | 50 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: sysbench 2 | Section: misc 3 | Priority: extra 4 | Maintainer: Alexey Kopytov 5 | Build-Depends: debhelper, autoconf, automake, libaio-dev, libtool, libmysqlclient-dev | default-libmysqlclient-dev, libpq-dev, pkg-config, python, libssl-dev, libzstd-dev 6 | Standards-Version: 3.9.5 7 | Homepage: https://github.com/akopytov/sysbench 8 | 9 | Package: sysbench 10 | Architecture: any 11 | Depends: ${shlibs:Depends}, ${misc:Depends} 12 | Description: Scriptable database and system performance benchmark 13 | sysbench is a scriptable multi-threaded benchmark tool based on 14 | LuaJIT. It is most frequently used for database benchmarks, but can also 15 | be used to create arbitrarily complex workloads that do not involve a 16 | database server. 17 | . 18 | sysbench comes with the following bundled benchmarks: 19 | . 20 | - oltp_*.lua: a collection of OLTP-like database benchmarks 21 | - fileio: a filesystem-level benchmark 22 | - cpu: a simple CPU benchmark 23 | - memory: a memory access benchmark 24 | - threads: a thread-based scheduler benchmark 25 | - mutex: a POSIX mutex benchmark 26 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat 2 | Upstream-Name: sysbench 3 | Upstream-Maintainer: Alexey Kopytov 4 | Upstream-Source: https://github.com/akopytov/sysbench 5 | 6 | Files: * 7 | Copyright: 2016 Alexey Kopytov 8 | License: GPL-2 9 | This package is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License version 2 as 11 | published by the Free Software Foundation. 12 | . 13 | On Debian systems, the complete text of the GNU General 14 | Public License can be found in `/usr/share/common-licenses/GPL-2'. 15 | 16 | -------------------------------------------------------------------------------- /debian/dirs: -------------------------------------------------------------------------------- 1 | usr/bin 2 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | README.md 2 | ChangeLog 3 | COPYING 4 | -------------------------------------------------------------------------------- /debian/install: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akopytov/sysbench/3ceba0b1e115f8c50d1d045a4574d8ed643bd497/debian/install -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | %: 4 | dh $@ 5 | 6 | override_dh_auto_configure: 7 | dh_testdir 8 | autoreconf -vif 9 | dh_auto_configure -- --with-mysql --with-pgsql --without-gcc-arch 10 | 11 | override_dh_compress: 12 | dh_compress -X.lua 13 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /m4/ac_check_aio.m4: -------------------------------------------------------------------------------- 1 | dnl --------------------------------------------------------------------------- 2 | dnl Macro: AC_CHECK_AIO 3 | dnl Check for Linux AIO availability on the target system 4 | dnl Also, check the version of libaio library (at the moment, there are two 5 | dnl versions with incompatible interfaces). 6 | dnl --------------------------------------------------------------------------- 7 | 8 | AC_DEFUN([AC_CHECK_AIO],[ 9 | if test x$enable_aio = xyes; then 10 | AC_CHECK_HEADER([libaio.h], 11 | [AC_DEFINE(HAVE_LIBAIO_H,1,[Define to 1 if your system has header file])], 12 | [enable_aio=no]) 13 | fi 14 | if test x$enable_aio = xyes; then 15 | AC_CHECK_LIB([aio], [io_queue_init], , [enable_aio=no]) 16 | fi 17 | if test x$enable_aio = xyes; then 18 | AC_MSG_CHECKING(if io_getevents() has an old interface) 19 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( 20 | [[ 21 | #ifdef HAVE_LIBAIO_H 22 | # include 23 | #endif 24 | struct io_event event; 25 | io_context_t ctxt; 26 | ]], 27 | [[ 28 | (void)io_getevents(ctxt, 1, &event, NULL); 29 | ]] ) 30 | ], [ 31 | AC_DEFINE([HAVE_OLD_GETEVENTS], 1, [Define to 1 if libaio has older getevents() interface]) 32 | AC_MSG_RESULT(yes) 33 | ], 34 | [AC_MSG_RESULT(no)] 35 | ) 36 | fi 37 | ]) 38 | 39 | -------------------------------------------------------------------------------- /m4/extensions.m4: -------------------------------------------------------------------------------- 1 | dnl Provide AC_USE_SYSTEM_EXTENSIONS for old autoconf machines. 2 | AC_DEFUN([ACX_USE_SYSTEM_EXTENSIONS],[ 3 | ifdef([AC_USE_SYSTEM_EXTENSIONS],[ 4 | AC_USE_SYSTEM_EXTENSIONS 5 | ],[ 6 | AC_BEFORE([$0], [AC_COMPILE_IFELSE]) 7 | AC_BEFORE([$0], [AC_RUN_IFELSE]) 8 | 9 | AC_REQUIRE([AC_GNU_SOURCE]) 10 | AC_REQUIRE([AC_AIX]) 11 | AC_REQUIRE([AC_MINIX]) 12 | 13 | AH_VERBATIM([__EXTENSIONS__], 14 | [/* Enable extensions on Solaris. */ 15 | #ifndef __EXTENSIONS__ 16 | # undef __EXTENSIONS__ 17 | #endif 18 | #ifndef _POSIX_PTHREAD_SEMANTICS 19 | # undef _POSIX_PTHREAD_SEMANTICS 20 | #endif 21 | #ifndef _TANDEM_SOURCE 22 | # undef _TANDEM_SOURCE 23 | #endif]) 24 | AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], 25 | [ac_cv_safe_to_define___extensions__], 26 | [AC_COMPILE_IFELSE( 27 | [AC_LANG_PROGRAM([ 28 | # define __EXTENSIONS__ 1 29 | AC_INCLUDES_DEFAULT])], 30 | [ac_cv_safe_to_define___extensions__=yes], 31 | [ac_cv_safe_to_define___extensions__=no])]) 32 | test $ac_cv_safe_to_define___extensions__ = yes && 33 | AC_DEFINE([__EXTENSIONS__]) 34 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) 35 | AC_DEFINE([_TANDEM_SOURCE]) 36 | ]) 37 | ]) 38 | -------------------------------------------------------------------------------- /m4/sb_autoconf_compat.m4: -------------------------------------------------------------------------------- 1 | # --------------------------------------------------------------------------- 2 | # Provide various compatibility macros for older Autoconf machines 3 | # Definitions were copied from the Autoconf source code. 4 | # --------------------------------------------------------------------------- 5 | m4_ifdef([AS_VAR_IF],,m4_define([AS_VAR_IF], 6 | [AS_LITERAL_WORD_IF([$1], 7 | [AS_IF(m4_ifval([$2], [[test "x$$1" = x[]$2]], [[${$1:+false} :]])], 8 | [AS_VAR_COPY([as_val], [$1]) 9 | AS_IF(m4_ifval([$2], [[test "x$as_val" = x[]$2]], [[${as_val:+false} :]])], 10 | [AS_IF(m4_ifval([$2], 11 | [[eval test \"x\$"$1"\" = x"_AS_ESCAPE([$2], [`], [\"$])"]], 12 | [[eval \${$1:+false} :]])]), 13 | [$3], [$4])]))dnl 14 | -------------------------------------------------------------------------------- /snap/snapcraft.yaml.in: -------------------------------------------------------------------------------- 1 | name: sysbench 2 | version: @PACKAGE_VERSION@ 3 | summary: Scriptable database and system performance benchmark 4 | description: | 5 | sysbench is a scriptable multi-threaded benchmark tool based on 6 | LuaJIT. It is most frequently used for database benchmarks, but can also 7 | be used to create arbitrarily complex workloads that do not involve a 8 | database server. 9 | 10 | sysbench comes with the following bundled benchmarks: 11 | 12 | - oltp_*.lua: a collection of OLTP-like database benchmarks 13 | - fileio: a filesystem-level benchmark 14 | - cpu: a simple CPU benchmark 15 | - memory: a memory access benchmark 16 | - threads: a thread-based scheduler benchmark 17 | - mutex: a POSIX mutex benchmark 18 | 19 | grade: stable 20 | confinement: classic 21 | 22 | apps: 23 | sysbench: 24 | command: sysbench 25 | plugs: 26 | - network 27 | 28 | parts: 29 | sysbench: 30 | source: . 31 | plugin: autotools 32 | build-packages: 33 | - libmysqlclient-dev 34 | stage-packages: 35 | - libmysqlclient20 36 | - libaio1 37 | -------------------------------------------------------------------------------- /src/drivers/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # Copyright (C) 2004-2018 Alexey Kopytov 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | if USE_MYSQL 19 | MYSQL_DIR = mysql 20 | endif 21 | 22 | if USE_PGSQL 23 | PGSQL_DIR = pgsql 24 | endif 25 | 26 | SUBDIRS = $(MYSQL_DIR) $(PGSQL_DIR) 27 | -------------------------------------------------------------------------------- /src/drivers/mysql/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # Copyright (C) 2004-2008 Alexey Kopytov 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | noinst_LIBRARIES = libsbmysql.a 19 | 20 | libsbmysql_a_SOURCES = drv_mysql.c 21 | libsbmysql_a_CPPFLAGS = $(MYSQL_CFLAGS) $(AM_CPPFLAGS) 22 | -------------------------------------------------------------------------------- /src/drivers/pgsql/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2005 MySQL AB 2 | # Copyright (C) 2005-2015 Alexey Kopytov 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | noinst_LIBRARIES = libsbpgsql.a 19 | 20 | libsbpgsql_a_SOURCES = drv_pgsql.c 21 | libsbpgsql_a_CPPFLAGS = -g $(PGSQL_CFLAGS) $(AM_CPPFLAGS) 22 | -------------------------------------------------------------------------------- /src/lua/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2016 Alexey Kopytov 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 | 17 | SUBDIRS = internal 18 | 19 | dist_pkgdata_SCRIPTS = bulk_insert.lua \ 20 | oltp_delete.lua \ 21 | oltp_insert.lua \ 22 | oltp_read_only.lua \ 23 | oltp_read_write.lua \ 24 | oltp_point_select.lua \ 25 | oltp_update_index.lua \ 26 | oltp_update_non_index.lua \ 27 | oltp_write_only.lua\ 28 | select_random_points.lua \ 29 | select_random_ranges.lua 30 | 31 | dist_pkgdata_DATA = oltp_common.lua 32 | -------------------------------------------------------------------------------- /src/lua/bulk_insert.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sysbench 2 | -- -------------------------------------------------------------------------- -- 3 | -- Bulk insert benchmark: do multi-row INSERTs concurrently in --threads 4 | -- threads with each thread inserting into its own table. The number of INSERTs 5 | -- executed by each thread is controlled by either --time or --events. 6 | -- -------------------------------------------------------------------------- -- 7 | 8 | cursize=0 9 | 10 | function thread_init() 11 | drv = sysbench.sql.driver() 12 | con = drv:connect() 13 | end 14 | 15 | function prepare() 16 | local i 17 | 18 | local drv = sysbench.sql.driver() 19 | local con = drv:connect() 20 | 21 | for i = 1, sysbench.opt.threads do 22 | print("Creating table 'sbtest" .. i .. "'...") 23 | con:query(string.format([[ 24 | CREATE TABLE IF NOT EXISTS sbtest%d ( 25 | id INTEGER NOT NULL, 26 | k INTEGER DEFAULT '0' NOT NULL, 27 | PRIMARY KEY (id))]], i)) 28 | end 29 | end 30 | 31 | function event() 32 | if (cursize == 0) then 33 | con:bulk_insert_init("INSERT INTO sbtest" .. sysbench.tid+1 .. " VALUES") 34 | end 35 | 36 | cursize = cursize + 1 37 | 38 | con:bulk_insert_next("(" .. cursize .. "," .. cursize .. ")") 39 | end 40 | 41 | function thread_done() 42 | con:bulk_insert_done() 43 | con:disconnect() 44 | end 45 | 46 | function cleanup() 47 | local i 48 | 49 | local drv = sysbench.sql.driver() 50 | local con = drv:connect() 51 | 52 | for i = 1, sysbench.opt.threads do 53 | print("Dropping table 'sbtest" .. i .. "'...") 54 | con:query("DROP TABLE IF EXISTS sbtest" .. i ) 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /src/lua/empty-test.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sysbench 2 | 3 | -- you can run this script like this: 4 | -- $ ./empty-test.lua --cpu-max-prime=20000 --threads=8 --histogram --report-interval=1 run 5 | 6 | sysbench.cmdline.options = { 7 | -- the default values for built-in options are currently ignored, see 8 | -- https://github.com/akopytov/sysbench/issues/151 9 | ["cpu-max-prime"] = {"CPU maximum prime", 10000}, 10 | ["threads"] = {"Number of threads", 1}, 11 | ["histogram"] = {"Show histogram", "off"}, 12 | ["report-interval"] = {"Report interval", 1} 13 | } 14 | 15 | function event() 16 | end 17 | 18 | function sysbench.hooks.report_cumulative(stat) 19 | local seconds = stat.time_interval 20 | print(string.format([[ 21 | { 22 | "errors": %4.0f, 23 | "events": %4.0f, 24 | "latency_avg": %4.10f, 25 | "latency_max": %4.10f, 26 | "latency_min": %4.10f, 27 | "latency_pct": %4.10f, 28 | "latency_sum": %4.10f, 29 | "other": %4.0f, 30 | "reads": %4.0f, 31 | "reconnects": %4.0f, 32 | "threads_running": %4.0f, 33 | "time_interval": %4.10f, 34 | "time_total": %4.10f, 35 | "writes": %4.0f 36 | } 37 | ]], 38 | stat.errors, 39 | stat.events, 40 | stat.latency_avg, 41 | stat.latency_max, 42 | stat.latency_min, 43 | stat.latency_pct, 44 | stat.latency_sum, 45 | stat.other, 46 | stat.reads, 47 | stat.reconnects, 48 | stat.threads_running, 49 | stat.time_interval, 50 | stat.time_total, 51 | stat.writes)) 52 | end 53 | -------------------------------------------------------------------------------- /src/lua/internal/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2016-2018 Alexey Kopytov 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 | 17 | BUILT_SOURCES = sysbench.lua.h sysbench.rand.lua.h sysbench.sql.lua.h \ 18 | sysbench.cmdline.lua.h \ 19 | sysbench.histogram.lua.h 20 | 21 | CLEANFILES = $(BUILT_SOURCES) 22 | 23 | EXTRA_DIST = $(BUILT_SOURCES:.h=) 24 | 25 | SUFFIXES = .lua .lua.h 26 | 27 | .lua.lua.h: 28 | @echo "Creating $@ from $<" 29 | @var=$$(echo $< | sed 's/\./_/g') && \ 30 | ( echo "unsigned char $${var}[] =" && \ 31 | sed -e 's/\\/\\\\/g' \ 32 | -e 's/"/\\"/g' \ 33 | -e 's/^/ "/g' \ 34 | -e 's/$$/\\n"/g' $< && \ 35 | echo ";" && \ 36 | echo "size_t $${var}_len = sizeof($${var}) - 1;" ) > $@ 37 | -------------------------------------------------------------------------------- /src/lua/oltp_delete.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sysbench 2 | -- Copyright (C) 2006-2017 Alexey Kopytov 3 | 4 | -- This program is free software; you can redistribute it and/or modify 5 | -- it under the terms of the GNU General Public License as published by 6 | -- the Free Software Foundation; either version 2 of the License, or 7 | -- (at your option) any later version. 8 | 9 | -- This program is distributed in the hope that it will be useful, 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | -- GNU General Public License for more details. 13 | 14 | -- You should have received a copy of the GNU General Public License 15 | -- along with this program; if not, write to the Free Software 16 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | -- ---------------------------------------------------------------------- 19 | -- Delete-Only OLTP benchmark 20 | -- ---------------------------------------------------------------------- 21 | 22 | require("oltp_common") 23 | 24 | function prepare_statements() 25 | prepare_for_each_table("deletes") 26 | end 27 | 28 | function event() 29 | local tnum = sysbench.rand.uniform(1, sysbench.opt.tables) 30 | local id = sysbench.rand.default(1, sysbench.opt.table_size) 31 | 32 | param[tnum].deletes[1]:set(id) 33 | stmt[tnum].deletes:execute() 34 | 35 | check_reconnect() 36 | end 37 | -------------------------------------------------------------------------------- /src/lua/oltp_point_select.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sysbench 2 | -- Copyright (C) 2006-2017 Alexey Kopytov 3 | 4 | -- This program is free software; you can redistribute it and/or modify 5 | -- it under the terms of the GNU General Public License as published by 6 | -- the Free Software Foundation; either version 2 of the License, or 7 | -- (at your option) any later version. 8 | 9 | -- This program is distributed in the hope that it will be useful, 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | -- GNU General Public License for more details. 13 | 14 | -- You should have received a copy of the GNU General Public License 15 | -- along with this program; if not, write to the Free Software 16 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | -- ---------------------------------------------------------------------- 19 | -- OLTP Point Select benchmark 20 | -- ---------------------------------------------------------------------- 21 | 22 | require("oltp_common") 23 | 24 | function prepare_statements() 25 | -- use 1 query per event, rather than sysbench.opt.point_selects which 26 | -- defaults to 10 in other OLTP scripts 27 | sysbench.opt.point_selects=1 28 | 29 | prepare_point_selects() 30 | end 31 | 32 | function event() 33 | execute_point_selects() 34 | 35 | check_reconnect() 36 | end 37 | -------------------------------------------------------------------------------- /src/lua/oltp_update_index.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sysbench 2 | -- Copyright (C) 2006-2017 Alexey Kopytov 3 | 4 | -- This program is free software; you can redistribute it and/or modify 5 | -- it under the terms of the GNU General Public License as published by 6 | -- the Free Software Foundation; either version 2 of the License, or 7 | -- (at your option) any later version. 8 | 9 | -- This program is distributed in the hope that it will be useful, 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | -- GNU General Public License for more details. 13 | 14 | -- You should have received a copy of the GNU General Public License 15 | -- along with this program; if not, write to the Free Software 16 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | -- ---------------------------------------------------------------------- 19 | -- Update-Index OLTP benchmark 20 | -- ---------------------------------------------------------------------- 21 | 22 | require("oltp_common") 23 | 24 | function prepare_statements() 25 | prepare_index_updates() 26 | end 27 | 28 | function event() 29 | execute_index_updates(con) 30 | check_reconnect() 31 | end 32 | -------------------------------------------------------------------------------- /src/lua/oltp_update_non_index.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sysbench 2 | -- Copyright (C) 2006-2017 Alexey Kopytov 3 | 4 | -- This program is free software; you can redistribute it and/or modify 5 | -- it under the terms of the GNU General Public License as published by 6 | -- the Free Software Foundation; either version 2 of the License, or 7 | -- (at your option) any later version. 8 | 9 | -- This program is distributed in the hope that it will be useful, 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | -- GNU General Public License for more details. 13 | 14 | -- You should have received a copy of the GNU General Public License 15 | -- along with this program; if not, write to the Free Software 16 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | -- ---------------------------------------------------------------------- 19 | -- Update-Non-Index OLTP benchmark 20 | -- ---------------------------------------------------------------------- 21 | 22 | require("oltp_common") 23 | 24 | function prepare_statements() 25 | prepare_non_index_updates() 26 | end 27 | 28 | function event() 29 | execute_non_index_updates() 30 | 31 | check_reconnect() 32 | end 33 | -------------------------------------------------------------------------------- /src/lua/oltp_write_only.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sysbench 2 | -- Copyright (C) 2006-2017 Alexey Kopytov 3 | 4 | -- This program is free software; you can redistribute it and/or modify 5 | -- it under the terms of the GNU General Public License as published by 6 | -- the Free Software Foundation; either version 2 of the License, or 7 | -- (at your option) any later version. 8 | 9 | -- This program is distributed in the hope that it will be useful, 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | -- GNU General Public License for more details. 13 | 14 | -- You should have received a copy of the GNU General Public License 15 | -- along with this program; if not, write to the Free Software 16 | -- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | -- ---------------------------------------------------------------------- 19 | -- Write-Only OLTP benchmark 20 | -- ---------------------------------------------------------------------- 21 | 22 | require("oltp_common") 23 | 24 | function prepare_statements() 25 | if not sysbench.opt.skip_trx then 26 | prepare_begin() 27 | prepare_commit() 28 | end 29 | 30 | prepare_index_updates() 31 | prepare_non_index_updates() 32 | prepare_delete_inserts() 33 | end 34 | 35 | function event() 36 | if not sysbench.opt.skip_trx then 37 | begin() 38 | end 39 | 40 | execute_index_updates() 41 | execute_non_index_updates() 42 | execute_delete_inserts() 43 | 44 | if not sysbench.opt.skip_trx then 45 | commit() 46 | end 47 | 48 | check_reconnect() 49 | end 50 | -------------------------------------------------------------------------------- /src/sb_barrier.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2016-2018 Alexey Kopytov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /* Thread barrier implementation. */ 20 | 21 | #ifndef SB_BARRIER_H 22 | #define SB_BARRIER_H 23 | 24 | #ifdef HAVE_CONFIG_H 25 | # include "config.h" 26 | #endif 27 | 28 | #ifdef HAVE_PTHREAD_H 29 | # include 30 | #endif 31 | 32 | #define SB_BARRIER_SERIAL_THREAD 1 33 | 34 | typedef int (*sb_barrier_cb_t)(void *); 35 | 36 | typedef struct { 37 | unsigned int count; 38 | unsigned int init_count; 39 | unsigned int serial; 40 | pthread_mutex_t mutex; 41 | pthread_cond_t cond; 42 | sb_barrier_cb_t callback; 43 | void *arg; 44 | int error; 45 | } sb_barrier_t; 46 | 47 | int sb_barrier_init(sb_barrier_t *barrier, unsigned int count, 48 | sb_barrier_cb_t callback, void *arg); 49 | 50 | int sb_barrier_wait(sb_barrier_t *barrier); 51 | 52 | void sb_barrier_destroy(sb_barrier_t *barrier); 53 | 54 | #endif /* SB_BARRIER_H */ 55 | -------------------------------------------------------------------------------- /src/sb_global.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2016 Alexey Kopytov 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 | */ 17 | 18 | /* Global and portability-related macros */ 19 | 20 | #ifndef SB_GLOBAL_H 21 | #define SB_GLOBAL_H 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include "config.h" 25 | #endif 26 | 27 | #endif /* SB_GLOBAL_H */ 28 | -------------------------------------------------------------------------------- /src/sb_lua.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2006 MySQL AB 2 | Copyright (C) 2006-2018 Alexey Kopytov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | # include "config.h" 21 | #endif 22 | 23 | #include "sysbench.h" 24 | #include "lua.h" 25 | 26 | /* Load a specified Lua script */ 27 | 28 | sb_test_t *sb_load_lua(const char *testname); 29 | 30 | void sb_lua_done(void); 31 | 32 | int sb_lua_hook_call(lua_State *L, const char *name); 33 | 34 | bool sb_lua_custom_command_defined(const char *name); 35 | 36 | int sb_lua_call_custom_command(const char *name); 37 | 38 | int sb_lua_report_thread_init(void); 39 | 40 | void sb_lua_report_thread_done(void *); 41 | 42 | bool sb_lua_loaded(void); 43 | -------------------------------------------------------------------------------- /src/sb_thread.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2016-2018 Alexey Kopytov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | /* 20 | Wrappers around pthread_create() and friends to provide necessary 21 | (de-)initialization. 22 | */ 23 | 24 | #ifndef SB_THREAD_H 25 | #define SB_THREAD_H 26 | 27 | #ifdef HAVE_CONFIG_H 28 | # include "config.h" 29 | #endif 30 | 31 | #ifdef HAVE_PTHREAD_H 32 | # include 33 | #endif 34 | 35 | /* Thread context definition */ 36 | 37 | typedef struct 38 | { 39 | pthread_t thread; 40 | unsigned int id; 41 | } sb_thread_ctxt_t; 42 | 43 | extern pthread_attr_t sb_thread_attr; 44 | 45 | int sb_thread_create(pthread_t *thread, const pthread_attr_t *attr, 46 | void *(*start_routine) (void *), void *arg); 47 | 48 | int sb_thread_join(pthread_t thread, void **retval); 49 | 50 | int sb_thread_cancel(pthread_t thread); 51 | 52 | int sb_thread_create_workers(void *(*worker_routine)(void*)); 53 | 54 | int sb_thread_join_workers(void); 55 | 56 | int sb_thread_init(void); 57 | 58 | void sb_thread_done(void); 59 | 60 | #endif /* SB_THREAD_H */ 61 | -------------------------------------------------------------------------------- /src/tests/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # Copyright (C) 2004-2008 Alexey Kopytov 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | SUBDIRS = cpu fileio memory threads mutex 19 | -------------------------------------------------------------------------------- /src/tests/cpu/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # Copyright (C) 2004-2008 Alexey Kopytov 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | noinst_LIBRARIES = libsbcpu.a 19 | 20 | libsbcpu_a_SOURCES = sb_cpu.c ../sb_cpu.h 21 | 22 | libsbcpu_a_CPPFLAGS = $(AM_CPPFLAGS) 23 | -------------------------------------------------------------------------------- /src/tests/fileio/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # Copyright (C) 2004-2008 Alexey Kopytov 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | noinst_LIBRARIES = libsbfileio.a 19 | 20 | libsbfileio_a_SOURCES = sb_fileio.c ../sb_fileio.h crc32.c crc32.h crc32tbl.h 21 | 22 | libsbfileio_a_CPPFLAGS = $(AM_CPPFLAGS) 23 | -------------------------------------------------------------------------------- /src/tests/fileio/crc32.h: -------------------------------------------------------------------------------- 1 | #ifndef CRC32_H 2 | 3 | #ifdef HAVE_CONFIG_H 4 | #include 5 | #endif 6 | 7 | #define CRC32_H 8 | 9 | extern unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned len); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/tests/memory/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # Copyright (C) 2004-2008 Alexey Kopytov 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | noinst_LIBRARIES = libsbmemory.a 19 | 20 | libsbmemory_a_SOURCES = sb_memory.c ../sb_memory.h 21 | 22 | libsbmemory_a_CPPFLAGS = $(AM_CPPFLAGS) 23 | -------------------------------------------------------------------------------- /src/tests/mutex/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # Copyright (C) 2004-2008 Alexey Kopytov 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | noinst_LIBRARIES = libsbmutex.a 19 | 20 | libsbmutex_a_SOURCES = sb_mutex.c ../sb_mutex.h 21 | 22 | libsbmutex_a_CPPFLAGS = $(AM_CPPFLAGS) 23 | -------------------------------------------------------------------------------- /src/tests/sb_cpu.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 MySQL AB 2 | Copyright (C) 2004 Alexey Kopytov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef SB_CPU_H 20 | #define SB_CPU_H 21 | 22 | int register_test_cpu(sb_list_t *tests); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/tests/sb_fileio.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 MySQL AB 2 | Copyright (C) 2004-2018 Alexey Kopytov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef SB_FILEIO_H 20 | #define SB_FILEIO_H 21 | 22 | /* File operation types */ 23 | typedef enum 24 | { 25 | FILE_OP_TYPE_NULL, 26 | FILE_OP_TYPE_READ, 27 | FILE_OP_TYPE_WRITE, 28 | FILE_OP_TYPE_FSYNC 29 | } sb_file_op_t; 30 | 31 | /* File IO request definition */ 32 | 33 | typedef struct 34 | { 35 | unsigned int file_id; 36 | long long pos; 37 | ssize_t size; 38 | sb_file_op_t operation; 39 | } sb_file_request_t; 40 | 41 | int register_test_fileio(sb_list_t *tests); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/tests/sb_memory.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 MySQL AB 2 | Copyright (C) 2004-2008 Alexey Kopytov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef SB_MEMORY_H 20 | #define SB_MEMORY_H 21 | 22 | /* Memory request type definition */ 23 | typedef enum 24 | { 25 | SB_MEM_OP_NONE, 26 | SB_MEM_OP_READ, 27 | SB_MEM_OP_WRITE 28 | } sb_mem_op_t; 29 | 30 | 31 | /* Memory scope type definition */ 32 | typedef enum 33 | { 34 | SB_MEM_SCOPE_GLOBAL, 35 | SB_MEM_SCOPE_LOCAL 36 | } sb_mem_scope_t; 37 | 38 | 39 | int register_test_memory(sb_list_t *tests); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/tests/sb_mutex.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 MySQL AB 2 | Copyright (C) 2004 Alexey Kopytov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef SB_MUTEX_H 20 | #define SB_MUTEX_H 21 | 22 | /* Threads request definition */ 23 | 24 | typedef struct 25 | { 26 | unsigned int nlocks; 27 | unsigned int nloops; 28 | } sb_mutex_request_t; 29 | 30 | int register_test_mutex(sb_list_t *tests); 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /src/tests/sb_threads.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 MySQL AB 2 | Copyright (C) 2004 Alexey Kopytov 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #ifndef SB_THREADS_H 20 | #define SB_THREADS_H 21 | 22 | /* Threads request definition */ 23 | 24 | typedef struct 25 | { 26 | unsigned int lock_num; 27 | } sb_threads_request_t; 28 | 29 | int register_test_threads(sb_list_t *tests); 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /src/tests/threads/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2004 MySQL AB 2 | # Copyright (C) 2004-2008 Alexey Kopytov 3 | # 4 | # This program is free software; you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation; either version 2 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 | 18 | noinst_LIBRARIES = libsbthreads.a 19 | 20 | libsbthreads_a_SOURCES = sb_threads.c ../sb_threads.h 21 | 22 | libsbthreads_a_CPPFLAGS = $(AM_CPPFLAGS) 23 | -------------------------------------------------------------------------------- /tests/include/config.sh.in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Configuration file used by the sysbench test suite. 4 | 5 | # Copyright (C) 2016 Alexey Kopytov 6 | # 7 | # This program is free software; you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program; if not, write to the Free Software 19 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | 21 | export SBTEST_VERSION_STRING="sysbench @PACKAGE_VERSION@@SB_GIT_SHA@" 22 | export SBTEST_VERSION="@PACKAGE_VERSION@" 23 | export SBTEST_HAS_MYSQL=@USE_MYSQL@ 24 | export SBTEST_HAS_PGSQL=@USE_PGSQL@ 25 | -------------------------------------------------------------------------------- /tests/include/drv_common.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | ######################################################################### 4 | # Common code for DB driver tests 5 | # Variables: 6 | # DB_DRIVER_ARGS -- extra driver-specific arguments to pass to sysbench 7 | ######################################################################### 8 | 9 | set -eu 10 | 11 | cat >test.lua </dev/null 2>&1 4 | -------------------------------------------------------------------------------- /tests/t/api_histogram.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | Tests for histogram API 3 | ######################################################################## 4 | 5 | $ sysbench < h = sysbench.histogram.new(1000, 1, 10) 7 | > h:update(1) 8 | > h:update(2) 9 | > h:update(0) 10 | > h:update(10) 11 | > h:update(100) 12 | > h:update(5.001) 13 | > h:print() 14 | > EOF 15 | sysbench * (glob) 16 | 17 | value ------------- distribution ------------- count 18 | 1.000 |**************************************** 2 19 | 2.001 |******************** 1 20 | 4.997 |******************** 1 21 | 10.000 |**************************************** 2 22 | -------------------------------------------------------------------------------- /tests/t/cmd_cleanup.t: -------------------------------------------------------------------------------- 1 | $ sysbench cleanup 2 | sysbench * (glob) 3 | 4 | FATAL: Cannot find benchmark 'cleanup': no such built-in test, file or module 5 | [1] 6 | 7 | $ cat >cmd_cleanup.lua < function cleanup() 9 | > print('function cleanup()') 10 | > end 11 | > EOF 12 | $ sysbench cmd_cleanup.lua cleanup 13 | sysbench * (glob) 14 | 15 | function cleanup() 16 | -------------------------------------------------------------------------------- /tests/t/cmd_help.t: -------------------------------------------------------------------------------- 1 | $ sysbench help 2 | sysbench * (glob) 3 | 4 | FATAL: Cannot find benchmark 'help': no such built-in test, file or module 5 | [1] 6 | 7 | $ cat >cmd_help.lua < function help() 9 | > print('function help()') 10 | > end 11 | > EOF 12 | $ sysbench cmd_help.lua help 13 | sysbench * (glob) 14 | 15 | function help() 16 | -------------------------------------------------------------------------------- /tests/t/cmd_prepare.t: -------------------------------------------------------------------------------- 1 | $ sysbench prepare 2 | sysbench * (glob) 3 | 4 | FATAL: Cannot find benchmark 'prepare': no such built-in test, file or module 5 | [1] 6 | 7 | $ cat >cmd_prepare.lua < function prepare() 9 | > print('function prepare()') 10 | > end 11 | > EOF 12 | $ sysbench cmd_prepare.lua prepare 13 | sysbench * (glob) 14 | 15 | function prepare() 16 | -------------------------------------------------------------------------------- /tests/t/cmd_run.t: -------------------------------------------------------------------------------- 1 | $ sysbench run 2 | sysbench * (glob) 3 | 4 | FATAL: Cannot find benchmark 'run': no such built-in test, file or module 5 | [1] 6 | 7 | $ cat >cmd_run.lua < function thread_run() 9 | > print('function thread_run()') 10 | > end 11 | > function event() 12 | > end 13 | > EOF 14 | $ sysbench --verbosity=0 cmd_run.lua run 15 | function thread_run() 16 | -------------------------------------------------------------------------------- /tests/t/commands.t: -------------------------------------------------------------------------------- 1 | $ commands=$(sysbench --help | grep 'Commands' | cut -d ' ' -f 6-) 2 | $ for cmd in $commands; do 3 | > if [ ! -r ${SBTEST_SUITEDIR}/cmd_${cmd}.t ] 4 | > then 5 | > echo "Cannot find test(s) for 'sysbench $cmd'!" 6 | > exit 1 7 | > fi 8 | > done 9 | -------------------------------------------------------------------------------- /tests/t/drivers.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | Make sure all available DB drivers are covered 3 | ######################################################################## 4 | 5 | $ drivers=$(sysbench --help | sed -n '/Compiled-in database drivers:/,/^$/p' | tail -n +2 | cut -d ' ' -f 3) 6 | $ for drv in $drivers 7 | > do 8 | > if [ ! -r ${SBTEST_SUITEDIR}/drv_${drv}.t ] 9 | > then 10 | > echo "Cannot find test(s) for the $drv driver!" 11 | > exit 1 12 | > fi 13 | > done 14 | 15 | # Try using a non-existing driver 16 | $ sysbench --db-driver=nonexisting ${SBTEST_SCRIPTDIR}/oltp_read_write.lua cleanup 17 | sysbench * (glob) 18 | 19 | (FATAL: invalid database driver name: 'nonexisting'|FATAL: No DB drivers available) (re) 20 | FATAL: `cleanup' function failed: * failed to initialize the DB driver (glob) 21 | [1] 22 | -------------------------------------------------------------------------------- /tests/t/drv_mysql.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | MySQL driver tests 3 | ######################################################################## 4 | 5 | $ . $SBTEST_INCDIR/mysql_common.sh 6 | $ . $SBTEST_INCDIR/drv_common.sh 7 | sysbench *.* * (glob) 8 | 9 | Running the test with following options: 10 | Number of threads: 2 11 | Initializing random number generator from current time 12 | 13 | 14 | Initializing worker threads... 15 | 16 | Threads started! 17 | 18 | SQL statistics: 19 | queries performed: 20 | read: 10 21 | write: 0 22 | other: 0 23 | total: 10 24 | transactions: 10 (*.* per sec.) (glob) 25 | queries: 10 (*.* per sec.) (glob) 26 | ignored errors: 0 (0.00 per sec.) 27 | reconnects: 0 (0.00 per sec.) 28 | 29 | Throughput: 30 | events/s (eps): *.* (glob) 31 | time elapsed: *.*s (glob) 32 | total number of events: 10 33 | 34 | Latency (ms): 35 | min: *.* (glob) 36 | avg: *.* (glob) 37 | max: *.* (glob) 38 | 95th percentile: *.* (glob) 39 | sum: *.* (glob) 40 | 41 | Threads fairness: 42 | events (avg/stddev): *.*/*.* (glob) 43 | execution time (avg/stddev): *.*/*.* (glob) 44 | 45 | -------------------------------------------------------------------------------- /tests/t/drv_pgsql.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | PostgreSQL driver tests 3 | ######################################################################## 4 | 5 | $ . $SBTEST_INCDIR/pgsql_common.sh 6 | $ . $SBTEST_INCDIR/drv_common.sh 7 | sysbench *.* * (glob) 8 | 9 | Running the test with following options: 10 | Number of threads: 2 11 | Initializing random number generator from current time 12 | 13 | 14 | Initializing worker threads... 15 | 16 | Threads started! 17 | 18 | SQL statistics: 19 | queries performed: 20 | read: 10 21 | write: 0 22 | other: 0 23 | total: 10 24 | transactions: 10 (*.* per sec.) (glob) 25 | queries: 10 (*.* per sec.) (glob) 26 | ignored errors: 0 (0.00 per sec.) 27 | reconnects: 0 (0.00 per sec.) 28 | 29 | Throughput: 30 | events/s (eps): *.* (glob) 31 | time elapsed: *.*s (glob) 32 | total number of events: 10 33 | 34 | Latency (ms): 35 | min: *.* (glob) 36 | avg: *.* (glob) 37 | max: *.* (glob) 38 | 95th percentile: *.* (glob) 39 | sum: *.* (glob) 40 | 41 | Threads fairness: 42 | events (avg/stddev): *.*/*.* (glob) 43 | execution time (avg/stddev): *.*/*.* (glob) 44 | 45 | -------------------------------------------------------------------------------- /tests/t/help_drv_mysql.t: -------------------------------------------------------------------------------- 1 | Skip test if the MySQL driver is not available. 2 | 3 | $ if [ -z "$SBTEST_HAS_MYSQL" ] 4 | > then 5 | > exit 80 6 | > fi 7 | 8 | $ sysbench --help | grep -- '--db-driver' 9 | --db-driver=STRING specifies database driver to use ('help' to get list of available drivers) [mysql] 10 | 11 | $ sysbench --help | sed -n '/mysql options:/,/^$/p' | grep -v 'mysql-ssl[=\[]' 12 | mysql options: 13 | --mysql-host=[LIST,...] MySQL server host [localhost] 14 | --mysql-port=[LIST,...] MySQL server port [3306] 15 | --mysql-socket=[LIST,...] MySQL socket 16 | --mysql-user=STRING MySQL user [sbtest] 17 | --mysql-password=STRING MySQL password [] 18 | --mysql-db=STRING MySQL database name [sbtest] 19 | --mysql-ssl-key=STRING path name of the client private key file 20 | --mysql-ssl-ca=STRING path name of the CA file 21 | --mysql-ssl-cert=STRING path name of the client public key certificate file 22 | --mysql-ssl-cipher=STRING use specific cipher for SSL connections [] 23 | --mysql-compression[=on|off] use compression, if available in the client library [off] 24 | --mysql-compression-algorithms=STRING compression algorithms to use [zlib] 25 | --mysql-debug[=on|off] trace all client library calls [off] 26 | --mysql-ignore-errors=[LIST,...] list of errors to ignore, or "all" [1213,1020,1205] 27 | --mysql-dry-run[=on|off] Dry run, pretend that all MySQL client API calls are successful without executing them [off] 28 | 29 | -------------------------------------------------------------------------------- /tests/t/help_drv_pgsql.t: -------------------------------------------------------------------------------- 1 | Skip test if the PostgreSQL driver is not available. 2 | 3 | $ if [ -z "$SBTEST_HAS_PGSQL" ] 4 | > then 5 | > exit 80 6 | > fi 7 | 8 | $ sysbench --help | sed -n '/pgsql options:/,/^$/p' 9 | pgsql options: 10 | --pgsql-host=STRING PostgreSQL server host [localhost] 11 | --pgsql-port=N PostgreSQL server port [5432] 12 | --pgsql-user=STRING PostgreSQL user [sbtest] 13 | --pgsql-password=STRING PostgreSQL password [] 14 | --pgsql-db=STRING PostgreSQL database name [sbtest] 15 | --pgsql-sslmode=STRING PostgreSQL SSL mode (disable, allow, prefer, require, verify-ca, verify-full) [prefer] 16 | 17 | -------------------------------------------------------------------------------- /tests/t/opt_histogram.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | --histogram tests 3 | ######################################################################## 4 | 5 | $ cat >$CRAMTMP/histogram.lua < local ffi = require("ffi") 7 | > ffi.cdef[[ 8 | > int usleep(unsigned int); 9 | > ]] 10 | > function event() 11 | > if (sysbench.tid == 0) then 12 | > ffi.C.usleep(1000000) 13 | > else 14 | > ffi.C.usleep(2000000) 15 | > end 16 | > end 17 | > EOF 18 | $ sysbench --histogram $CRAMTMP/histogram.lua --events=2 --threads=2 run 19 | sysbench * (glob) 20 | 21 | Running the test with following options: 22 | Number of threads: 2 23 | Initializing random number generator from current time 24 | 25 | 26 | Initializing worker threads... 27 | 28 | Threads started! 29 | 30 | Latency histogram (values are in milliseconds) 31 | value ------------- distribution ------------- count 32 | * |\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* 1 (glob) 33 | * |\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* 1 (glob) 34 | 35 | 36 | Throughput: 37 | events/s (eps): *.* (glob) 38 | time elapsed: *s (glob) 39 | total number of events: 2 40 | 41 | Latency (ms): 42 | min: *.* (glob) 43 | avg: *.* (glob) 44 | max: *.* (glob) 45 | 95th percentile: *.* (glob) 46 | sum: *.* (glob) 47 | 48 | Threads fairness: 49 | events (avg/stddev): 1.0000/0.00 50 | execution time (avg/stddev): */* (glob) 51 | 52 | -------------------------------------------------------------------------------- /tests/t/opt_luajit_cmd.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | --luajit-cmd tests 3 | ######################################################################## 4 | 5 | $ cat >opt_luajit_cmd.lua < print("JIT status: " .. (jit.status() and "on" or "off")) 7 | > EOF 8 | $ sysbench --luajit-cmd opt_luajit_cmd.lua 9 | sysbench * (glob) 10 | 11 | JIT status: on 12 | 13 | $ sysbench --luajit-cmd=off opt_luajit_cmd.lua 14 | sysbench * (glob) 15 | 16 | JIT status: off 17 | 18 | $ sysbench --luajit-cmd=on opt_luajit_cmd.lua 19 | sysbench * (glob) 20 | 21 | JIT status: on 22 | -------------------------------------------------------------------------------- /tests/t/opt_rate.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | Tests for the --rate option (aka the limited rate mode) 3 | ######################################################################## 4 | 5 | # Failing to deliver the requested rate should result in a non-zero exit code 6 | $ sysbench --rate=2000000000 cpu run --verbosity=1 7 | FATAL: The event queue is full. This means the worker threads are unable to keep up with the specified event generation rate 8 | [1] 9 | -------------------------------------------------------------------------------- /tests/t/opt_report_checkpoints.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | # --report-checkpoints tests 3 | ######################################################################## 4 | 5 | $ if [ -z "$SBTEST_HAS_MYSQL" ] 6 | > then 7 | > exit 80 8 | > fi 9 | 10 | $ sysbench ${SBTEST_SCRIPTDIR}/oltp_read_write.lua --db-driver=mysql --mysql-dry-run --time=3 --events=0 --report-checkpoints=1,2 run | grep -E '(Checkpoint report|SQL statistics)' 11 | [ 1s ] Checkpoint report: 12 | SQL statistics: 13 | [ 2s ] Checkpoint report: 14 | SQL statistics: 15 | SQL statistics: 16 | 17 | # Run a test that does not support checkpoint reports 18 | 19 | $ sysbench cpu --report-checkpoints=1 --time=2 run | grep 'Checkpoint report' 20 | [ 1s ] Checkpoint report: 21 | -------------------------------------------------------------------------------- /tests/t/opt_report_interval.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | # --report-interval tests 3 | ######################################################################## 4 | 5 | $ if [ -z "$SBTEST_HAS_MYSQL" ] 6 | > then 7 | > exit 80 8 | > fi 9 | 10 | $ sysbench ${SBTEST_SCRIPTDIR}/oltp_read_write.lua --db-driver=mysql --mysql-dry-run --time=3 --events=0 --report-interval=1 run | grep '\[ 2s \]' 11 | [ 2s ] thds: 1 tps: * qps: * (r/w/o: */*/*) lat (ms,95%): *.* err/s: 0.00 reconn/s: 0.00 (glob) 12 | 13 | # Run a test that does not support intermediate reports 14 | 15 | $ sysbench cpu --report-interval=1 --time=2 run | grep '\[ 1s \]' 16 | [ 1s ] thds: 1 eps: * lat (ms,95%): * (glob) 17 | -------------------------------------------------------------------------------- /tests/t/opt_version.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | Test for the --version option 3 | ######################################################################## 4 | 5 | $ sysbench --version 6 | sysbench [.0-9]+(-[a-f0-9]+)? (re) 7 | 8 | $ version=$(sysbench --version | cut -d ' ' -f 1,2) 9 | $ test "$version" = "$SBTEST_VERSION_STRING" 10 | -------------------------------------------------------------------------------- /tests/t/script_oltp_general_mysql.t: -------------------------------------------------------------------------------- 1 | $ . $SBTEST_INCDIR/mysql_common.sh 2 | $ SB_EXTRA_ARGS=${SB_EXTRA_ARGS:-} 3 | $ ARGS="oltp_read_write ${DB_DRIVER_ARGS} --verbosity=1 ${SB_EXTRA_ARGS}" 4 | 5 | $ sysbench $ARGS --create-table-options="COMMENT='foo'" prepare 6 | Creating table 'sbtest1'... 7 | Inserting 10000 records into 'sbtest1' 8 | Creating a secondary index on 'sbtest1'... 9 | 10 | $ db_show_table sbtest1 11 | *************************** 1. row *************************** 12 | sbtest1 13 | CREATE TABLE `sbtest1` ( 14 | `id` int* NOT NULL AUTO_INCREMENT, (glob) 15 | `k` int* NOT NULL DEFAULT '0', (glob) 16 | `c` char(120)* NOT NULL DEFAULT '', (glob) 17 | `pad` char(60)* NOT NULL DEFAULT '', (glob) 18 | PRIMARY KEY (`id`), 19 | KEY `k_1` (`k`) 20 | ) ENGINE=InnoDB * COMMENT='foo' (glob) 21 | 22 | $ sysbench $ARGS cleanup 23 | Dropping table 'sbtest1'... 24 | -------------------------------------------------------------------------------- /tests/t/test_cpu.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | cpu benchmark tests 3 | ######################################################################## 4 | $ args="cpu --cpu-max-prime=1000 --events=100 --threads=2" 5 | $ sysbench $args help 6 | sysbench *.* * (glob) 7 | 8 | cpu options: 9 | --cpu-max-prime=N upper limit for primes generator [10000] 10 | 11 | $ sysbench $args prepare 12 | sysbench *.* * (glob) 13 | 14 | 'cpu' test does not implement the 'prepare' command. 15 | [1] 16 | $ sysbench $args run 17 | sysbench *.* * (glob) 18 | 19 | Running the test with following options: 20 | Number of threads: 2 21 | Initializing random number generator from current time 22 | 23 | 24 | Prime numbers limit: 1000 25 | 26 | Initializing worker threads... 27 | 28 | Threads started! 29 | 30 | CPU speed: 31 | events per second: *.* (glob) 32 | 33 | Throughput: 34 | events/s (eps): *.* (glob) 35 | time elapsed: *s (glob) 36 | total number of events: 100 37 | 38 | Latency (ms): 39 | min: *.* (glob) 40 | avg: *.* (glob) 41 | max: *.* (glob) 42 | 95th percentile: *.* (glob) 43 | sum: *.* (glob) 44 | 45 | Threads fairness: 46 | events (avg/stddev): 50.0000/* (glob) 47 | execution time (avg/stddev): */* (glob) 48 | 49 | $ sysbench $args cleanup 50 | sysbench *.* * (glob) 51 | 52 | 'cpu' test does not implement the 'cleanup' command. 53 | [1] 54 | -------------------------------------------------------------------------------- /tests/t/test_mutex.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | mutex benchmark tests 3 | ######################################################################## 4 | $ args="mutex --events=10 --threads=2" 5 | $ sysbench $args help 6 | sysbench *.* * (glob) 7 | 8 | mutex options: 9 | --mutex-num=N total size of mutex array [4096] 10 | --mutex-locks=N number of mutex locks to do per thread [50000] 11 | --mutex-loops=N number of empty loops to do outside mutex lock [10000] 12 | 13 | $ sysbench $args prepare 14 | sysbench *.* * (glob) 15 | 16 | 'mutex' test does not implement the 'prepare' command. 17 | [1] 18 | $ sysbench $args run 19 | sysbench *.* * (glob) 20 | 21 | Running the test with following options: 22 | Number of threads: 2 23 | Initializing random number generator from current time 24 | 25 | 26 | Initializing worker threads... 27 | 28 | Threads started! 29 | 30 | 31 | Throughput: 32 | events/s (eps): *.* (glob) 33 | time elapsed: *s (glob) 34 | total number of events: 2 35 | 36 | Latency (ms): 37 | min: *.* (glob) 38 | avg: *.* (glob) 39 | max: *.* (glob) 40 | 95th percentile: *.* (glob) 41 | sum: *.* (glob) 42 | 43 | Threads fairness: 44 | events (avg/stddev): */* (glob) 45 | execution time (avg/stddev): */* (glob) 46 | 47 | $ sysbench $args cleanup 48 | sysbench *.* * (glob) 49 | 50 | 'mutex' test does not implement the 'cleanup' command. 51 | [1] 52 | -------------------------------------------------------------------------------- /tests/t/test_threads.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | threads benchmark tests 3 | ######################################################################## 4 | 5 | $ args="threads --events=100 --threads=2" 6 | $ sysbench $args help 7 | sysbench *.* * (glob) 8 | 9 | threads options: 10 | --thread-yields=N number of yields to do per request [1000] 11 | --thread-locks=N number of locks per thread [8] 12 | 13 | $ sysbench $args prepare 14 | sysbench *.* * (glob) 15 | 16 | 'threads' test does not implement the 'prepare' command. 17 | [1] 18 | $ sysbench $args run 19 | sysbench *.* * (glob) 20 | 21 | Running the test with following options: 22 | Number of threads: 2 23 | Initializing random number generator from current time 24 | 25 | 26 | Initializing worker threads... 27 | 28 | Threads started! 29 | 30 | 31 | Throughput: 32 | events/s (eps): *.* (glob) 33 | time elapsed: *s (glob) 34 | total number of events: 100 35 | 36 | Latency (ms): 37 | min: *.* (glob) 38 | avg: *.* (glob) 39 | max: *.* (glob) 40 | 95th percentile: *.* (glob) 41 | sum: *.* (glob) 42 | 43 | Threads fairness: 44 | events (avg/stddev): */* (glob) 45 | execution time (avg/stddev): */* (glob) 46 | 47 | $ sysbench $args cleanup 48 | sysbench *.* * (glob) 49 | 50 | 'threads' test does not implement the 'cleanup' command. 51 | [1] 52 | -------------------------------------------------------------------------------- /tests/t/tests.t: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | Make sure all built-in tests are covered 3 | ######################################################################## 4 | 5 | $ tests=$(sysbench --help | sed -n '/Compiled-in tests:/,/^$/p' | tail -n +2 | cut -d ' ' -f 3) 6 | $ for t in $tests 7 | > do 8 | > if [ ! -r ${SBTEST_SUITEDIR}/test_${t}.t ] 9 | > then 10 | > echo "Cannot find regression test(s) for 'sysbench $t'!" 11 | > exit 1 12 | > fi 13 | > done 14 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2016 Alexey Kopytov 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 | 17 | EXTRA_DIST = ck 18 | 19 | all-local: $(builddir)/lib/libck.a 20 | 21 | # Concurrency Kit does not support VPATH builds 22 | $(builddir)/lib/libck.a: 23 | rm -rf tmp 24 | mkdir tmp 25 | tar -C $(srcdir) -cf - ck | tar -xf - -C tmp/ 26 | chmod -R u+w tmp 27 | cd tmp/ck && \ 28 | CC="$(CC)" \ 29 | CFLAGS="$(CFLAGS) $(CPPFLAGS)" \ 30 | LDFLAGS="$(LDFLAGS)" \ 31 | ./configure ${CK_CONFIGURE_FLAGS} \ 32 | --prefix=$(abs_top_builddir)/third_party/concurrency_kit && \ 33 | $(MAKE) && \ 34 | $(MAKE) install 35 | 36 | clean-local: 37 | rm -rf tmp include lib share 38 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/README: -------------------------------------------------------------------------------- 1 | ____ _ ___ _ 2 | / ___|___ _ __ ___ _ _ _ __ _ __ ___ _ __ ___ _ _ | |/ (_) |_ 3 | | | / _ \| '_ \ / __| | | | '__| '__/ _ \ '_ \ / __| | | | | ' /| | __| 4 | | |__| (_) | | | | (__| |_| | | | | | __/ | | | (__| |_| | | . \| | |_ 5 | \____\___/|_| |_|\___|\__,_|_| |_| \___|_| |_|\___|\__, | |_|\_\_|\__| 6 | |___/ 7 | 8 | Step 1. 9 | ./configure 10 | For additional options try ./configure --help 11 | 12 | Step 2. 13 | In order to compile regressions (requires POSIX threads) use 14 | "make regressions". In order to compile libck use "make all" or "make". 15 | 16 | Step 3. 17 | In order to install use "make install" 18 | To uninstall use "make uninstall". 19 | 20 | See http://concurrencykit.org/ for more information. 21 | 22 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/build/ck.build.aarch64: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/build/ck.build.arm: -------------------------------------------------------------------------------- 1 | CFLAGS+=-D__arm__ 2 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/build/ck.build.in: -------------------------------------------------------------------------------- 1 | CC=@CC@ 2 | MAKE=make 3 | SRC_DIR=@SRC_DIR@ 4 | BUILD_DIR=@BUILD_DIR@ 5 | CFLAGS+=@CFLAGS@ -I$(SRC_DIR)/include -I$(BUILD_DIR)/include 6 | LDFLAGS+=@LDFLAGS@ 7 | ALL_LIBS=@ALL_LIBS@ 8 | LD=@LD@ 9 | 10 | include $(BUILD_DIR)/build/ck.build.@PROFILE@ 11 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/build/ck.build.ppc: -------------------------------------------------------------------------------- 1 | CFLAGS+=-m32 -D__ppc__ 2 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/build/ck.build.ppc64: -------------------------------------------------------------------------------- 1 | CFLAGS+=-m64 -D__ppc64__ 2 | LDFLAGS+=-m64 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/build/ck.build.s390x: -------------------------------------------------------------------------------- 1 | CFLAGS+=-O2 -D__s390x__ 2 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/build/ck.build.sparcv9: -------------------------------------------------------------------------------- 1 | CFLAGS+=-m64 -D__sparcv9__ 2 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/build/ck.build.x86: -------------------------------------------------------------------------------- 1 | CFLAGS+=-m32 -D__x86__ -msse -msse2 2 | LDFLAGS+=-m32 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/build/ck.build.x86_64: -------------------------------------------------------------------------------- 1 | CFLAGS+=-m64 -D__x86_64__ 2 | LDFLAGS+=-m64 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/build/ck.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@PREFIX@ 2 | includedir=@HEADERS@ 3 | libdir=@LIBRARY@ 4 | 5 | Name: Concurrency Kit 6 | Description: Toolkit for well-specified design and implementation of concurrent systems 7 | URL: http://concurrencykit.org/ 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lck 10 | Cflags: -D__@PROFILE@__ -I${includedir} @PC_CFLAGS@ 11 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/build/regressions.build.in: -------------------------------------------------------------------------------- 1 | CC=@CC@ 2 | MAKE=make 3 | CORES=@CORES@ 4 | CFLAGS=@CFLAGS@ -I../../../include -DCORES=@CORES@ 5 | LD=@LD@ 6 | LDFLAGS=@LDFLAGS@ 7 | PTHREAD_CFLAGS=@PTHREAD_CFLAGS@ 8 | BUILD_DIR=@BUILD_DIR@ 9 | 10 | include $(BUILD_DIR)/build/ck.build.@PROFILE@ 11 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/doc/refcheck.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use warnings; 4 | use strict; 5 | 6 | my @files = @ARGV; 7 | 8 | my $h; 9 | 10 | foreach my $file (@files) { 11 | $h->{$file} = 1; 12 | } 13 | 14 | foreach my $file (@files) { 15 | open(my $fh, "<", $file) or die "cannot open < $file: $!"; 16 | while (<$fh>) { 17 | chomp; 18 | if ($_ =~ /\.Xr ((ck|CK)_[a-zA-Z_]+) ([0-9])/) { 19 | my $name = $1; 20 | my $section = $3; 21 | if (!$h->{$name}) { 22 | print STDERR "$file: ref to missing ${name}($section)\n"; 23 | } 24 | } 25 | } 26 | close($fh) or die("cannot close $file: $!"); 27 | } 28 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/include/ck_malloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2015 Samy Al Bahra. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef CK_MALLOC_H 28 | #define CK_MALLOC_H 29 | 30 | #include 31 | #include 32 | 33 | struct ck_malloc { 34 | void *(*malloc)(size_t); 35 | void *(*realloc)(void *, size_t, size_t, bool); 36 | void (*free)(void *, size_t, bool); 37 | }; 38 | 39 | #endif /* CK_MALLOC_H */ 40 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/include/ck_stdbool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Olivier Houchard. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | */ 26 | 27 | #if defined(__FreeBSD__) && defined(_KERNEL) 28 | #include 29 | #else 30 | #include 31 | #endif 32 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/include/ck_stddef.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Olivier Houchard. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | */ 26 | 27 | #if defined(__FreeBSD__) && defined(_KERNEL) 28 | #include 29 | #else 30 | #include 31 | #endif 32 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/include/ck_stdint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2015 Samy Al Bahra. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | */ 26 | 27 | #if defined(__linux__) && defined(__KERNEL__) 28 | #include 29 | #include 30 | #elif defined(__FreeBSD__) && defined(_KERNEL) 31 | #include 32 | #else 33 | #include 34 | #endif /* __linux__ && __KERNEL__ */ 35 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/include/ck_stdlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Olivier Houchard. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | */ 26 | 27 | #if defined(__FreeBSD__) && defined(_KERNEL) 28 | #include 29 | #else 30 | #include 31 | #endif 32 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/include/ck_string.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Olivier Houchard. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | */ 26 | 27 | #if defined(__FreeBSD__) && defined(_KERNEL) 28 | #include 29 | #else 30 | #include 31 | #endif 32 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/include/gcc/sparcv9/ck_f_pr.h: -------------------------------------------------------------------------------- 1 | #define CK_F_PR_CAS_64 2 | #define CK_F_PR_CAS_64_VALUE 3 | #define CK_F_PR_CAS_PTR 4 | #define CK_F_PR_CAS_PTR_VALUE 5 | #define CK_F_PR_FAS_32 6 | #define CK_F_PR_FAS_UINT 7 | #define CK_F_PR_FAS_INT 8 | #define CK_F_PR_CAS_32 9 | #define CK_F_PR_CAS_32_VALUE 10 | #define CK_F_PR_CAS_UINT 11 | #define CK_F_PR_CAS_INT 12 | #define CK_F_PR_CAS_UINT_VALUE 13 | #define CK_F_PR_CAS_INT_VALUE 14 | #define CK_F_PR_STORE_64 15 | #define CK_F_PR_STORE_32 16 | #define CK_F_PR_STORE_DOUBLE 17 | #define CK_F_PR_STORE_UINT 18 | #define CK_F_PR_STORE_INT 19 | #define CK_F_PR_STORE_PTR 20 | #define CK_F_PR_LOAD_64 21 | #define CK_F_PR_LOAD_32 22 | #define CK_F_PR_LOAD_DOUBLE 23 | #define CK_F_PR_LOAD_UINT 24 | #define CK_F_PR_LOAD_INT 25 | #define CK_F_PR_LOAD_PTR 26 | 27 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/Makefile.unsupported: -------------------------------------------------------------------------------- 1 | .PHONY: all clean check 2 | 3 | all: 4 | @echo Regressions are currently unsupported for out-of-source builds 5 | 6 | clean: all 7 | 8 | check: all 9 | 10 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_array/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=serial 4 | 5 | all: $(OBJECTS) 6 | 7 | serial: serial.c ../../../include/ck_array.h ../../../src/ck_array.c 8 | $(CC) $(CFLAGS) -o serial serial.c ../../../src/ck_array.c 9 | 10 | check: all 11 | ./serial 12 | 13 | clean: 14 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=-D_GNU_SOURCE -ggdb 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_backoff/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean 2 | 3 | all: validate 4 | 5 | validate: validate.c ../../../include/ck_backoff.h 6 | $(CC) $(CFLAGS) -o validate validate.c 7 | 8 | check: all 9 | ./validate 10 | 11 | clean: 12 | rm -rf validate *.dSYM *.exe 13 | 14 | include ../../../build/regressions.build 15 | CFLAGS+=-D_GNU_SOURCE 16 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_barrier/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=throughput 4 | 5 | all: $(OBJECTS) 6 | 7 | throughput: throughput.c ../../../include/ck_barrier.h ../../../src/ck_barrier_centralized.c 8 | $(CC) $(CFLAGS) -o throughput throughput.c ../../../src/ck_barrier_centralized.c 9 | 10 | clean: 11 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 12 | 13 | include ../../../build/regressions.build 14 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 15 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_barrier/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=barrier_centralized barrier_combining barrier_dissemination barrier_tournament barrier_mcs 4 | 5 | all: $(OBJECTS) 6 | 7 | barrier_centralized: barrier_centralized.c ../../../include/ck_barrier.h ../../../src/ck_barrier_centralized.c 8 | $(CC) $(CFLAGS) -o barrier_centralized barrier_centralized.c ../../../src/ck_barrier_centralized.c 9 | 10 | barrier_combining: barrier_combining.c ../../../include/ck_barrier.h ../../../src/ck_barrier_combining.c 11 | $(CC) $(CFLAGS) -o barrier_combining barrier_combining.c ../../../src/ck_barrier_combining.c 12 | 13 | barrier_dissemination: barrier_dissemination.c ../../../include/ck_barrier.h ../../../src/ck_barrier_dissemination.c 14 | $(CC) $(CFLAGS) -o barrier_dissemination barrier_dissemination.c ../../../src/ck_barrier_dissemination.c 15 | 16 | barrier_tournament: barrier_tournament.c ../../../include/ck_barrier.h ../../../src/ck_barrier_tournament.c 17 | $(CC) $(CFLAGS) -o barrier_tournament barrier_tournament.c ../../../src/ck_barrier_tournament.c 18 | 19 | barrier_mcs: barrier_mcs.c ../../../include/ck_barrier.h ../../../src/ck_barrier_mcs.c 20 | $(CC) $(CFLAGS) -o barrier_mcs barrier_mcs.c ../../../src/ck_barrier_mcs.c 21 | 22 | check: all 23 | rc=0; \ 24 | for d in $(OBJECTS) ; do \ 25 | echo $$d; \ 26 | ./$$d $(CORES) 1 1 || rc=1; \ 27 | done; \ 28 | exit $$rc 29 | 30 | clean: 31 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 32 | 33 | include ../../../build/regressions.build 34 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 35 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_bitmap/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean 2 | 3 | OBJECTS=serial 4 | 5 | all: $(OBJECTS) 6 | 7 | serial: serial.c ../../../include/ck_bitmap.h 8 | $(CC) $(CFLAGS) -o serial serial.c 9 | 10 | clean: 11 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 12 | 13 | check: all 14 | ./serial 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=-D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_brlock/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=latency throughput 4 | 5 | all: $(OBJECTS) 6 | 7 | latency: latency.c ../../../include/ck_brlock.h 8 | $(CC) $(CFLAGS) -o latency latency.c 9 | 10 | throughput: throughput.c ../../../include/ck_brlock.h 11 | $(CC) $(CFLAGS) -o throughput throughput.c 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_brlock/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=validate 4 | 5 | all: $(OBJECTS) 6 | 7 | validate: validate.c ../../../include/ck_brlock.h 8 | $(CC) $(CFLAGS) -o validate validate.c 9 | 10 | check: all 11 | ./validate $(CORES) 1 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_bytelock/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=latency 4 | 5 | all: $(OBJECTS) 6 | 7 | latency: latency.c 8 | $(CC) $(CFLAGS) -o latency latency.c 9 | 10 | clean: 11 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 12 | 13 | include ../../../build/regressions.build 14 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 15 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_bytelock/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=validate 4 | 5 | all: $(OBJECTS) 6 | 7 | validate: validate.c ../../../include/ck_bytelock.h 8 | $(CC) $(CFLAGS) -o validate validate.c 9 | 10 | check: all 11 | ./validate $(CORES) 1 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_cohort/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all clean 2 | 3 | OBJECTS=ck_cohort.THROUGHPUT ck_cohort.LATENCY 4 | 5 | all: $(OBJECTS) 6 | 7 | ck_cohort.THROUGHPUT: ck_cohort.c 8 | $(CC) $(CFLAGS) -o ck_cohort.THROUGHPUT throughput.c -lm 9 | 10 | ck_cohort.LATENCY: ck_cohort.c 11 | $(CC) -DLATENCY $(CFLAGS) -o ck_cohort.LATENCY ck_cohort.c 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE -lm 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_cohort/benchmark/ck_cohort.c: -------------------------------------------------------------------------------- 1 | #include "../ck_cohort.h" 2 | 3 | #include 4 | #ifdef THROUGHPUT 5 | #include "../../ck_spinlock/benchmark/throughput.h" 6 | #elif defined(LATENCY) 7 | #include "../../ck_spinlock/benchmark/latency.h" 8 | #endif 9 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_cohort/ck_cohort.h: -------------------------------------------------------------------------------- 1 | #define LOCK_NAME "ck_cohort" 2 | #define LOCK_DEFINE \ 3 | static ck_spinlock_fas_t global_fas_lock = CK_SPINLOCK_FAS_INITIALIZER; \ 4 | static ck_spinlock_fas_t local_fas_lock = CK_SPINLOCK_FAS_INITIALIZER; \ 5 | static void \ 6 | ck_spinlock_fas_lock_with_context(ck_spinlock_fas_t *lock, void *context) \ 7 | { \ 8 | (void)context; \ 9 | ck_spinlock_fas_lock(lock); \ 10 | } \ 11 | \ 12 | static void \ 13 | ck_spinlock_fas_unlock_with_context(ck_spinlock_fas_t *lock, void *context) \ 14 | { \ 15 | (void)context; \ 16 | ck_spinlock_fas_unlock(lock); \ 17 | } \ 18 | \ 19 | static bool \ 20 | ck_spinlock_fas_locked_with_context(ck_spinlock_fas_t *lock, void *context) \ 21 | { \ 22 | (void)context; \ 23 | return ck_spinlock_fas_locked(lock); \ 24 | } \ 25 | CK_COHORT_PROTOTYPE(fas_fas, \ 26 | ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, \ 27 | ck_spinlock_fas_locked_with_context, ck_spinlock_fas_lock_with_context, \ 28 | ck_spinlock_fas_unlock_with_context, ck_spinlock_fas_locked_with_context) \ 29 | static CK_COHORT_INSTANCE(fas_fas) CK_CC_CACHELINE cohort = CK_COHORT_INITIALIZER 30 | 31 | 32 | #define LOCK_INIT CK_COHORT_INIT(fas_fas, &cohort, &global_fas_lock, &local_fas_lock, \ 33 | CK_COHORT_DEFAULT_LOCAL_PASS_LIMIT) 34 | #define LOCK CK_COHORT_LOCK(fas_fas, &cohort, NULL, NULL) 35 | #define UNLOCK CK_COHORT_UNLOCK(fas_fas, &cohort, NULL, NULL) 36 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_cohort/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=validate 4 | 5 | all: $(OBJECTS) 6 | 7 | validate: validate.c ../../../include/ck_cohort.h 8 | $(CC) $(CFLAGS) -o validate validate.c 9 | 10 | check: all 11 | ./validate `expr $(CORES) / 2` 2 1 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_fifo/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=latency 4 | 5 | all: $(OBJECTS) 6 | 7 | latency: latency.c 8 | $(CC) $(CFLAGS) -o latency latency.c 9 | 10 | clean: 11 | rm -rf *~ *.o *.dSYM *.exe $(OBJECTS) 12 | 13 | include ../../../build/regressions.build 14 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 15 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_fifo/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=ck_fifo_spsc ck_fifo_mpmc ck_fifo_spsc_iterator ck_fifo_mpmc_iterator 4 | 5 | all: $(OBJECTS) 6 | 7 | check: all 8 | ./ck_fifo_spsc $(CORES) 1 64000 9 | ./ck_fifo_mpmc $(CORES) 1 16000 10 | ./ck_fifo_spsc_iterator 11 | ./ck_fifo_mpmc_iterator 12 | 13 | ck_fifo_spsc: ck_fifo_spsc.c ../../../include/ck_fifo.h 14 | $(CC) $(CFLAGS) -o ck_fifo_spsc ck_fifo_spsc.c 15 | 16 | ck_fifo_mpmc: ck_fifo_mpmc.c ../../../include/ck_fifo.h 17 | $(CC) $(CFLAGS) -o ck_fifo_mpmc ck_fifo_mpmc.c 18 | 19 | ck_fifo_spsc_iterator: ck_fifo_spsc_iterator.c ../../../include/ck_fifo.h 20 | $(CC) $(CFLAGS) -o ck_fifo_spsc_iterator ck_fifo_spsc_iterator.c 21 | 22 | ck_fifo_mpmc_iterator: ck_fifo_mpmc_iterator.c ../../../include/ck_fifo.h 23 | $(CC) $(CFLAGS) -o ck_fifo_mpmc_iterator ck_fifo_mpmc_iterator.c 24 | 25 | clean: 26 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 27 | 28 | include ../../../build/regressions.build 29 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 30 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_hp/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=fifo_latency stack_latency 4 | 5 | all: $(OBJECTS) 6 | 7 | fifo_latency: fifo_latency.c 8 | $(CC) $(CFLAGS) -o fifo_latency ../../../src/ck_hp.c fifo_latency.c 9 | 10 | stack_latency: stack_latency.c 11 | $(CC) $(CFLAGS) -o stack_latency ../../../src/ck_hp.c stack_latency.c 12 | 13 | clean: 14 | rm -rf *~ *.o *.dSYM *.exe $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_hp/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=ck_hp_stack nbds_haz_test serial ck_hp_fifo ck_hp_fifo_donner 4 | 5 | all: $(OBJECTS) 6 | 7 | check: all 8 | ./serial 9 | ./ck_hp_stack $(CORES) 100 1 10 | ./ck_hp_fifo $(CORES) 1 16384 100 11 | ./nbds_haz_test $(CORES) 15 1 12 | ./ck_hp_fifo_donner $(CORES) 16384 13 | 14 | ck_hp_stack: ../../../src/ck_hp.c ck_hp_stack.c ../../../include/ck_hp_stack.h 15 | $(CC) $(CFLAGS) ../../../src/ck_hp.c -o ck_hp_stack ck_hp_stack.c 16 | 17 | ck_hp_fifo: ../../../src/ck_hp.c ck_hp_fifo.c ../../../include/ck_hp_fifo.h 18 | $(CC) $(CFLAGS) ../../../src/ck_hp.c -o ck_hp_fifo ck_hp_fifo.c 19 | 20 | ck_hp_fifo_donner: ../../../src/ck_hp.c ck_hp_fifo_donner.c ../../../include/ck_hp_fifo.h 21 | $(CC) $(CFLAGS) ../../../src/ck_hp.c -o ck_hp_fifo_donner ck_hp_fifo_donner.c 22 | 23 | serial: ../../../src/ck_hp.c serial.c ../../../include/ck_hp_stack.h 24 | $(CC) $(CFLAGS) ../../../src/ck_hp.c -o serial serial.c 25 | 26 | nbds_haz_test: ../../../src/ck_hp.c nbds_haz_test.c 27 | $(CC) $(CFLAGS) ../../../src/ck_hp.c -o nbds_haz_test nbds_haz_test.c 28 | 29 | clean: 30 | rm -rf *~ *.o *.dSYM *.exe $(OBJECTS) 31 | 32 | include ../../../build/regressions.build 33 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 34 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_hs/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=serial parallel_bytestring parallel_bytestring.delete apply 4 | 5 | all: $(OBJECTS) 6 | 7 | serial: serial.c ../../../include/ck_hs.h ../../../src/ck_hs.c 8 | $(CC) $(CFLAGS) -o serial serial.c ../../../src/ck_hs.c 9 | 10 | apply: apply.c ../../../include/ck_hs.h ../../../src/ck_hs.c 11 | $(CC) $(CFLAGS) -o apply apply.c ../../../src/ck_hs.c 12 | 13 | parallel_bytestring: parallel_bytestring.c ../../../include/ck_hs.h ../../../src/ck_hs.c ../../../src/ck_epoch.c 14 | $(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -o parallel_bytestring parallel_bytestring.c ../../../src/ck_hs.c ../../../src/ck_epoch.c 15 | 16 | parallel_bytestring.delete: parallel_bytestring.c ../../../include/ck_hs.h ../../../src/ck_hs.c ../../../src/ck_epoch.c 17 | $(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -DHS_DELETE -o parallel_bytestring.delete parallel_bytestring.c ../../../src/ck_hs.c ../../../src/ck_epoch.c 18 | 19 | clean: 20 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 21 | 22 | include ../../../build/regressions.build 23 | CFLAGS+=-D_GNU_SOURCE 24 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_hs/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=serial 4 | 5 | all: $(OBJECTS) 6 | 7 | serial: serial.c ../../../include/ck_hs.h ../../../src/ck_hs.c 8 | $(CC) $(CFLAGS) -o serial serial.c ../../../src/ck_hs.c 9 | 10 | check: all 11 | ./serial 12 | 13 | clean: 14 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=-D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_ht/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=serial serial.delete parallel_bytestring parallel_bytestring.delete parallel_direct 4 | 5 | all: $(OBJECTS) 6 | 7 | serial: serial.c ../../../include/ck_ht.h ../../../src/ck_ht.c 8 | $(CC) $(CFLAGS) -o serial serial.c ../../../src/ck_ht.c 9 | 10 | serial.delete: serial.c ../../../include/ck_ht.h ../../../src/ck_ht.c 11 | $(CC) $(CFLAGS) -DHT_DELETE -o serial.delete serial.c ../../../src/ck_ht.c 12 | 13 | parallel_bytestring.delete: parallel_bytestring.c ../../../include/ck_ht.h ../../../src/ck_ht.c ../../../src/ck_epoch.c 14 | $(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -DHT_DELETE -o parallel_bytestring.delete parallel_bytestring.c ../../../src/ck_ht.c ../../../src/ck_epoch.c 15 | 16 | parallel_bytestring: parallel_bytestring.c ../../../include/ck_ht.h ../../../src/ck_ht.c ../../../src/ck_epoch.c 17 | $(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -o parallel_bytestring parallel_bytestring.c ../../../src/ck_ht.c ../../../src/ck_epoch.c 18 | 19 | parallel_direct: parallel_direct.c ../../../include/ck_ht.h ../../../src/ck_ht.c ../../../src/ck_epoch.c 20 | $(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -o parallel_direct parallel_direct.c ../../../src/ck_ht.c ../../../src/ck_epoch.c 21 | 22 | clean: 23 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 24 | 25 | include ../../../build/regressions.build 26 | CFLAGS+=-D_GNU_SOURCE 27 | 28 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_ht/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=serial serial.delete 4 | 5 | all: $(OBJECTS) 6 | 7 | serial: serial.c ../../../include/ck_ht.h ../../../src/ck_ht.c 8 | $(CC) $(CFLAGS) -o serial serial.c ../../../src/ck_ht.c 9 | 10 | serial.delete: serial.c ../../../include/ck_ht.h ../../../src/ck_ht.c 11 | $(CC) $(CFLAGS) -DHT_DELETE -o serial.delete serial.c ../../../src/ck_ht.c 12 | 13 | check: all 14 | ./serial 15 | ./serial.delete 16 | 17 | clean: 18 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 19 | 20 | include ../../../build/regressions.build 21 | CFLAGS+=-D_GNU_SOURCE 22 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_pflock/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=latency throughput 4 | 5 | all: $(OBJECTS) 6 | 7 | latency: latency.c ../../../include/ck_rwlock.h 8 | $(CC) $(CFLAGS) -o latency latency.c 9 | 10 | throughput: throughput.c ../../../include/ck_rwlock.h 11 | $(CC) $(CFLAGS) -o throughput throughput.c 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_pflock/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=validate 4 | 5 | all: $(OBJECTS) 6 | 7 | validate: validate.c ../../../include/ck_pflock.h 8 | $(CC) $(CFLAGS) -o validate validate.c 9 | 10 | check: all 11 | ./validate $(CORES) 1 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_pr/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean 2 | 3 | all: ck_pr_cas_64 ck_pr_fas_64 ck_pr_cas_64_2 ck_pr_add_64 ck_pr_faa_64 ck_pr_neg_64 fp 4 | 5 | fp: fp.c 6 | $(CC) $(CFLAGS) -o fp fp.c 7 | 8 | ck_pr_cas_64_2: ck_pr_cas_64_2.c 9 | $(CC) $(CFLAGS) -o ck_pr_cas_64_2 ck_pr_cas_64_2.c -lm 10 | 11 | ck_pr_cas_64: ck_pr_cas_64.c 12 | $(CC) $(CFLAGS) -o ck_pr_cas_64 ck_pr_cas_64.c -lm 13 | 14 | ck_pr_fas_64: ck_pr_fas_64.c 15 | $(CC) $(CFLAGS) -o ck_pr_fas_64 ck_pr_fas_64.c -lm 16 | 17 | ck_pr_add_64: ck_pr_add_64.c 18 | $(CC) $(CFLAGS) -o ck_pr_add_64 ck_pr_add_64.c -lm 19 | 20 | ck_pr_faa_64: ck_pr_faa_64.c 21 | $(CC) $(CFLAGS) -o ck_pr_faa_64 ck_pr_faa_64.c -lm 22 | 23 | ck_pr_neg_64: ck_pr_neg_64.c 24 | $(CC) $(CFLAGS) -o ck_pr_neg_64 ck_pr_neg_64.c -lm 25 | 26 | clean: 27 | rm -rf ck_pr_cas_64 ck_pr_fas_64 ck_pr_cas_64_2 ck_pr_add_64 \ 28 | ck_pr_faa_64 ck_pr_neg_64 *.dSYM *.exe 29 | 30 | include ../../../build/regressions.build 31 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 32 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_pr/benchmark/ck_pr_add_64.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef CK_F_PR_ADD_64 4 | #define ATOMIC ck_pr_add_64(object, 1) 5 | #define ATOMIC_STRING "ck_pr_add_64" 6 | #include "benchmark.h" 7 | #else 8 | #warning Did not find ADD_64 implementation. 9 | #include 10 | 11 | int 12 | main(void) 13 | { 14 | exit(EXIT_FAILURE); 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_pr/benchmark/ck_pr_cas_64.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef CK_F_PR_CAS_64 4 | #define ATOMIC ck_pr_cas_64(object, 1, 1) 5 | #define ATOMIC_STRING "ck_pr_cas_64" 6 | #include "benchmark.h" 7 | #else 8 | #warning Did not find CAS_64 implementation. 9 | #include 10 | 11 | int 12 | main(void) 13 | { 14 | exit(EXIT_FAILURE); 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_pr/benchmark/ck_pr_cas_64_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef CK_F_PR_CAS_64_2 4 | #define ATOMIC { uint64_t z[2] = {1, 2}; ck_pr_cas_64_2(object, z, z); } 5 | #define ATOMIC_STRING "ck_pr_cas_64_2" 6 | #include "benchmark.h" 7 | #else 8 | #include 9 | #include 10 | 11 | int 12 | main(void) 13 | { 14 | fprintf(stderr, "Unsupported.\n"); 15 | return 0; 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_pr/benchmark/ck_pr_faa_64.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef CK_F_PR_FAA_64 4 | #define ATOMIC ck_pr_faa_64(object, 1) 5 | #define ATOMIC_STRING "ck_pr_faa_64" 6 | #include "benchmark.h" 7 | #else 8 | #warning Did not find FAA_64 implementation. 9 | #include 10 | 11 | int 12 | main(void) 13 | { 14 | exit(EXIT_FAILURE); 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_pr/benchmark/ck_pr_fas_64.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef CK_F_PR_FAS_64 4 | #define ATOMIC ck_pr_fas_64(object, 1) 5 | #define ATOMIC_STRING "ck_pr_fas_64" 6 | #include "benchmark.h" 7 | #else 8 | #warning Did not find FAS_64 implementation. 9 | #include 10 | 11 | int 12 | main(void) 13 | { 14 | 15 | return 0; 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_pr/benchmark/ck_pr_neg_64.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef CK_F_PR_NEG_64 4 | #define ATOMIC ck_pr_neg_64(object) 5 | #define ATOMIC_STRING "ck_pr_neg_64" 6 | #include "benchmark.h" 7 | #else 8 | #warning Did not find NEG_64 implementation. 9 | #include 10 | 11 | int 12 | main(void) 13 | { 14 | exit(EXIT_FAILURE); 15 | } 16 | #endif 17 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_pr/benchmark/fp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "../../common.h" 6 | 7 | #ifndef IR 8 | #define IR 3000000 9 | #endif /* IR */ 10 | 11 | static int a CK_CC_CACHELINE; 12 | static int b CK_CC_CACHELINE; 13 | 14 | int 15 | main(void) 16 | { 17 | uint64_t s, e; 18 | unsigned int i; 19 | 20 | s = rdtsc(); 21 | for (i = 0; i < IR; i++) { 22 | ck_pr_load_int(&a); 23 | ck_pr_fence_strict_load(); 24 | ck_pr_load_int(&b); 25 | } 26 | e = rdtsc(); 27 | printf("[A] fence_load: %" PRIu64 "\n", (e - s) / IR); 28 | 29 | s = rdtsc(); 30 | for (i = 0; i < IR; i++) { 31 | if (ck_pr_load_int(&a) == 0) 32 | ck_pr_barrier(); 33 | ck_pr_fence_strict_lock(); 34 | ck_pr_load_int(&b); 35 | } 36 | e = rdtsc(); 37 | printf("[A] fence_lock: %" PRIu64 "\n", (e - s) / IR); 38 | 39 | s = rdtsc(); 40 | for (i = 0; i < IR; i++) { 41 | ck_pr_store_int(&a, 0); 42 | ck_pr_fence_strict_store(); 43 | ck_pr_store_int(&b, 0); 44 | } 45 | e = rdtsc(); 46 | printf("[B] fence_store: %" PRIu64 "\n", (e - s) / IR); 47 | 48 | s = rdtsc(); 49 | for (i = 0; i < IR; i++) { 50 | ck_pr_store_int(&a, 0); 51 | ck_pr_fence_strict_memory(); 52 | ck_pr_load_int(&b); 53 | } 54 | e = rdtsc(); 55 | printf("[C] fence_memory: %" PRIu64 "\n", (e - s) / IR); 56 | 57 | s = rdtsc(); 58 | for (i = 0; i < IR; i++) { 59 | ck_pr_store_int(&a, 0); 60 | ck_pr_faa_int(&a, 0); 61 | ck_pr_load_int(&b); 62 | } 63 | e = rdtsc(); 64 | printf("[C] atomic: %" PRIu64 "\n", (e - s) / IR); 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_queue/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | HEADER=../../../include/ck_queue.h 4 | OBJECTS=ck_list ck_slist ck_stailq 5 | 6 | all: $(OBJECTS) 7 | 8 | check: all 9 | ./ck_list $(CORES) 5 10 | ./ck_slist $(CORES) 5 11 | ./ck_stailq $(CORES) 1000000 12 | 13 | ck_list: $(HEADER) ck_list.c 14 | $(CC) $(CFLAGS) -o ck_list ck_list.c 15 | 16 | ck_slist: $(HEADER) ck_slist.c 17 | $(CC) $(CFLAGS) -o ck_slist ck_slist.c 18 | 19 | ck_stailq: $(HEADER) ck_stailq.c 20 | $(CC) $(CFLAGS) -o ck_stailq ck_stailq.c 21 | 22 | clean: 23 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 24 | 25 | include ../../../build/regressions.build 26 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 27 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rhs/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=serial parallel_bytestring 4 | 5 | all: $(OBJECTS) 6 | 7 | serial: serial.c ../../../include/ck_rhs.h ../../../src/ck_rhs.c 8 | $(CC) $(CFLAGS) -o serial serial.c ../../../src/ck_rhs.c 9 | 10 | parallel_bytestring: parallel_bytestring.c ../../../include/ck_rhs.h ../../../src/ck_rhs.c ../../../src/ck_epoch.c 11 | $(CC) $(PTHREAD_CFLAGS) $(CFLAGS) -o parallel_bytestring parallel_bytestring.c ../../../src/ck_rhs.c ../../../src/ck_epoch.c 12 | 13 | clean: 14 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=-D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rhs/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=serial 4 | 5 | all: $(OBJECTS) 6 | 7 | serial: serial.c ../../../include/ck_rhs.h ../../../src/ck_rhs.c 8 | $(CC) $(CFLAGS) -o serial serial.c ../../../src/ck_rhs.c 9 | 10 | check: all 11 | ./serial 12 | 13 | clean: 14 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=-D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_ring/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=latency 4 | 5 | all: $(OBJECTS) 6 | 7 | latency: latency.c ../../../include/ck_ring.h 8 | $(CC) $(CFLAGS) -o latency latency.c 9 | 10 | clean: 11 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 12 | 13 | include ../../../build/regressions.build 14 | CFLAGS+=-D_GNU_SOURCE 15 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_ring/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=ck_ring_spsc ck_ring_spmc ck_ring_spmc_template ck_ring_mpmc \ 4 | ck_ring_mpmc_template 5 | SIZE=16384 6 | 7 | all: $(OBJECTS) 8 | 9 | check: all 10 | ./ck_ring_spsc $(CORES) 1 $(SIZE) 11 | ./ck_ring_spmc $(CORES) 1 $(SIZE) 12 | ./ck_ring_spmc_template $(CORES) 1 $(SIZE) 13 | ./ck_ring_mpmc $(CORES) 1 $(SIZE) 14 | ./ck_ring_mpmc_template $(CORES) 1 $(SIZE) 15 | 16 | ck_ring_spsc: ck_ring_spsc.c ../../../include/ck_ring.h 17 | $(CC) $(CFLAGS) -o ck_ring_spsc ck_ring_spsc.c \ 18 | ../../../src/ck_barrier_centralized.c 19 | 20 | ck_ring_spmc: ck_ring_spmc.c ../../../include/ck_ring.h 21 | $(CC) $(CFLAGS) -o ck_ring_spmc ck_ring_spmc.c \ 22 | ../../../src/ck_barrier_centralized.c 23 | 24 | ck_ring_mpmc: ck_ring_mpmc.c ../../../include/ck_ring.h 25 | $(CC) $(CFLAGS) -o ck_ring_mpmc ck_ring_mpmc.c \ 26 | ../../../src/ck_barrier_centralized.c 27 | 28 | ck_ring_mpmc_template: ck_ring_mpmc_template.c ../../../include/ck_ring.h 29 | $(CC) $(CFLAGS) -o ck_ring_mpmc_template ck_ring_mpmc_template.c \ 30 | ../../../src/ck_barrier_centralized.c 31 | 32 | ck_ring_spmc_template: ck_ring_spmc_template.c ../../../include/ck_ring.h 33 | $(CC) $(CFLAGS) -o ck_ring_spmc_template ck_ring_spmc_template.c \ 34 | ../../../src/ck_barrier_centralized.c 35 | 36 | clean: 37 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 38 | 39 | include ../../../build/regressions.build 40 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 41 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwcohort/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=latency throughput 4 | OBJECTS=ck_neutral.THROUGHPUT ck_neutral.LATENCY \ 5 | ck_rp.THROUGHPUT ck_rp.LATENCY \ 6 | ck_wp.THROUGHPUT ck_wp.LATENCY 7 | 8 | all: $(OBJECTS) 9 | 10 | ck_neutral.THROUGHPUT: ck_neutral.c 11 | $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_neutral.THROUGHPUT ck_neutral.c 12 | 13 | ck_neutral.LATENCY: ck_neutral.c 14 | $(CC) -DLATENCY $(CFLAGS) -o ck_neutral.LATENCY ck_neutral.c 15 | 16 | ck_rp.THROUGHPUT: ck_rp.c 17 | $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_rp.THROUGHPUT ck_rp.c 18 | 19 | ck_rp.LATENCY: ck_rp.c 20 | $(CC) -DLATENCY $(CFLAGS) -o ck_rp.LATENCY ck_rp.c 21 | 22 | ck_wp.THROUGHPUT: ck_wp.c 23 | $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_wp.THROUGHPUT ck_wp.c 24 | 25 | ck_wp.LATENCY: ck_wp.c 26 | $(CC) -DLATENCY $(CFLAGS) -o ck_wp.LATENCY ck_wp.c 27 | 28 | clean: 29 | rm -rf *.dSYM *~ *.o $(OBJECTS) 30 | 31 | include ../../../build/regressions.build 32 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 33 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwcohort/benchmark/ck_neutral.c: -------------------------------------------------------------------------------- 1 | #include "../ck_neutral.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwcohort/benchmark/ck_rp.c: -------------------------------------------------------------------------------- 1 | #include "../ck_rp.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwcohort/benchmark/ck_wp.c: -------------------------------------------------------------------------------- 1 | #include "../ck_wp.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwcohort/ck_neutral.h: -------------------------------------------------------------------------------- 1 | #define LOCK_PROTOTYPE CK_RWCOHORT_NEUTRAL_PROTOTYPE 2 | #define LOCK_INSTANCE CK_RWCOHORT_NEUTRAL_INSTANCE 3 | #define LOCK_INITIALIZER CK_RWCOHORT_NEUTRAL_INITIALIZER 4 | #define LOCK_INIT(N, C, W) CK_RWCOHORT_NEUTRAL_INIT(N, C) 5 | #define READ_LOCK CK_RWCOHORT_NEUTRAL_READ_LOCK 6 | #define WRITE_LOCK CK_RWCOHORT_NEUTRAL_WRITE_LOCK 7 | #define READ_UNLOCK CK_RWCOHORT_NEUTRAL_READ_UNLOCK 8 | #define WRITE_UNLOCK CK_RWCOHORT_NEUTRAL_WRITE_UNLOCK 9 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwcohort/ck_rp.h: -------------------------------------------------------------------------------- 1 | #define LOCK_PROTOTYPE CK_RWCOHORT_RP_PROTOTYPE 2 | #define LOCK_INSTANCE CK_RWCOHORT_RP_INSTANCE 3 | #define LOCK_INITIALIZER CK_RWCOHORT_RP_INITIALIZER 4 | #define LOCK_INIT CK_RWCOHORT_RP_INIT 5 | #define READ_LOCK CK_RWCOHORT_RP_READ_LOCK 6 | #define READ_UNLOCK CK_RWCOHORT_RP_READ_UNLOCK 7 | #define WRITE_LOCK CK_RWCOHORT_RP_WRITE_LOCK 8 | #define WRITE_UNLOCK CK_RWCOHORT_RP_WRITE_UNLOCK 9 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwcohort/ck_wp.h: -------------------------------------------------------------------------------- 1 | #define LOCK_PROTOTYPE CK_RWCOHORT_WP_PROTOTYPE 2 | #define LOCK_INSTANCE CK_RWCOHORT_WP_INSTANCE 3 | #define LOCK_INITIALIZER CK_RWCOHORT_WP_INITIALIZER 4 | #define LOCK_INIT CK_RWCOHORT_WP_INIT 5 | #define READ_LOCK CK_RWCOHORT_WP_READ_LOCK 6 | #define WRITE_LOCK CK_RWCOHORT_WP_WRITE_LOCK 7 | #define READ_UNLOCK CK_RWCOHORT_WP_READ_UNLOCK 8 | #define WRITE_UNLOCK CK_RWCOHORT_WP_WRITE_UNLOCK 9 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwcohort/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=ck_neutral ck_rp ck_wp 4 | 5 | all: $(OBJECTS) 6 | 7 | ck_neutral: ck_neutral.c ../../../include/ck_rwcohort.h 8 | $(CC) $(CFLAGS) -o ck_neutral ck_neutral.c 9 | 10 | ck_rp: ck_rp.c ../../../include/ck_rwcohort.h 11 | $(CC) $(CFLAGS) -o ck_rp ck_rp.c 12 | 13 | ck_wp: ck_wp.c ../../../include/ck_rwcohort.h 14 | $(CC) $(CFLAGS) -o ck_wp ck_wp.c 15 | 16 | check: all 17 | ./ck_neutral `expr $(CORES) / 2` 2 1 18 | ./ck_rp `expr $(CORES) / 2` 2 1 19 | ./ck_wp `expr $(CORES) / 2` 2 1 20 | 21 | clean: 22 | rm -rf *.dSYM *~ *.o $(OBJECTS) 23 | 24 | include ../../../build/regressions.build 25 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 26 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwcohort/validate/ck_neutral.c: -------------------------------------------------------------------------------- 1 | #include "../ck_neutral.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwcohort/validate/ck_rp.c: -------------------------------------------------------------------------------- 1 | #include "../ck_rp.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwcohort/validate/ck_wp.c: -------------------------------------------------------------------------------- 1 | #include "../ck_wp.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwlock/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=latency throughput 4 | 5 | all: $(OBJECTS) 6 | 7 | latency: latency.c ../../../include/ck_rwlock.h ../../../include/ck_elide.h 8 | $(CC) $(CFLAGS) -o latency latency.c 9 | 10 | throughput: throughput.c ../../../include/ck_rwlock.h ../../../include/ck_elide.h 11 | $(CC) $(CFLAGS) -o throughput throughput.c 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_rwlock/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=validate 4 | 5 | all: $(OBJECTS) 6 | 7 | validate: validate.c ../../../include/ck_rwlock.h ../../../include/ck_elide.h 8 | $(CC) $(CFLAGS) -o validate validate.c 9 | 10 | check: all 11 | ./validate $(CORES) 1 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_sequence/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=ck_sequence 4 | 5 | all: $(OBJECTS) 6 | 7 | ck_sequence: ck_sequence.c ../../../include/ck_sequence.h 8 | $(CC) $(CFLAGS) -o ck_sequence ck_sequence.c 9 | 10 | check: all 11 | ./ck_sequence $(CORES) 1 12 | 13 | clean: 14 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=-D_GNU_SOURCE 18 | 19 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_sequence/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=ck_sequence 4 | 5 | all: $(OBJECTS) 6 | 7 | ck_sequence: ck_sequence.c ../../../include/ck_sequence.h 8 | $(CC) $(CFLAGS) -o ck_sequence ck_sequence.c 9 | 10 | check: all 11 | ./ck_sequence $(CORES) 1 12 | 13 | clean: 14 | rm -rf *~ *.o $(OBJECTS) *.dSYM *.exe 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/benchmark/ck_anderson.c: -------------------------------------------------------------------------------- 1 | #include "../ck_anderson.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/benchmark/ck_cas.c: -------------------------------------------------------------------------------- 1 | #include "../ck_cas.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/benchmark/ck_clh.c: -------------------------------------------------------------------------------- 1 | #include "../ck_clh.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/benchmark/ck_dec.c: -------------------------------------------------------------------------------- 1 | #include "../ck_dec.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/benchmark/ck_fas.c: -------------------------------------------------------------------------------- 1 | #include "../ck_fas.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/benchmark/ck_hclh.c: -------------------------------------------------------------------------------- 1 | #include "../ck_hclh.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/benchmark/ck_mcs.c: -------------------------------------------------------------------------------- 1 | #include "../ck_mcs.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/benchmark/ck_spinlock.c: -------------------------------------------------------------------------------- 1 | #include "../ck_spinlock.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/benchmark/ck_ticket.c: -------------------------------------------------------------------------------- 1 | #include "../ck_ticket.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/benchmark/ck_ticket_pb.c: -------------------------------------------------------------------------------- 1 | #include "../ck_ticket_pb.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/benchmark/linux_spinlock.c: -------------------------------------------------------------------------------- 1 | #include "../linux_spinlock.h" 2 | 3 | #ifdef THROUGHPUT 4 | #include "throughput.h" 5 | #elif defined(LATENCY) 6 | #include "latency.h" 7 | #endif 8 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/ck_anderson.h: -------------------------------------------------------------------------------- 1 | #define MAX(a,b) ((a) > (b) ? (a) : (b)) 2 | #define LOCK_NAME "ck_anderson" 3 | #define LOCK_DEFINE static ck_spinlock_anderson_t lock CK_CC_CACHELINE 4 | #define LOCK_STATE ck_spinlock_anderson_thread_t *nad = NULL 5 | #define LOCK ck_spinlock_anderson_lock(&lock, &nad) 6 | #define UNLOCK ck_spinlock_anderson_unlock(&lock, nad) 7 | #define LOCK_INIT ck_spinlock_anderson_init(&lock, malloc(MAX(64,sizeof(ck_spinlock_anderson_thread_t)) * nthr), nthr) 8 | #define LOCKED ck_spinlock_anderson_locked(&lock) 9 | 10 | #define NO_LOCAL 11 | 12 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/ck_cas.h: -------------------------------------------------------------------------------- 1 | #define LOCK_NAME "ck_cas" 2 | #define LOCK_DEFINE static ck_spinlock_cas_t CK_CC_CACHELINE lock = CK_SPINLOCK_CAS_INITIALIZER 3 | #define LOCK ck_spinlock_cas_lock_eb(&lock) 4 | #define UNLOCK ck_spinlock_cas_unlock(&lock) 5 | #define LOCKED ck_spinlock_cas_locked(&lock) 6 | 7 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/ck_clh.h: -------------------------------------------------------------------------------- 1 | #define MAX(a,b) ((a) > (b) ? (a) : (b)) 2 | #define LOCK_NAME "ck_clh" 3 | #define LOCK_DEFINE static ck_spinlock_clh_t CK_CC_CACHELINE *lock = NULL 4 | #define LOCK_STATE ck_spinlock_clh_t *na = malloc(MAX(sizeof(ck_spinlock_clh_t), 64)) 5 | #define LOCK ck_spinlock_clh_lock(&lock, na) 6 | #define UNLOCK ck_spinlock_clh_unlock(&na) 7 | #define LOCK_INIT ck_spinlock_clh_init(&lock, malloc(MAX(sizeof(ck_spinlock_clh_t), 64))) 8 | #define LOCKED ck_spinlock_clh_locked(&lock) 9 | 10 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/ck_dec.h: -------------------------------------------------------------------------------- 1 | #define LOCK_NAME "ck_dec" 2 | #define LOCK_DEFINE static ck_spinlock_dec_t CK_CC_CACHELINE lock = CK_SPINLOCK_DEC_INITIALIZER 3 | #define LOCK ck_spinlock_dec_lock_eb(&lock) 4 | #define UNLOCK ck_spinlock_dec_unlock(&lock) 5 | #define LOCKED ck_spinlock_dec_locked(&lock) 6 | 7 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/ck_fas.h: -------------------------------------------------------------------------------- 1 | #define LOCK_NAME "ck_fas" 2 | #define LOCK_DEFINE static ck_spinlock_fas_t CK_CC_CACHELINE lock = CK_SPINLOCK_FAS_INITIALIZER 3 | #define LOCK ck_spinlock_fas_lock_eb(&lock) 4 | #define UNLOCK ck_spinlock_fas_unlock(&lock) 5 | #define LOCKED ck_spinlock_fas_locked(&lock) 6 | 7 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/ck_hclh.h: -------------------------------------------------------------------------------- 1 | #define MAX(a,b) ((a) > (b) ? (a) : (b)) 2 | #define LOCK_NAME "ck_clh" 3 | #define LOCK_DEFINE static ck_spinlock_hclh_t CK_CC_CACHELINE *glob_lock; \ 4 | static ck_spinlock_hclh_t CK_CC_CACHELINE *local_lock[CORES / 2] 5 | #define LOCK_STATE ck_spinlock_hclh_t *na = malloc(MAX(sizeof(ck_spinlock_hclh_t), 64)) 6 | #define LOCK ck_spinlock_hclh_lock(&glob_lock, &local_lock[(core % CORES) / 2], na) 7 | #define UNLOCK ck_spinlock_hclh_unlock(&na) 8 | #define LOCK_INIT do { \ 9 | int _i; \ 10 | ck_spinlock_hclh_init(&glob_lock, malloc(MAX(sizeof(ck_spinlock_hclh_t), 64)), -1); \ 11 | for (_i = 0; _i < CORES / 2; _i++) { \ 12 | ck_spinlock_hclh_init(&local_lock[_i], malloc(MAX(sizeof(ck_spinlock_hclh_t), 64)), _i); } \ 13 | } while (0) 14 | 15 | #define LOCKED ck_spinlock_hclh_locked(&glob_lock) 16 | 17 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/ck_mcs.h: -------------------------------------------------------------------------------- 1 | #define LOCK_NAME "ck_mcs" 2 | #define LOCK_DEFINE static ck_spinlock_mcs_t CK_CC_CACHELINE lock = NULL 3 | #define LOCK_STATE ck_spinlock_mcs_context_t node CK_CC_CACHELINE; 4 | #define LOCK ck_spinlock_mcs_lock(&lock, &node) 5 | #define UNLOCK ck_spinlock_mcs_unlock(&lock, &node) 6 | #define LOCKED ck_spinlock_mcs_locked(&lock) 7 | 8 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/ck_spinlock.h: -------------------------------------------------------------------------------- 1 | #define LOCK_NAME "ck_spinlock" 2 | #define LOCK_DEFINE static ck_spinlock_t CK_CC_CACHELINE lock = CK_SPINLOCK_INITIALIZER 3 | #define LOCK ck_spinlock_lock_eb(&lock) 4 | #define UNLOCK ck_spinlock_unlock(&lock) 5 | #define LOCKED ck_spinlock_locked(&lock) 6 | 7 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/ck_ticket.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define LOCK_NAME "ck_ticket" 4 | #define LOCK_DEFINE static ck_spinlock_ticket_t CK_CC_CACHELINE lock = CK_SPINLOCK_TICKET_INITIALIZER 5 | #define LOCK ck_spinlock_ticket_lock(&lock) 6 | #define UNLOCK ck_spinlock_ticket_unlock(&lock) 7 | #ifdef CK_F_SPINLOCK_TICKET_TRYLOCK 8 | #define TRYLOCK ck_spinlock_ticket_trylock(&lock) 9 | #endif 10 | #define LOCKED ck_spinlock_ticket_locked(&lock) 11 | 12 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/ck_ticket_pb.h: -------------------------------------------------------------------------------- 1 | #define LOCK_NAME "ck_ticket_pb" 2 | #define LOCK_DEFINE static ck_spinlock_ticket_t CK_CC_CACHELINE lock = CK_SPINLOCK_TICKET_INITIALIZER 3 | #define LOCK ck_spinlock_ticket_lock_pb(&lock, 0) 4 | #define UNLOCK ck_spinlock_ticket_unlock(&lock) 5 | #define LOCKED ck_spinlock_ticket_locked(&lock) 6 | 7 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/linux_spinlock.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | CK_CC_INLINE static void 4 | spin_lock(volatile unsigned int *lock) 5 | { 6 | #ifdef __x86_64__ 7 | __asm__ __volatile__( 8 | "\n1:\t" 9 | "lock ; decl %0\n\t" 10 | "jns 2f\n" 11 | "3:\n" 12 | "rep;nop\n\t" 13 | "cmpl $0,%0\n\t" 14 | "jle 3b\n\t" 15 | "jmp 1b\n" 16 | "2:\t" : "=m" (*lock) : : "memory"); 17 | #else 18 | *lock = 1; 19 | #endif 20 | 21 | return; 22 | } 23 | 24 | CK_CC_INLINE static void 25 | spin_unlock(volatile unsigned int *lock) 26 | { 27 | #ifdef __x86_64__ 28 | __asm__ __volatile__("movl $1,%0" :"=m" (*lock) :: "memory"); 29 | #else 30 | *lock = 0; 31 | return; 32 | #endif 33 | } 34 | 35 | #define LOCK_NAME "linux_spinlock" 36 | #define LOCK_DEFINE volatile unsigned int lock = 1 37 | #define LOCK spin_lock(&lock) 38 | #define UNLOCK spin_unlock(&lock) 39 | 40 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean 2 | 3 | all: ck_ticket ck_mcs ck_dec ck_cas ck_fas ck_clh linux_spinlock \ 4 | ck_ticket_pb ck_anderson ck_spinlock ck_hclh 5 | 6 | check: all 7 | ./ck_ticket $(CORES) 1 8 | ./ck_mcs $(CORES) 1 9 | ./ck_dec $(CORES) 1 10 | ./ck_cas $(CORES) 1 11 | ./ck_fas $(CORES) 1 12 | ./ck_clh $(CORES) 1 13 | ./ck_hclh $(CORES) 1 14 | ./linux_spinlock $(CORES) 1 15 | ./ck_ticket_pb $(CORES) 1 16 | ./ck_anderson $(CORES) 1 17 | ./ck_spinlock $(CORES) 1 18 | 19 | linux_spinlock: linux_spinlock.c 20 | $(CC) $(CFLAGS) -o linux_spinlock linux_spinlock.c 21 | 22 | ck_spinlock: ck_spinlock.c 23 | $(CC) $(CFLAGS) -o ck_spinlock ck_spinlock.c 24 | 25 | ck_ticket_pb: ck_ticket_pb.c 26 | $(CC) $(CFLAGS) -o ck_ticket_pb ck_ticket_pb.c 27 | 28 | ck_clh: ck_clh.c 29 | $(CC) $(CFLAGS) -o ck_clh ck_clh.c 30 | 31 | ck_hclh: ck_hclh.c 32 | $(CC) $(CFLAGS) -o ck_hclh ck_hclh.c 33 | 34 | ck_anderson: ck_anderson.c 35 | $(CC) $(CFLAGS) -o ck_anderson ck_anderson.c 36 | 37 | ck_fas: ck_fas.c 38 | $(CC) $(CFLAGS) -o ck_fas ck_fas.c 39 | 40 | ck_ticket: ck_ticket.c 41 | $(CC) $(CFLAGS) -o ck_ticket ck_ticket.c 42 | 43 | ck_cas: ck_cas.c 44 | $(CC) $(CFLAGS) -o ck_cas ck_cas.c 45 | 46 | ck_mcs: ck_mcs.c 47 | $(CC) $(CFLAGS) -o ck_mcs ck_mcs.c 48 | 49 | ck_dec: ck_dec.c 50 | $(CC) $(CFLAGS) -o ck_dec ck_dec.c 51 | 52 | clean: 53 | rm -rf ck_ticket ck_mcs ck_dec ck_cas ck_fas ck_clh linux_spinlock ck_ticket_pb \ 54 | ck_anderson ck_spinlock ck_hclh *.dSYM *.exe 55 | 56 | include ../../../build/regressions.build 57 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE -lm 58 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/validate/ck_anderson.c: -------------------------------------------------------------------------------- 1 | #include "../ck_anderson.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/validate/ck_cas.c: -------------------------------------------------------------------------------- 1 | #include "../ck_cas.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/validate/ck_clh.c: -------------------------------------------------------------------------------- 1 | #include "../ck_clh.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/validate/ck_dec.c: -------------------------------------------------------------------------------- 1 | #include "../ck_dec.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/validate/ck_fas.c: -------------------------------------------------------------------------------- 1 | #include "../ck_fas.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/validate/ck_hclh.c: -------------------------------------------------------------------------------- 1 | #include "../ck_hclh.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/validate/ck_mcs.c: -------------------------------------------------------------------------------- 1 | #include "../ck_mcs.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/validate/ck_spinlock.c: -------------------------------------------------------------------------------- 1 | #include "../ck_spinlock.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/validate/ck_ticket.c: -------------------------------------------------------------------------------- 1 | #include "../ck_ticket.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/validate/ck_ticket_pb.c: -------------------------------------------------------------------------------- 1 | #include "../ck_ticket_pb.h" 2 | #include "validate.h" 3 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_spinlock/validate/linux_spinlock.c: -------------------------------------------------------------------------------- 1 | #ifdef __x86_64__ 2 | #include "../linux_spinlock.h" 3 | #include "validate.h" 4 | #else 5 | #include 6 | 7 | int 8 | main(void) 9 | { 10 | 11 | fprintf(stderr, "Unsupported.\n"); 12 | return 0; 13 | } 14 | #endif 15 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_stack/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=latency 4 | 5 | all: $(OBJECTS) 6 | 7 | latency: latency.c 8 | $(CC) $(CFLAGS) -o latency latency.c 9 | 10 | clean: 11 | rm -rf *~ *.o *.dSYM *.exe $(OBJECTS) 12 | 13 | include ../../../build/regressions.build 14 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 15 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_swlock/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=latency throughput 4 | 5 | all: $(OBJECTS) 6 | 7 | latency: latency.c ../../../include/ck_swlock.h 8 | $(CC) $(CFLAGS) -o latency latency.c 9 | 10 | throughput: throughput.c ../../../include/ck_swlock.h 11 | $(CC) $(CFLAGS) -o throughput throughput.c 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_swlock/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=validate 4 | 5 | all: $(OBJECTS) 6 | 7 | validate: validate.c ../../../include/ck_swlock.h 8 | $(CC) $(CFLAGS) -o validate validate.c 9 | 10 | check: all 11 | ./validate $(CORES) 1 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_tflock/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean distribution 2 | 3 | OBJECTS=latency throughput 4 | 5 | all: $(OBJECTS) 6 | 7 | latency: latency.c ../../../include/ck_rwlock.h ../../../include/ck_elide.h 8 | $(CC) $(CFLAGS) -o latency latency.c 9 | 10 | throughput: throughput.c ../../../include/ck_rwlock.h ../../../include/ck_elide.h 11 | $(CC) $(CFLAGS) -o throughput throughput.c 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/regressions/ck_tflock/validate/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: check clean distribution 2 | 3 | OBJECTS=validate 4 | 5 | all: $(OBJECTS) 6 | 7 | validate: validate.c ../../../include/ck_tflock.h ../../../include/ck_elide.h 8 | $(CC) $(CFLAGS) -o validate validate.c 9 | 10 | check: all 11 | ./validate $(CORES) 1 12 | 13 | clean: 14 | rm -rf *.dSYM *.exe *~ *.o $(OBJECTS) 15 | 16 | include ../../../build/regressions.build 17 | CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE 18 | -------------------------------------------------------------------------------- /third_party/concurrency_kit/ck/tools/feature.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This will generate the list of feature flags for implemented symbols. 3 | 4 | echo '/* DO NOT EDIT. This is auto-generated from feature.sh */' 5 | nm ../regressions/ck_pr/validate/ck_pr_cas|cut -d ' ' -f 3|sed s/ck_pr/ck_f_pr/|awk '/^ck_f_pr/ {print "#define " toupper($1);}'|sort 6 | -------------------------------------------------------------------------------- /third_party/cram/.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | omit = 3 | cram/__main__.py 4 | cram/_encoding.py 5 | scripts/cram 6 | source = cram 7 | -------------------------------------------------------------------------------- /third_party/cram/.gitignore: -------------------------------------------------------------------------------- 1 | *.orig 2 | *.rej 3 | *~ 4 | *.mergebackup 5 | *.o 6 | *.so 7 | *.dll 8 | *.py[cdo] 9 | *$py.class 10 | __pycache__ 11 | *.swp 12 | *.prof 13 | \#*\# 14 | .\#* 15 | .coverage 16 | *,cover 17 | htmlcov 18 | tests/*.err 19 | examples/*.err 20 | build 21 | dist 22 | MANIFEST 23 | cram.egg-info 24 | .DS_Store 25 | tags 26 | cscope.* 27 | .idea 28 | -------------------------------------------------------------------------------- /third_party/cram/.hgignore: -------------------------------------------------------------------------------- 1 | syntax: glob 2 | 3 | *.orig 4 | *.rej 5 | *~ 6 | *.mergebackup 7 | *.o 8 | *.so 9 | *.dll 10 | *.py[cdo] 11 | *$py.class 12 | __pycache__ 13 | *.swp 14 | *.prof 15 | \#*\# 16 | .\#* 17 | .coverage 18 | *,cover 19 | htmlcov 20 | tests/*.err 21 | examples/*.err 22 | build 23 | dist 24 | MANIFEST 25 | cram.egg-info 26 | .DS_Store 27 | tags 28 | cscope.* 29 | .idea 30 | 31 | syntax: regexp 32 | ^\.pc/ 33 | ^\.(pydev)?project 34 | -------------------------------------------------------------------------------- /third_party/cram/.hgtags: -------------------------------------------------------------------------------- 1 | 931859fdd3e0d5af442a3e9b5fe6ac0dbfed2309 0.1 2 | 3c471f7a16b435095b98525e7b851b17e871a2ce 0.2 3 | 3c471f7a16b435095b98525e7b851b17e871a2ce 0.2 4 | 995a287114b0a2a0bcd79b9c5ce8ff98765e7c8a 0.2 5 | 924d14e0636a7ff5815c2412409115a69dfc63f0 0.3 6 | 3ba61fadf306c63ec4bc3254522f286a27ac974a 0.4 7 | 112e96e43892344954a98b0f05a32819f2b6c20d 0.5 8 | 05669fd0420dc0cd52f48bc2f2379a61732d14e0 0.6 9 | e230eb00d4668508766fc32da154ba46c358ff5f 0.7 10 | -------------------------------------------------------------------------------- /third_party/cram/.pylintrc: -------------------------------------------------------------------------------- 1 | [MESSAGES CONTROL] 2 | # C0330: bad continuation 3 | # The design check gives mostly useless advice. 4 | # R0201: method could be a function 5 | # W0123: eval used 6 | # W0141: used range 7 | # W0142: * or ** arguments 8 | # W0201: attribute defined outside of __init__ 9 | # W0640: unreliable closure/loop variable checking 10 | disable=C0330,design,R0201,W0123,W0141,W0142,W0201,W0640 11 | 12 | [REPORTS] 13 | reports=no 14 | 15 | [TYPECHECK] 16 | ignored-classes= 17 | generated-members= 18 | 19 | [BASIC] 20 | const-rgx=(([a-zA-Z_][a-zA-Z0-9_]{2,30})|(__[a-z0-9_]{2,30}__))$ 21 | class-rgx=[a-zA-Z_][a-zA-Z0-9]{2,30}$ 22 | function-rgx=[a-z_][a-z0-9_]{2,30}$ 23 | method-rgx=[a-z_][a-z0-9_]{2,30}$ 24 | attr-rgx=[a-z_][a-z0-9_]{0,30}$ 25 | argument-rgx=[a-z_][a-z0-9_]{0,30}$ 26 | variable-rgx=[a-z_][a-z0-9_]{0,30}$ 27 | inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ 28 | 29 | [CLASSES] 30 | ignore-iface-methods= 31 | defining-attr-methods=__init__,__new__ 32 | 33 | [IMPORTS] 34 | deprecated-modules=regsub,TERMIOS,Bastion,rexec 35 | 36 | [FORMAT] 37 | max-line-length=79 38 | max-module-lines=5000 39 | 40 | [MISCELLANEOUS] 41 | notes=FIXME,XXX,TODO 42 | -------------------------------------------------------------------------------- /third_party/cram/.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | 3 | matrix: 4 | allow_failures: 5 | - python: nightly 6 | env: TESTOPTS=--shell=dash 7 | - python: pypy 8 | env: TESTOPTS=--shell=dash 9 | - python: pypy3 10 | env: TESTOPTS=--shell=dash 11 | include: 12 | - python: "3.5" 13 | env: TESTOPTS=--shell=dash 14 | - python: "3.5" 15 | env: TESTOPTS=--shell=bash 16 | - python: "3.5" 17 | env: TESTOPTS=--shell=zsh 18 | addons: 19 | apt: 20 | packages: 21 | - zsh 22 | - python: "3.4" 23 | env: TESTOPTS=--shell=dash 24 | - python: "3.3" 25 | env: TESTOPTS=--shell=dash 26 | - python: "3.2" 27 | env: TESTOPTS=--shell=dash 28 | - python: "2.7" 29 | env: TESTOPTS=--shell=dash 30 | - python: "2.6" 31 | env: TESTOPTS=--shell=dash 32 | - env: PYTHON=2.5 TESTOPTS=--shell=dash 33 | addons: 34 | apt: 35 | sources: 36 | - deadsnakes 37 | packages: 38 | - python2.5 39 | - env: PYTHON=2.4 TESTOPTS=--shell=dash 40 | addons: 41 | apt: 42 | sources: 43 | - deadsnakes 44 | packages: 45 | - python2.4 46 | - python: nightly 47 | env: TESTOPTS=--shell=dash 48 | - python: pypy 49 | env: TESTOPTS=--shell=dash 50 | - python: pypy3 51 | env: TESTOPTS=--shell=dash 52 | fast_finish: true 53 | 54 | install: | 55 | if [ -z "$PYTHON" ] 56 | then 57 | [ "$TRAVIS_PYTHON_VERSION" = "3.2" ] && pip install coverage==3.7.1 58 | pip install -r requirements.txt 59 | fi 60 | 61 | script: | 62 | if [ -z "$PYTHON" ] 63 | then 64 | make test TESTOPTS="$TESTOPTS" 65 | else 66 | make quicktest PYTHON="python$PYTHON" 67 | fi 68 | -------------------------------------------------------------------------------- /third_party/cram/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include .coveragerc .pylintrc .travis.yml Makefile MANIFEST.in 2 | include *.md *.rst *.txt contrib/* scripts/* 3 | exclude contrib/PKGBUILD 4 | recursive-include examples *.t 5 | recursive-include tests *.py *.sh *.t 6 | -------------------------------------------------------------------------------- /third_party/cram/Makefile: -------------------------------------------------------------------------------- 1 | COVERAGE=coverage 2 | PREFIX=/usr/local 3 | export PREFIX 4 | PYTHON=python 5 | 6 | all: build 7 | 8 | build: 9 | $(PYTHON) setup.py build 10 | 11 | check: test 12 | 13 | clean: 14 | -$(PYTHON) setup.py clean --all 15 | find . -not \( -path '*/.hg/*' -o -path '*/.git/*' \) \ 16 | \( -name '*.py[cdo]' -o -name '*.err' -o \ 17 | -name '*,cover' -o -name __pycache__ \) -prune \ 18 | -exec rm -rf '{}' ';' 19 | rm -rf dist build htmlcov 20 | rm -f MANIFEST .coverage cram.xml 21 | 22 | dist: 23 | TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" \ 24 | $(PYTHON) setup.py -q sdist 25 | 26 | install: build 27 | $(PYTHON) setup.py install --prefix="$(PREFIX)" --force 28 | 29 | quicktest: 30 | PYTHON=$(PYTHON) PYTHONPATH=`pwd` scripts/cram $(TESTOPTS) tests 31 | 32 | test: 33 | $(COVERAGE) erase 34 | COVERAGE=$(COVERAGE) PYTHON=$(PYTHON) PYTHONPATH=`pwd` scripts/cram \ 35 | $(TESTOPTS) tests 36 | $(COVERAGE) report --fail-under=100 37 | 38 | .PHONY: all build check clean install dist quicktest test 39 | -------------------------------------------------------------------------------- /third_party/cram/contrib/PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: Andrey Vlasovskikh 2 | 3 | pkgname=cram 4 | pkgver=0.7 5 | pkgrel=1 6 | pkgdesc="Functional tests for command line applications" 7 | arch=(any) 8 | url="https://bitheap.org/cram/" 9 | license=('GPL') 10 | depends=('python') 11 | source=("https://pypi.python.org/packages/source/c/cram/cram-$pkgver.tar.gz") 12 | md5sums=('2ea37ada5190526b9bcaac5e4099221c') 13 | 14 | build() { 15 | cd "$srcdir/$pkgname-$pkgver" 16 | python setup.py install --root="$pkgdir/" --optimize=1 17 | } 18 | -------------------------------------------------------------------------------- /third_party/cram/contrib/cram.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: Cram Tests 3 | " Author: Steve Losh (steve@stevelosh.com) 4 | " 5 | " Add the following line to your ~/.vimrc to enable: 6 | " au BufNewFile,BufRead *.t set filetype=cram 7 | " 8 | " If you want folding you'll need the following line as well: 9 | " let cram_fold=1 10 | " 11 | " You might also want to set the starting foldlevel for Cram files: 12 | " autocmd Syntax cram setlocal foldlevel=1 13 | 14 | if exists("b:current_syntax") 15 | finish 16 | endif 17 | 18 | syn include @Shell syntax/sh.vim 19 | 20 | syn match cramComment /^[^ ].*$/ contains=@Spell 21 | syn region cramOutput start=/^ [^$>]/ start=/^ $/ end=/\v.(\n\n*[^ ])\@=/me=s end=/^ [$>]/me=e-3 end=/^$/ fold containedin=cramBlock 22 | syn match cramCommandStart /^ \$ / containedin=cramCommand 23 | syn region cramCommand start=/^ \$ /hs=s+4,rs=s+4 end=/^ [^>]/me=e-3 end=/^ $/me=e-2 containedin=cramBlock contains=@Shell keepend 24 | syn region cramBlock start=/^ /ms=e-2 end=/\v.(\n\n*[^ ])\@=/me=s end=/^$/me=e-1 fold keepend 25 | 26 | hi link cramCommandStart Keyword 27 | hi link cramComment Normal 28 | hi link cramOutput Comment 29 | 30 | if exists("cram_fold") 31 | setlocal foldmethod=syntax 32 | endif 33 | 34 | syn sync match cramSync grouphere NONE "^$" 35 | syn sync maxlines=200 36 | 37 | " It's okay to set tab settings here, because an indent of two spaces is specified 38 | " by the file format. 39 | setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab 40 | 41 | let b:current_syntax = "cram" 42 | -------------------------------------------------------------------------------- /third_party/cram/cram/__init__.py: -------------------------------------------------------------------------------- 1 | """Functional testing framework for command line applications""" 2 | 3 | from cram._main import main 4 | from cram._test import test, testfile 5 | 6 | __all__ = ['main', 'test', 'testfile'] 7 | -------------------------------------------------------------------------------- /third_party/cram/cram/__main__.py: -------------------------------------------------------------------------------- 1 | """Main module (invoked by "python -m cram")""" 2 | 3 | import sys 4 | 5 | import cram 6 | 7 | try: 8 | sys.exit(cram.main(sys.argv[1:])) 9 | except KeyboardInterrupt: 10 | pass 11 | -------------------------------------------------------------------------------- /third_party/cram/examples/.hidden.t: -------------------------------------------------------------------------------- 1 | This test is ignored because it's hidden. 2 | -------------------------------------------------------------------------------- /third_party/cram/examples/.hidden/hidden.t: -------------------------------------------------------------------------------- 1 | This test is ignored because it's hidden. 2 | -------------------------------------------------------------------------------- /third_party/cram/examples/bare.t: -------------------------------------------------------------------------------- 1 | $ true 2 | -------------------------------------------------------------------------------- /third_party/cram/examples/empty.t: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akopytov/sysbench/3ceba0b1e115f8c50d1d045a4574d8ed643bd497/third_party/cram/examples/empty.t -------------------------------------------------------------------------------- /third_party/cram/examples/env.t: -------------------------------------------------------------------------------- 1 | Check environment variables: 2 | 3 | $ echo "$LANG" 4 | C 5 | $ echo "$LC_ALL" 6 | C 7 | $ echo "$LANGUAGE" 8 | C 9 | $ echo "$TZ" 10 | GMT 11 | $ echo "$CDPATH" 12 | 13 | $ echo "$GREP_OPTIONS" 14 | 15 | $ echo "$CRAMTMP" 16 | .+ (re) 17 | $ echo "$TESTDIR" 18 | */examples (glob) 19 | $ ls "$TESTDIR" 20 | bare.t 21 | empty.t 22 | env.t 23 | fail.t 24 | missingeol.t 25 | skip.t 26 | test.t 27 | $ echo "$TESTFILE" 28 | env.t 29 | $ pwd 30 | */cramtests*/env.t (glob) 31 | -------------------------------------------------------------------------------- /third_party/cram/examples/fail.t: -------------------------------------------------------------------------------- 1 | Output needing escaping: 2 | 3 | $ printf '\00\01\02\03\04\05\06\07\010\011\013\014\016\017\020\021\022\n' 4 | foo 5 | $ printf '\023\024\025\026\027\030\031\032\033\034\035\036\037\040\047\n' 6 | bar 7 | 8 | Wrong output and bad regexes: 9 | 10 | $ echo 1 11 | 2 12 | $ printf '1\nfoo\n1\n' 13 | +++ (re) 14 | foo\ (re) 15 | (re) 16 | 17 | Filler to force a second diff hunk: 18 | 19 | 20 | Offset regular expression: 21 | 22 | $ printf 'foo\n\n1\n' 23 | 24 | \d (re) 25 | -------------------------------------------------------------------------------- /third_party/cram/examples/missingeol.t: -------------------------------------------------------------------------------- 1 | $ printf foo 2 | foo (no-eol) -------------------------------------------------------------------------------- /third_party/cram/examples/skip.t: -------------------------------------------------------------------------------- 1 | This test is considered "skipped" because it exits with return code 2 | 80. This is useful for skipping tests that only work on certain 3 | platforms or in certain settings. 4 | 5 | $ exit 80 6 | -------------------------------------------------------------------------------- /third_party/cram/examples/test.t: -------------------------------------------------------------------------------- 1 | Simple commands: 2 | 3 | $ echo foo 4 | foo 5 | $ printf 'bar\nbaz\n' | cat 6 | bar 7 | baz 8 | 9 | Multi-line command: 10 | 11 | $ foo() { 12 | > echo bar 13 | > } 14 | $ foo 15 | bar 16 | 17 | Regular expression: 18 | 19 | $ echo foobarbaz 20 | foobar.* (re) 21 | 22 | Glob: 23 | 24 | $ printf '* \\foobarbaz {10}\n' 25 | \* \\fo?bar* {10} (glob) 26 | 27 | Literal match ending in (re) and (glob): 28 | 29 | $ echo 'foo\Z\Z\Z bar (re)' 30 | foo\Z\Z\Z bar (re) 31 | $ echo 'baz??? quux (glob)' 32 | baz??? quux (glob) 33 | 34 | Exit code: 35 | 36 | $ (exit 1) 37 | [1] 38 | 39 | Write to stderr: 40 | 41 | $ echo foo >&2 42 | foo 43 | 44 | No newline: 45 | 46 | $ printf foo 47 | foo (no-eol) 48 | $ printf 'foo\nbar' 49 | foo 50 | bar (no-eol) 51 | $ printf ' ' 52 | (no-eol) 53 | $ printf ' \n ' 54 | 55 | (no-eol) 56 | $ echo foo 57 | foo 58 | $ printf foo 59 | foo (no-eol) 60 | 61 | Escaped output: 62 | 63 | $ printf '\00\01\02\03\04\05\06\07\010\011\013\014\016\017\020\021\022\n' 64 | \x00\x01\x02\x03\x04\x05\x06\x07\x08\t\x0b\x0c\x0e\x0f\x10\x11\x12 (esc) 65 | $ printf '\023\024\025\026\027\030\031\032\033\034\035\036\037\040\047\n' 66 | \x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f ' (esc) 67 | $ echo hi 68 | \x68\x69 (esc) 69 | $ echo '(esc) in output (esc)' 70 | (esc) in output (esc) 71 | $ echo '(esc) in output (esc)' 72 | (esc) in output \x28esc\x29 (esc) 73 | 74 | Command that closes a pipe: 75 | 76 | $ cat /dev/urandom | head -1 > /dev/null 77 | 78 | If Cram let Python's SIGPIPE handler get inherited by this script, we 79 | might see broken pipe messages. 80 | -------------------------------------------------------------------------------- /third_party/cram/requirements.txt: -------------------------------------------------------------------------------- 1 | check-manifest 2 | coverage 3 | pep8 4 | pyflakes 5 | -------------------------------------------------------------------------------- /third_party/cram/scripts/cram: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | 4 | import cram 5 | 6 | try: 7 | sys.exit(cram.main(sys.argv[1:])) 8 | except KeyboardInterrupt: 9 | pass 10 | -------------------------------------------------------------------------------- /third_party/cram/setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal = true 3 | 4 | [pep8] 5 | # E129: indentation between lines in conditions 6 | # E261: two spaces before inline comment 7 | # E301: expected blank line 8 | # E302: two new lines between functions/etc. 9 | ignore = E129,E261,E301,E302 10 | -------------------------------------------------------------------------------- /third_party/cram/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Installs cram""" 3 | 4 | import os 5 | import sys 6 | from distutils.core import setup 7 | 8 | COMMANDS = {} 9 | CRAM_DIR = os.path.abspath(os.path.dirname(__file__)) 10 | 11 | try: 12 | from wheel.bdist_wheel import bdist_wheel 13 | except ImportError: 14 | pass 15 | else: 16 | COMMANDS['bdist_wheel'] = bdist_wheel 17 | 18 | def long_description(): 19 | """Get the long description from the README""" 20 | return open(os.path.join(sys.path[0], 'README.rst')).read() 21 | 22 | setup( 23 | author='Brodie Rao', 24 | author_email='brodie@bitheap.org', 25 | classifiers=[ 26 | 'Development Status :: 5 - Production/Stable', 27 | 'Environment :: Console', 28 | 'Intended Audience :: Developers', 29 | 'License :: OSI Approved :: GNU General Public License (GPL)', 30 | ('License :: OSI Approved :: GNU General Public License v2 ' 31 | 'or later (GPLv2+)'), 32 | 'Natural Language :: English', 33 | 'Operating System :: OS Independent', 34 | 'Programming Language :: Python :: 2', 35 | 'Programming Language :: Python :: 3', 36 | 'Programming Language :: Unix Shell', 37 | 'Topic :: Software Development :: Testing', 38 | ], 39 | cmdclass=COMMANDS, 40 | description='Functional tests for command line applications', 41 | download_url='https://bitheap.org/cram/cram-0.7.tar.gz', 42 | keywords='automatic functional test framework', 43 | license='GNU GPLv2 or any later version', 44 | long_description=long_description(), 45 | name='cram', 46 | packages=['cram'], 47 | scripts=['scripts/cram'], 48 | url='https://bitheap.org/cram/', 49 | version='0.7', 50 | ) 51 | -------------------------------------------------------------------------------- /third_party/cram/tests/config.t: -------------------------------------------------------------------------------- 1 | Set up cram alias and example tests: 2 | 3 | $ . "$TESTDIR"/setup.sh 4 | 5 | Options in .cramrc: 6 | 7 | $ cat > .cramrc < [cram] 9 | > yes = True 10 | > no = 1 11 | > indent = 4 12 | > EOF 13 | $ cram 14 | options --yes and --no are mutually exclusive 15 | [2] 16 | $ mv .cramrc config 17 | $ CRAMRC=config cram 18 | options --yes and --no are mutually exclusive 19 | [2] 20 | $ rm config 21 | 22 | Invalid option in .cramrc: 23 | 24 | $ cat > .cramrc < [cram] 26 | > indent = hmm 27 | > EOF 28 | $ cram 29 | [Uu]sage: cram \[OPTIONS\] TESTS\.\.\. (re) 30 | 31 | cram: error: option --indent: invalid integer value: 'hmm' 32 | [2] 33 | $ rm .cramrc 34 | $ cat > .cramrc < [cram] 36 | > verbose = hmm 37 | > EOF 38 | $ cram 39 | [Uu]sage: cram \[OPTIONS\] TESTS\.\.\. (re) 40 | 41 | cram: error: --verbose: invalid boolean value: 'hmm' 42 | [2] 43 | $ rm .cramrc 44 | 45 | Options in an environment variable: 46 | 47 | $ CRAM='-y -n' cram 48 | options --yes and --no are mutually exclusive 49 | [2] 50 | -------------------------------------------------------------------------------- /third_party/cram/tests/debug.t: -------------------------------------------------------------------------------- 1 | Set up cram alias and example tests: 2 | 3 | $ . "$TESTDIR"/setup.sh 4 | 5 | Debug mode: 6 | 7 | $ printf ' $ echo hi\n > echo bye' > debug.t 8 | $ cram -d -v debug.t 9 | options --debug and --verbose are mutually exclusive 10 | [2] 11 | $ cram -d -q debug.t 12 | options --debug and --quiet are mutually exclusive 13 | [2] 14 | $ cram -d -i debug.t 15 | options --debug and --interactive are mutually exclusive 16 | [2] 17 | $ cram -d --xunit-file==cram.xml debug.t 18 | options --debug and --xunit-file are mutually exclusive 19 | [2] 20 | $ cram -d debug.t 21 | hi 22 | bye 23 | $ cram -d examples/empty.t 24 | 25 | Debug mode with extra shell arguments: 26 | 27 | $ cram --shell-opts='-s' -d debug.t 28 | hi 29 | bye 30 | 31 | Test debug mode with set -x: 32 | 33 | $ cat > set-x.t < $ echo 1 35 | > 1 36 | > $ set -x 37 | > $ echo 2 38 | > EOF 39 | $ cram -d set-x.t 40 | 1 41 | \+.*echo 2 (re) 42 | 2 43 | 44 | Test set -x without debug mode: 45 | 46 | $ cram set-x.t 47 | ! 48 | --- set-x.t 49 | +++ set-x.t.err 50 | @@ -1,4 +1,8 @@ 51 | $ echo 1 52 | 1 53 | $ set -x 54 | \+ \+.*echo \(no-eol\) (re) 55 | $ echo 2 56 | \+ \+.*echo 2 (re) 57 | + 2 58 | \+ \+.*echo \(no-eol\) (re) 59 | 60 | # Ran 1 tests, 0 skipped, 1 failed. 61 | [1] 62 | 63 | Note that the "+ echo (no-eol)" lines are artifacts of the echo commands 64 | that Cram inserts into the test in order to track output. It'd be nice if 65 | Cram could avoid removing salt/line number/return code information from those 66 | lines, but it isn't possible to distinguish between set -x output and normal 67 | output. 68 | -------------------------------------------------------------------------------- /third_party/cram/tests/dist.t: -------------------------------------------------------------------------------- 1 | Skip this test if check-manifest isn't available: 2 | 3 | $ command -v check-manifest > /dev/null || exit 80 4 | 5 | Confirm that "make dist" isn't going to miss any files: 6 | 7 | $ check-manifest "$TESTDIR/.." 8 | lists of files in version control and sdist match 9 | -------------------------------------------------------------------------------- /third_party/cram/tests/doctest.t: -------------------------------------------------------------------------------- 1 | Set up cram alias and example tests: 2 | 3 | $ . "$TESTDIR"/setup.sh 4 | 5 | Run doctests: 6 | 7 | $ doctest "$TESTDIR"/../cram 8 | -------------------------------------------------------------------------------- /third_party/cram/tests/pep8.t: -------------------------------------------------------------------------------- 1 | Skip this test if pep8 isn't available: 2 | 3 | $ command -v pep8 > /dev/null || exit 80 4 | 5 | Check that the Python source code style is PEP 8 compliant: 6 | 7 | $ pep8 --config="$TESTDIR/.."/setup.cfg --repeat "$TESTDIR/.." 8 | -------------------------------------------------------------------------------- /third_party/cram/tests/pyflakes.t: -------------------------------------------------------------------------------- 1 | Skip this test if pyflakes isn't available: 2 | 3 | $ command -v pyflakes > /dev/null || exit 80 4 | 5 | Check that there are no obvious Python source code errors: 6 | 7 | $ pyflakes "$TESTDIR/.." 8 | -------------------------------------------------------------------------------- /third_party/cram/tests/run-doctests.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import doctest 4 | import os 5 | import sys 6 | 7 | def _getmodules(pkgdir): 8 | """Import and yield modules in pkgdir""" 9 | for root, dirs, files in os.walk(pkgdir): 10 | if '__pycache__' in dirs: 11 | dirs.remove('__pycache__') 12 | for fn in files: 13 | if not fn.endswith('.py') or fn == '__main__.py': 14 | continue 15 | 16 | modname = fn.replace(os.sep, '.')[:-len('.py')] 17 | if modname.endswith('.__init__'): 18 | modname = modname[:-len('.__init__')] 19 | modname = '.'.join(['cram', modname]) 20 | if '.' in modname: 21 | fromlist = [modname.rsplit('.', 1)[1]] 22 | else: 23 | fromlist = [] 24 | 25 | yield __import__(modname, {}, {}, fromlist) 26 | 27 | def rundoctests(pkgdir): 28 | """Run doctests in the given package directory""" 29 | totalfailures = totaltests = 0 30 | for module in _getmodules(pkgdir): 31 | failures, tests = doctest.testmod(module) 32 | totalfailures += failures 33 | totaltests += tests 34 | return totalfailures != 0 35 | 36 | if __name__ == '__main__': 37 | try: 38 | sys.exit(rundoctests(sys.argv[1])) 39 | except KeyboardInterrupt: 40 | pass 41 | -------------------------------------------------------------------------------- /third_party/cram/tests/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Bash doesn't expand aliases by default in non-interactive mode, so 4 | # we enable it manually if the test is run with --shell=/bin/bash. 5 | [ "$TESTSHELL" = "/bin/bash" ] && shopt -s expand_aliases 6 | 7 | # The $PYTHON environment variable should be set when running this test 8 | # from Python. 9 | [ -n "$PYTHON" ] || PYTHON="`which python`" 10 | [ -n "$PYTHONPATH" ] || PYTHONPATH="$TESTDIR/.." && export PYTHONPATH 11 | if [ -n "$COVERAGE" ]; then 12 | if [ -z "$COVERAGE_FILE" ]; then 13 | COVERAGE_FILE="$TESTDIR/../.coverage" 14 | export COVERAGE_FILE 15 | fi 16 | 17 | alias cram="`which "$COVERAGE"` run -a --rcfile=$TESTDIR/../.coveragerc \ 18 | $TESTDIR/../scripts/cram --shell=$TESTSHELL" 19 | alias doctest="`which "$COVERAGE"` run -a --rcfile=$TESTDIR/../.coveragerc \ 20 | $TESTDIR/run-doctests.py" 21 | else 22 | PYTHON="`command -v "$PYTHON" || echo "$PYTHON"`" 23 | alias cram="$PYTHON $TESTDIR/../scripts/cram --shell=$TESTSHELL" 24 | alias doctest="$PYTHON $TESTDIR/run-doctests.py" 25 | fi 26 | command -v md5 > /dev/null || alias md5=md5sum 27 | 28 | # Copy in example tests 29 | cp -R "$TESTDIR"/../examples . 30 | find . -name '*.err' -exec rm '{}' \; 31 | -------------------------------------------------------------------------------- /third_party/cram/tests/usage.t: -------------------------------------------------------------------------------- 1 | Set up cram alias and example tests: 2 | 3 | $ . "$TESTDIR"/setup.sh 4 | 5 | Usage: 6 | 7 | $ cram -h 8 | [Uu]sage: cram \[OPTIONS\] TESTS\.\.\. (re) 9 | 10 | [Oo]ptions: (re) 11 | -h, --help show this help message and exit 12 | -V, --version show version information and exit 13 | -q, --quiet don't print diffs 14 | -v, --verbose show filenames and test status 15 | -i, --interactive interactively merge changed test output 16 | -d, --debug write script output directly to the terminal 17 | -y, --yes answer yes to all questions 18 | -n, --no answer no to all questions 19 | -E, --preserve-env don't reset common environment variables 20 | -e, --no-err-files don't write .err files on test failures 21 | --keep-tmpdir keep temporary directories 22 | --shell=PATH shell to use for running tests (default: /bin/sh) 23 | --shell-opts=OPTS arguments to invoke shell with 24 | --indent=NUM number of spaces to use for indentation (default: 2) 25 | --xunit-file=PATH path to write xUnit XML output 26 | $ cram -V 27 | Cram CLI testing framework (version 0.7) 28 | 29 | Copyright (C) 2010-2016 Brodie Rao and others 30 | This is free software; see the source for copying conditions. There is NO 31 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 32 | $ cram 33 | [Uu]sage: cram \[OPTIONS\] TESTS\.\.\. (re) 34 | [2] 35 | $ cram -y -n 36 | options --yes and --no are mutually exclusive 37 | [2] 38 | $ cram non-existent also-not-here 39 | no such file: non-existent 40 | [2] 41 | $ mkdir empty 42 | $ cram empty 43 | no tests found 44 | [2] 45 | $ cram --shell=./badsh 46 | shell not found: ./badsh 47 | [2] 48 | -------------------------------------------------------------------------------- /third_party/luajit/Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2016 Alexey Kopytov 2 | # 3 | # This program is free software; you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation; either version 2 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # This program is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with this program; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 | 17 | EXTRA_DIST = luajit 18 | 19 | if IS_MACOS 20 | export MACOSX_DEPLOYMENT_TARGET := @MACOSX_DEPLOYMENT_TARGET@ 21 | endif 22 | 23 | all-local: $(builddir)/lib/libluajit-5.1.a 24 | 25 | # LuaJIT does not support VPATH builds 26 | $(builddir)/lib/libluajit-5.1.a: 27 | $(MAKE) -C $(srcdir)/luajit clean 28 | rm -rf tmp 29 | mkdir tmp 30 | tar -C $(srcdir) -cf - luajit | tar -xf - -C tmp/ 31 | chmod -R u+w tmp 32 | $(MAKE) -C tmp/luajit \ 33 | PREFIX=$(abs_top_builddir)/third_party/luajit \ 34 | INSTALL_INC=$(abs_top_builddir)/third_party/luajit/inc \ 35 | install 36 | 37 | clean-local: 38 | rm -rf tmp bin inc lib share 39 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/.gitignore: -------------------------------------------------------------------------------- 1 | *.[oa] 2 | *.so 3 | *.obj 4 | *.lib 5 | *.exp 6 | *.dll 7 | *.exe 8 | *.manifest 9 | *.dmp 10 | *.swp 11 | .tags 12 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/README: -------------------------------------------------------------------------------- 1 | README for LuaJIT 2.1.0-beta3 2 | ----------------------------- 3 | 4 | LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language. 5 | 6 | Project Homepage: https://luajit.org/ 7 | 8 | LuaJIT is Copyright (C) 2005-2022 Mike Pall. 9 | LuaJIT is free software, released under the MIT license. 10 | See full Copyright Notice in the COPYRIGHT file or in luajit.h. 11 | 12 | Documentation for LuaJIT is available in HTML format. 13 | Please point your favorite browser to: 14 | 15 | doc/luajit.html 16 | 17 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/doc/img/contact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akopytov/sysbench/3ceba0b1e115f8c50d1d045a4574d8ed643bd497/third_party/luajit/luajit/doc/img/contact.png -------------------------------------------------------------------------------- /third_party/luajit/luajit/dynasm/dasm_mips64.lua: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------ 2 | -- DynASM MIPS64 module. 3 | -- 4 | -- Copyright (C) 2005-2022 Mike Pall. All rights reserved. 5 | -- See dynasm.lua for full copyright notice. 6 | ------------------------------------------------------------------------------ 7 | -- This module just sets 64 bit mode for the combined MIPS/MIPS64 module. 8 | -- All the interesting stuff is there. 9 | ------------------------------------------------------------------------------ 10 | 11 | mips64 = true -- Using a global is an ugly, but effective solution. 12 | return require("dasm_mips") 13 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/dynasm/dasm_x64.lua: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------ 2 | -- DynASM x64 module. 3 | -- 4 | -- Copyright (C) 2005-2022 Mike Pall. All rights reserved. 5 | -- See dynasm.lua for full copyright notice. 6 | ------------------------------------------------------------------------------ 7 | -- This module just sets 64 bit mode for the combined x86/x64 module. 8 | -- All the interesting stuff is there. 9 | ------------------------------------------------------------------------------ 10 | 11 | x64 = true -- Using a global is an ugly, but effective solution. 12 | return require("dasm_x86") 13 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/etc/luajit.pc: -------------------------------------------------------------------------------- 1 | # Package information for LuaJIT to be used by pkg-config. 2 | majver=2 3 | minver=1 4 | relver=0 5 | version=${majver}.${minver}.${relver}-beta3 6 | abiver=5.1 7 | 8 | prefix=/usr/local 9 | multilib=lib 10 | exec_prefix=${prefix} 11 | libdir=${exec_prefix}/${multilib} 12 | libname=luajit-${abiver} 13 | includedir=${prefix}/include/luajit-${majver}.${minver} 14 | 15 | INSTALL_LMOD=${prefix}/share/lua/${abiver} 16 | INSTALL_CMOD=${prefix}/${multilib}/lua/${abiver} 17 | 18 | Name: LuaJIT 19 | Description: Just-in-time compiler for Lua 20 | URL: https://luajit.org 21 | Version: ${version} 22 | Requires: 23 | Libs: -L${libdir} -l${libname} 24 | Libs.private: -Wl,-E -lm -ldl 25 | Cflags: -I${includedir} 26 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/.gitignore: -------------------------------------------------------------------------------- 1 | luajit 2 | lj_bcdef.h 3 | lj_ffdef.h 4 | lj_libdef.h 5 | lj_recdef.h 6 | lj_folddef.h 7 | lj_vm.[sS] 8 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/host/.gitignore: -------------------------------------------------------------------------------- 1 | minilua 2 | buildvm 3 | buildvm_arch.h 4 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/host/README: -------------------------------------------------------------------------------- 1 | The files in this directory are only used during the build process of LuaJIT. 2 | For cross-compilation, they must be executed on the host, not on the target. 3 | 4 | These files should NOT be installed! 5 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/jit/.gitignore: -------------------------------------------------------------------------------- 1 | vmdef.lua 2 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/jit/dis_arm64be.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------------- 2 | -- LuaJIT ARM64BE disassembler wrapper module. 3 | -- 4 | -- Copyright (C) 2005-2022 Mike Pall. All rights reserved. 5 | -- Released under the MIT license. See Copyright Notice in luajit.h 6 | ---------------------------------------------------------------------------- 7 | -- ARM64 instructions are always little-endian. So just forward to the 8 | -- common ARM64 disassembler module. All the interesting stuff is there. 9 | ------------------------------------------------------------------------------ 10 | 11 | return require((string.match(..., ".*%.") or "").."dis_arm64") 12 | 13 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/jit/dis_mips64.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------------- 2 | -- LuaJIT MIPS64 disassembler wrapper module. 3 | -- 4 | -- Copyright (C) 2005-2022 Mike Pall. All rights reserved. 5 | -- Released under the MIT license. See Copyright Notice in luajit.h 6 | ---------------------------------------------------------------------------- 7 | -- This module just exports the big-endian functions from the 8 | -- MIPS disassembler module. All the interesting stuff is there. 9 | ------------------------------------------------------------------------------ 10 | 11 | local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips") 12 | return { 13 | create = dis_mips.create, 14 | disass = dis_mips.disass, 15 | regname = dis_mips.regname 16 | } 17 | 18 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/jit/dis_mips64el.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------------- 2 | -- LuaJIT MIPS64EL disassembler wrapper module. 3 | -- 4 | -- Copyright (C) 2005-2022 Mike Pall. All rights reserved. 5 | -- Released under the MIT license. See Copyright Notice in luajit.h 6 | ---------------------------------------------------------------------------- 7 | -- This module just exports the little-endian functions from the 8 | -- MIPS disassembler module. All the interesting stuff is there. 9 | ------------------------------------------------------------------------------ 10 | 11 | local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips") 12 | return { 13 | create = dis_mips.create_el, 14 | disass = dis_mips.disass_el, 15 | regname = dis_mips.regname 16 | } 17 | 18 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/jit/dis_mips64r6.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------------- 2 | -- LuaJIT MIPS64R6 disassembler wrapper module. 3 | -- 4 | -- Copyright (C) 2005-2022 Mike Pall. All rights reserved. 5 | -- Released under the MIT license. See Copyright Notice in luajit.h 6 | ---------------------------------------------------------------------------- 7 | -- This module just exports the r6 big-endian functions from the 8 | -- MIPS disassembler module. All the interesting stuff is there. 9 | ------------------------------------------------------------------------------ 10 | 11 | local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips") 12 | return { 13 | create = dis_mips.create_r6, 14 | disass = dis_mips.disass_r6, 15 | regname = dis_mips.regname 16 | } 17 | 18 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/jit/dis_mips64r6el.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------------- 2 | -- LuaJIT MIPS64R6EL disassembler wrapper module. 3 | -- 4 | -- Copyright (C) 2005-2022 Mike Pall. All rights reserved. 5 | -- Released under the MIT license. See Copyright Notice in luajit.h 6 | ---------------------------------------------------------------------------- 7 | -- This module just exports the r6 little-endian functions from the 8 | -- MIPS disassembler module. All the interesting stuff is there. 9 | ------------------------------------------------------------------------------ 10 | 11 | local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips") 12 | return { 13 | create = dis_mips.create_r6_el, 14 | disass = dis_mips.disass_r6_el, 15 | regname = dis_mips.regname 16 | } 17 | 18 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/jit/dis_mipsel.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------------- 2 | -- LuaJIT MIPSEL disassembler wrapper module. 3 | -- 4 | -- Copyright (C) 2005-2022 Mike Pall. All rights reserved. 5 | -- Released under the MIT license. See Copyright Notice in luajit.h 6 | ---------------------------------------------------------------------------- 7 | -- This module just exports the little-endian functions from the 8 | -- MIPS disassembler module. All the interesting stuff is there. 9 | ------------------------------------------------------------------------------ 10 | 11 | local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips") 12 | return { 13 | create = dis_mips.create_el, 14 | disass = dis_mips.disass_el, 15 | regname = dis_mips.regname 16 | } 17 | 18 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/jit/dis_x64.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------------- 2 | -- LuaJIT x64 disassembler wrapper module. 3 | -- 4 | -- Copyright (C) 2005-2022 Mike Pall. All rights reserved. 5 | -- Released under the MIT license. See Copyright Notice in luajit.h 6 | ---------------------------------------------------------------------------- 7 | -- This module just exports the 64 bit functions from the combined 8 | -- x86/x64 disassembler module. All the interesting stuff is there. 9 | ------------------------------------------------------------------------------ 10 | 11 | local dis_x86 = require((string.match(..., ".*%.") or "").."dis_x86") 12 | return { 13 | create = dis_x86.create64, 14 | disass = dis_x86.disass64, 15 | regname = dis_x86.regname64 16 | } 17 | 18 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/jit/zone.lua: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------------------- 2 | -- LuaJIT profiler zones. 3 | -- 4 | -- Copyright (C) 2005-2022 Mike Pall. All rights reserved. 5 | -- Released under the MIT license. See Copyright Notice in luajit.h 6 | ---------------------------------------------------------------------------- 7 | -- 8 | -- This module implements a simple hierarchical zone model. 9 | -- 10 | -- Example usage: 11 | -- 12 | -- local zone = require("jit.zone") 13 | -- zone("AI") 14 | -- ... 15 | -- zone("A*") 16 | -- ... 17 | -- print(zone:get()) --> "A*" 18 | -- ... 19 | -- zone() 20 | -- ... 21 | -- print(zone:get()) --> "AI" 22 | -- ... 23 | -- zone() 24 | -- 25 | ---------------------------------------------------------------------------- 26 | 27 | local remove = table.remove 28 | 29 | return setmetatable({ 30 | flush = function(t) 31 | for i=#t,1,-1 do t[i] = nil end 32 | end, 33 | get = function(t) 34 | return t[#t] 35 | end 36 | }, { 37 | __call = function(t, zone) 38 | if zone then 39 | t[#t+1] = zone 40 | else 41 | return (assert(remove(t), "empty zone stack")) 42 | end 43 | end 44 | }) 45 | 46 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lib_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Library initialization. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | ** 5 | ** Major parts taken verbatim from the Lua interpreter. 6 | ** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h 7 | */ 8 | 9 | #define lib_init_c 10 | #define LUA_LIB 11 | 12 | #include "lua.h" 13 | #include "lauxlib.h" 14 | #include "lualib.h" 15 | 16 | #include "lj_arch.h" 17 | 18 | static const luaL_Reg lj_lib_load[] = { 19 | { "", luaopen_base }, 20 | { LUA_LOADLIBNAME, luaopen_package }, 21 | { LUA_TABLIBNAME, luaopen_table }, 22 | { LUA_IOLIBNAME, luaopen_io }, 23 | { LUA_OSLIBNAME, luaopen_os }, 24 | { LUA_STRLIBNAME, luaopen_string }, 25 | { LUA_MATHLIBNAME, luaopen_math }, 26 | { LUA_DBLIBNAME, luaopen_debug }, 27 | { LUA_BITLIBNAME, luaopen_bit }, 28 | { LUA_JITLIBNAME, luaopen_jit }, 29 | { NULL, NULL } 30 | }; 31 | 32 | static const luaL_Reg lj_lib_preload[] = { 33 | #if LJ_HASFFI 34 | { LUA_FFILIBNAME, luaopen_ffi }, 35 | #endif 36 | { NULL, NULL } 37 | }; 38 | 39 | LUALIB_API void luaL_openlibs(lua_State *L) 40 | { 41 | const luaL_Reg *lib; 42 | for (lib = lj_lib_load; lib->func; lib++) { 43 | lua_pushcfunction(L, lib->func); 44 | lua_pushstring(L, lib->name); 45 | lua_call(L, 1, 0); 46 | } 47 | luaL_findtable(L, LUA_REGISTRYINDEX, "_PRELOAD", 48 | sizeof(lj_lib_preload)/sizeof(lj_lib_preload[0])-1); 49 | for (lib = lj_lib_preload; lib->func; lib++) { 50 | lua_pushcfunction(L, lib->func); 51 | lua_setfield(L, -2, lib->name); 52 | } 53 | lua_pop(L, 1); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj.supp: -------------------------------------------------------------------------------- 1 | # Valgrind suppression file for LuaJIT 2.0. 2 | { 3 | Optimized string compare 4 | Memcheck:Addr4 5 | fun:lj_str_cmp 6 | } 7 | { 8 | Optimized string compare 9 | Memcheck:Addr1 10 | fun:lj_str_cmp 11 | } 12 | { 13 | Optimized string compare 14 | Memcheck:Addr4 15 | fun:lj_str_new 16 | } 17 | { 18 | Optimized string compare 19 | Memcheck:Addr1 20 | fun:lj_str_new 21 | } 22 | { 23 | Optimized string compare 24 | Memcheck:Cond 25 | fun:lj_str_new 26 | } 27 | { 28 | Optimized string compare 29 | Memcheck:Addr4 30 | fun:str_fastcmp 31 | } 32 | { 33 | Optimized string compare 34 | Memcheck:Addr1 35 | fun:str_fastcmp 36 | } 37 | { 38 | Optimized string compare 39 | Memcheck:Cond 40 | fun:str_fastcmp 41 | } 42 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_alloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Bundled memory allocator. 3 | ** Donated to the public domain. 4 | */ 5 | 6 | #ifndef _LJ_ALLOC_H 7 | #define _LJ_ALLOC_H 8 | 9 | #include "lj_def.h" 10 | 11 | #ifndef LUAJIT_USE_SYSMALLOC 12 | LJ_FUNC void *lj_alloc_create(PRNGState *rs); 13 | LJ_FUNC void lj_alloc_setprng(void *msp, PRNGState *rs); 14 | LJ_FUNC void lj_alloc_destroy(void *msp); 15 | LJ_FUNC void *lj_alloc_f(void *msp, void *ptr, size_t osize, size_t nsize); 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_asm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** IR assembler (SSA IR -> machine code). 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_ASM_H 7 | #define _LJ_ASM_H 8 | 9 | #include "lj_jit.h" 10 | 11 | #if LJ_HASJIT 12 | LJ_FUNC void lj_asm_trace(jit_State *J, GCtrace *T); 13 | LJ_FUNC void lj_asm_patchexit(jit_State *J, GCtrace *T, ExitNo exitno, 14 | MCode *target); 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_assert.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Internal assertions. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #define lj_assert_c 7 | #define LUA_CORE 8 | 9 | #if defined(LUA_USE_ASSERT) || defined(LUA_USE_APICHECK) 10 | 11 | #include 12 | 13 | #include "lj_obj.h" 14 | 15 | void lj_assert_fail(global_State *g, const char *file, int line, 16 | const char *func, const char *fmt, ...) 17 | { 18 | va_list argp; 19 | va_start(argp, fmt); 20 | fprintf(stderr, "LuaJIT ASSERT %s:%d: %s: ", file, line, func); 21 | vfprintf(stderr, fmt, argp); 22 | fputc('\n', stderr); 23 | va_end(argp); 24 | UNUSED(g); /* May be NULL. TODO: optionally dump state. */ 25 | abort(); 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_bc.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Bytecode instruction modes. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #define lj_bc_c 7 | #define LUA_CORE 8 | 9 | #include "lj_obj.h" 10 | #include "lj_bc.h" 11 | 12 | /* Bytecode offsets and bytecode instruction modes. */ 13 | #include "lj_bcdef.h" 14 | 15 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_carith.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** C data arithmetic. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_CARITH_H 7 | #define _LJ_CARITH_H 8 | 9 | #include "lj_obj.h" 10 | 11 | #if LJ_HASFFI 12 | 13 | LJ_FUNC int lj_carith_op(lua_State *L, MMS mm); 14 | 15 | #if LJ_32 16 | LJ_FUNC uint64_t lj_carith_shl64(uint64_t x, int32_t sh); 17 | LJ_FUNC uint64_t lj_carith_shr64(uint64_t x, int32_t sh); 18 | LJ_FUNC uint64_t lj_carith_sar64(uint64_t x, int32_t sh); 19 | LJ_FUNC uint64_t lj_carith_rol64(uint64_t x, int32_t sh); 20 | LJ_FUNC uint64_t lj_carith_ror64(uint64_t x, int32_t sh); 21 | #endif 22 | LJ_FUNC uint64_t lj_carith_shift64(uint64_t x, int32_t sh, int op); 23 | LJ_FUNC uint64_t lj_carith_check64(lua_State *L, int narg, CTypeID *id); 24 | 25 | #if LJ_32 && LJ_HASJIT 26 | LJ_FUNC int64_t lj_carith_mul64(int64_t x, int64_t k); 27 | #endif 28 | LJ_FUNC uint64_t lj_carith_divu64(uint64_t a, uint64_t b); 29 | LJ_FUNC int64_t lj_carith_divi64(int64_t a, int64_t b); 30 | LJ_FUNC uint64_t lj_carith_modu64(uint64_t a, uint64_t b); 31 | LJ_FUNC int64_t lj_carith_modi64(int64_t a, int64_t b); 32 | LJ_FUNC uint64_t lj_carith_powu64(uint64_t x, uint64_t k); 33 | LJ_FUNC int64_t lj_carith_powi64(int64_t x, int64_t k); 34 | 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_ccallback.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** FFI C callback handling. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_CCALLBACK_H 7 | #define _LJ_CCALLBACK_H 8 | 9 | #include "lj_obj.h" 10 | #include "lj_ctype.h" 11 | 12 | #if LJ_HASFFI 13 | 14 | /* Really belongs to lj_vm.h. */ 15 | LJ_ASMF void lj_vm_ffi_callback(void); 16 | 17 | LJ_FUNC MSize lj_ccallback_ptr2slot(CTState *cts, void *p); 18 | LJ_FUNCA lua_State * LJ_FASTCALL lj_ccallback_enter(CTState *cts, void *cf); 19 | LJ_FUNCA void LJ_FASTCALL lj_ccallback_leave(CTState *cts, TValue *o); 20 | LJ_FUNC void *lj_ccallback_new(CTState *cts, CType *ct, GCfunc *fn); 21 | LJ_FUNC void lj_ccallback_mcode_free(CTState *cts); 22 | 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_char.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Character types. 3 | ** Donated to the public domain. 4 | */ 5 | 6 | #ifndef _LJ_CHAR_H 7 | #define _LJ_CHAR_H 8 | 9 | #include "lj_def.h" 10 | 11 | #define LJ_CHAR_CNTRL 0x01 12 | #define LJ_CHAR_SPACE 0x02 13 | #define LJ_CHAR_PUNCT 0x04 14 | #define LJ_CHAR_DIGIT 0x08 15 | #define LJ_CHAR_XDIGIT 0x10 16 | #define LJ_CHAR_UPPER 0x20 17 | #define LJ_CHAR_LOWER 0x40 18 | #define LJ_CHAR_IDENT 0x80 19 | #define LJ_CHAR_ALPHA (LJ_CHAR_LOWER|LJ_CHAR_UPPER) 20 | #define LJ_CHAR_ALNUM (LJ_CHAR_ALPHA|LJ_CHAR_DIGIT) 21 | #define LJ_CHAR_GRAPH (LJ_CHAR_ALNUM|LJ_CHAR_PUNCT) 22 | 23 | /* Only pass -1 or 0..255 to these macros. Never pass a signed char! */ 24 | #define lj_char_isa(c, t) ((lj_char_bits+1)[(c)] & t) 25 | #define lj_char_iscntrl(c) lj_char_isa((c), LJ_CHAR_CNTRL) 26 | #define lj_char_isspace(c) lj_char_isa((c), LJ_CHAR_SPACE) 27 | #define lj_char_ispunct(c) lj_char_isa((c), LJ_CHAR_PUNCT) 28 | #define lj_char_isdigit(c) lj_char_isa((c), LJ_CHAR_DIGIT) 29 | #define lj_char_isxdigit(c) lj_char_isa((c), LJ_CHAR_XDIGIT) 30 | #define lj_char_isupper(c) lj_char_isa((c), LJ_CHAR_UPPER) 31 | #define lj_char_islower(c) lj_char_isa((c), LJ_CHAR_LOWER) 32 | #define lj_char_isident(c) lj_char_isa((c), LJ_CHAR_IDENT) 33 | #define lj_char_isalpha(c) lj_char_isa((c), LJ_CHAR_ALPHA) 34 | #define lj_char_isalnum(c) lj_char_isa((c), LJ_CHAR_ALNUM) 35 | #define lj_char_isgraph(c) lj_char_isa((c), LJ_CHAR_GRAPH) 36 | 37 | #define lj_char_toupper(c) ((c) - (lj_char_islower(c) >> 1)) 38 | #define lj_char_tolower(c) ((c) + lj_char_isupper(c)) 39 | 40 | LJ_DATA const uint8_t lj_char_bits[257]; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_clib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** FFI C library loader. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_CLIB_H 7 | #define _LJ_CLIB_H 8 | 9 | #include "lj_obj.h" 10 | 11 | #if LJ_HASFFI 12 | 13 | /* Namespace for C library indexing. */ 14 | #define CLNS_INDEX ((1u<env. */ 20 | } CLibrary; 21 | 22 | LJ_FUNC TValue *lj_clib_index(lua_State *L, CLibrary *cl, GCstr *name); 23 | LJ_FUNC void lj_clib_load(lua_State *L, GCtab *mt, GCstr *name, int global); 24 | LJ_FUNC void lj_clib_unload(CLibrary *cl); 25 | LJ_FUNC void lj_clib_default(lua_State *L, GCtab *mt); 26 | 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_ff.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Fast function IDs. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_FF_H 7 | #define _LJ_FF_H 8 | 9 | /* Fast function ID. */ 10 | typedef enum { 11 | FF_LUA_ = FF_LUA, /* Lua function (must be 0). */ 12 | FF_C_ = FF_C, /* Regular C function (must be 1). */ 13 | #define FFDEF(name) FF_##name, 14 | #include "lj_ffdef.h" 15 | FF__MAX 16 | } FastFunc; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_ffrecord.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Fast function call recorder. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_FFRECORD_H 7 | #define _LJ_FFRECORD_H 8 | 9 | #include "lj_obj.h" 10 | #include "lj_jit.h" 11 | 12 | #if LJ_HASJIT 13 | /* Data used by handlers to record a fast function. */ 14 | typedef struct RecordFFData { 15 | TValue *argv; /* Runtime argument values. */ 16 | ptrdiff_t nres; /* Number of returned results (defaults to 1). */ 17 | uint32_t data; /* Per-ffid auxiliary data (opcode, literal etc.). */ 18 | } RecordFFData; 19 | 20 | LJ_FUNC int32_t lj_ffrecord_select_mode(jit_State *J, TRef tr, TValue *tv); 21 | LJ_FUNC void lj_ffrecord_func(jit_State *J); 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_func.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Function handling (prototypes, functions and upvalues). 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_FUNC_H 7 | #define _LJ_FUNC_H 8 | 9 | #include "lj_obj.h" 10 | 11 | /* Prototypes. */ 12 | LJ_FUNC void LJ_FASTCALL lj_func_freeproto(global_State *g, GCproto *pt); 13 | 14 | /* Upvalues. */ 15 | LJ_FUNCA void LJ_FASTCALL lj_func_closeuv(lua_State *L, TValue *level); 16 | LJ_FUNC void LJ_FASTCALL lj_func_freeuv(global_State *g, GCupval *uv); 17 | 18 | /* Functions (closures). */ 19 | LJ_FUNC GCfunc *lj_func_newC(lua_State *L, MSize nelems, GCtab *env); 20 | LJ_FUNC GCfunc *lj_func_newL_empty(lua_State *L, GCproto *pt, GCtab *env); 21 | LJ_FUNCA GCfunc *lj_func_newL_gc(lua_State *L, GCproto *pt, GCfuncL *parent); 22 | LJ_FUNC void LJ_FASTCALL lj_func_free(global_State *g, GCfunc *c); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_gdbjit.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Client for the GDB JIT API. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_GDBJIT_H 7 | #define _LJ_GDBJIT_H 8 | 9 | #include "lj_obj.h" 10 | #include "lj_jit.h" 11 | 12 | #if LJ_HASJIT && defined(LUAJIT_USE_GDBJIT) 13 | 14 | LJ_FUNC void lj_gdbjit_addtrace(jit_State *J, GCtrace *T); 15 | LJ_FUNC void lj_gdbjit_deltrace(jit_State *J, GCtrace *T); 16 | 17 | #else 18 | #define lj_gdbjit_addtrace(J, T) UNUSED(T) 19 | #define lj_gdbjit_deltrace(J, T) UNUSED(T) 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_mcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Machine code management. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_MCODE_H 7 | #define _LJ_MCODE_H 8 | 9 | #include "lj_obj.h" 10 | 11 | #if LJ_HASJIT || LJ_HASFFI 12 | LJ_FUNC void lj_mcode_sync(void *start, void *end); 13 | #endif 14 | 15 | #if LJ_HASJIT 16 | 17 | #include "lj_jit.h" 18 | 19 | LJ_FUNC void lj_mcode_free(jit_State *J); 20 | LJ_FUNC MCode *lj_mcode_reserve(jit_State *J, MCode **lim); 21 | LJ_FUNC void lj_mcode_commit(jit_State *J, MCode *m); 22 | LJ_FUNC void lj_mcode_abort(jit_State *J); 23 | LJ_FUNC MCode *lj_mcode_patch(jit_State *J, MCode *ptr, int finish); 24 | LJ_FUNC_NORET void lj_mcode_limiterr(jit_State *J, size_t need); 25 | 26 | #define lj_mcode_commitbot(J, m) (J->mcbot = (m)) 27 | 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_meta.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Metamethod handling. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_META_H 7 | #define _LJ_META_H 8 | 9 | #include "lj_obj.h" 10 | 11 | /* Metamethod handling */ 12 | LJ_FUNC void lj_meta_init(lua_State *L); 13 | LJ_FUNC cTValue *lj_meta_cache(GCtab *mt, MMS mm, GCstr *name); 14 | LJ_FUNC cTValue *lj_meta_lookup(lua_State *L, cTValue *o, MMS mm); 15 | #if LJ_HASFFI 16 | LJ_FUNC int lj_meta_tailcall(lua_State *L, cTValue *tv); 17 | #endif 18 | 19 | #define lj_meta_fastg(g, mt, mm) \ 20 | ((mt) == NULL ? NULL : ((mt)->nomm & (1u<<(mm))) ? NULL : \ 21 | lj_meta_cache(mt, mm, mmname_str(g, mm))) 22 | #define lj_meta_fast(L, mt, mm) lj_meta_fastg(G(L), mt, mm) 23 | 24 | /* C helpers for some instructions, called from assembler VM. */ 25 | LJ_FUNCA cTValue *lj_meta_tget(lua_State *L, cTValue *o, cTValue *k); 26 | LJ_FUNCA TValue *lj_meta_tset(lua_State *L, cTValue *o, cTValue *k); 27 | LJ_FUNCA TValue *lj_meta_arith(lua_State *L, TValue *ra, cTValue *rb, 28 | cTValue *rc, BCReg op); 29 | LJ_FUNCA TValue *lj_meta_cat(lua_State *L, TValue *top, int left); 30 | LJ_FUNCA TValue * LJ_FASTCALL lj_meta_len(lua_State *L, cTValue *o); 31 | LJ_FUNCA TValue *lj_meta_equal(lua_State *L, GCobj *o1, GCobj *o2, int ne); 32 | LJ_FUNCA TValue * LJ_FASTCALL lj_meta_equal_cd(lua_State *L, BCIns ins); 33 | LJ_FUNCA TValue *lj_meta_comp(lua_State *L, cTValue *o1, cTValue *o2, int op); 34 | LJ_FUNCA void lj_meta_istype(lua_State *L, BCReg ra, BCReg tp); 35 | LJ_FUNCA void lj_meta_call(lua_State *L, TValue *func, TValue *top); 36 | LJ_FUNCA void LJ_FASTCALL lj_meta_for(lua_State *L, TValue *o); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_obj.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Miscellaneous object handling. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #define lj_obj_c 7 | #define LUA_CORE 8 | 9 | #include "lj_obj.h" 10 | 11 | /* Object type names. */ 12 | LJ_DATADEF const char *const lj_obj_typename[] = { /* ORDER LUA_T */ 13 | "no value", "nil", "boolean", "userdata", "number", "string", 14 | "table", "function", "userdata", "thread", "proto", "cdata" 15 | }; 16 | 17 | LJ_DATADEF const char *const lj_obj_itypename[] = { /* ORDER LJ_T */ 18 | "nil", "boolean", "boolean", "userdata", "string", "upval", "thread", 19 | "proto", "function", "trace", "cdata", "table", "userdata", "number" 20 | }; 21 | 22 | /* Compare two objects without calling metamethods. */ 23 | int LJ_FASTCALL lj_obj_equal(cTValue *o1, cTValue *o2) 24 | { 25 | if (itype(o1) == itype(o2)) { 26 | if (tvispri(o1)) 27 | return 1; 28 | if (!tvisnum(o1)) 29 | return gcrefeq(o1->gcr, o2->gcr); 30 | } else if (!tvisnumber(o1) || !tvisnumber(o2)) { 31 | return 0; 32 | } 33 | return numberVnum(o1) == numberVnum(o2); 34 | } 35 | 36 | /* Return pointer to object or its object data. */ 37 | const void * LJ_FASTCALL lj_obj_ptr(global_State *g, cTValue *o) 38 | { 39 | UNUSED(g); 40 | if (tvisudata(o)) 41 | return uddata(udataV(o)); 42 | else if (tvislightud(o)) 43 | return lightudV(g, o); 44 | else if (LJ_HASFFI && tviscdata(o)) 45 | return cdataptr(cdataV(o)); 46 | else if (tvisgcv(o)) 47 | return gcV(o); 48 | else 49 | return NULL; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_parse.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Lua parser (source code -> bytecode). 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_PARSE_H 7 | #define _LJ_PARSE_H 8 | 9 | #include "lj_obj.h" 10 | #include "lj_lex.h" 11 | 12 | LJ_FUNC GCproto *lj_parse(LexState *ls); 13 | LJ_FUNC GCstr *lj_parse_keepstr(LexState *ls, const char *str, size_t l); 14 | #if LJ_HASFFI 15 | LJ_FUNC void lj_parse_keepcdata(LexState *ls, TValue *tv, GCcdata *cd); 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_prng.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Pseudo-random number generation. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_PRNG_H 7 | #define _LJ_PRNG_H 8 | 9 | #include "lj_def.h" 10 | 11 | LJ_FUNC int LJ_FASTCALL lj_prng_seed_secure(PRNGState *rs); 12 | LJ_FUNC uint64_t LJ_FASTCALL lj_prng_u64(PRNGState *rs); 13 | LJ_FUNC uint64_t LJ_FASTCALL lj_prng_u64d(PRNGState *rs); 14 | 15 | /* This is just the precomputed result of lib_math.c:random_seed(rs, 0.0). */ 16 | static LJ_AINLINE void lj_prng_seed_fixed(PRNGState *rs) 17 | { 18 | rs->u[0] = U64x(a0d27757,0a345b8c); 19 | rs->u[1] = U64x(764a296c,5d4aa64f); 20 | rs->u[2] = U64x(51220704,070adeaa); 21 | rs->u[3] = U64x(2a2717b5,a7b7b927); 22 | } 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_profile.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Low-overhead profiling. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_PROFILE_H 7 | #define _LJ_PROFILE_H 8 | 9 | #include "lj_obj.h" 10 | 11 | #if LJ_HASPROFILE 12 | 13 | LJ_FUNC void LJ_FASTCALL lj_profile_interpreter(lua_State *L); 14 | #if !LJ_PROFILE_SIGPROF 15 | LJ_FUNC void LJ_FASTCALL lj_profile_hook_enter(global_State *g); 16 | LJ_FUNC void LJ_FASTCALL lj_profile_hook_leave(global_State *g); 17 | #endif 18 | 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_serialize.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Object de/serialization. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_SERIALIZE_H 7 | #define _LJ_SERIALIZE_H 8 | 9 | #include "lj_obj.h" 10 | #include "lj_buf.h" 11 | 12 | #if LJ_HASBUFFER 13 | 14 | #define LJ_SERIALIZE_DEPTH 100 /* Default depth. */ 15 | 16 | LJ_FUNC void LJ_FASTCALL lj_serialize_dict_prep_str(lua_State *L, GCtab *dict); 17 | LJ_FUNC void LJ_FASTCALL lj_serialize_dict_prep_mt(lua_State *L, GCtab *dict); 18 | LJ_FUNC SBufExt * LJ_FASTCALL lj_serialize_put(SBufExt *sbx, cTValue *o); 19 | LJ_FUNC char * LJ_FASTCALL lj_serialize_get(SBufExt *sbx, TValue *o); 20 | LJ_FUNC GCstr * LJ_FASTCALL lj_serialize_encode(lua_State *L, cTValue *o); 21 | LJ_FUNC void lj_serialize_decode(lua_State *L, TValue *o, GCstr *str); 22 | #if LJ_HASJIT 23 | LJ_FUNC MSize LJ_FASTCALL lj_serialize_peektype(SBufExt *sbx); 24 | #endif 25 | 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_snap.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Snapshot handling. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_SNAP_H 7 | #define _LJ_SNAP_H 8 | 9 | #include "lj_obj.h" 10 | #include "lj_jit.h" 11 | 12 | #if LJ_HASJIT 13 | LJ_FUNC void lj_snap_add(jit_State *J); 14 | LJ_FUNC void lj_snap_purge(jit_State *J); 15 | LJ_FUNC void lj_snap_shrink(jit_State *J); 16 | LJ_FUNC IRIns *lj_snap_regspmap(jit_State *J, GCtrace *T, SnapNo snapno, 17 | IRIns *ir); 18 | LJ_FUNC void lj_snap_replay(jit_State *J, GCtrace *T); 19 | LJ_FUNC const BCIns *lj_snap_restore(jit_State *J, void *exptr); 20 | LJ_FUNC void lj_snap_grow_buf_(jit_State *J, MSize need); 21 | LJ_FUNC void lj_snap_grow_map_(jit_State *J, MSize need); 22 | 23 | static LJ_AINLINE void lj_snap_grow_buf(jit_State *J, MSize need) 24 | { 25 | if (LJ_UNLIKELY(need > J->sizesnap)) lj_snap_grow_buf_(J, need); 26 | } 27 | 28 | static LJ_AINLINE void lj_snap_grow_map(jit_State *J, MSize need) 29 | { 30 | if (LJ_UNLIKELY(need > J->sizesnapmap)) lj_snap_grow_map_(J, need); 31 | } 32 | 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_state.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** State and stack handling. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_STATE_H 7 | #define _LJ_STATE_H 8 | 9 | #include "lj_obj.h" 10 | 11 | #define incr_top(L) \ 12 | (++L->top >= tvref(L->maxstack) && (lj_state_growstack1(L), 0)) 13 | 14 | #define savestack(L, p) ((char *)(p) - mref(L->stack, char)) 15 | #define restorestack(L, n) ((TValue *)(mref(L->stack, char) + (n))) 16 | 17 | LJ_FUNC void lj_state_relimitstack(lua_State *L); 18 | LJ_FUNC void lj_state_shrinkstack(lua_State *L, MSize used); 19 | LJ_FUNCA void LJ_FASTCALL lj_state_growstack(lua_State *L, MSize need); 20 | LJ_FUNC void LJ_FASTCALL lj_state_growstack1(lua_State *L); 21 | 22 | static LJ_AINLINE void lj_state_checkstack(lua_State *L, MSize need) 23 | { 24 | if ((mref(L->maxstack, char) - (char *)L->top) <= 25 | (ptrdiff_t)need*(ptrdiff_t)sizeof(TValue)) 26 | lj_state_growstack(L, need); 27 | } 28 | 29 | LJ_FUNC lua_State *lj_state_new(lua_State *L); 30 | LJ_FUNC void LJ_FASTCALL lj_state_free(global_State *g, lua_State *L); 31 | #if LJ_64 && !LJ_GC64 && !(defined(LUAJIT_USE_VALGRIND) && defined(LUAJIT_USE_SYSMALLOC)) 32 | LJ_FUNC lua_State *lj_state_newstate(lua_Alloc f, void *ud); 33 | #endif 34 | 35 | #define LJ_ALLOCF_INTERNAL ((lua_Alloc)(void *)(uintptr_t)(1237<<4)) 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_str.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** String handling. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_STR_H 7 | #define _LJ_STR_H 8 | 9 | #include 10 | 11 | #include "lj_obj.h" 12 | 13 | /* String helpers. */ 14 | LJ_FUNC int32_t LJ_FASTCALL lj_str_cmp(GCstr *a, GCstr *b); 15 | LJ_FUNC const char *lj_str_find(const char *s, const char *f, 16 | MSize slen, MSize flen); 17 | LJ_FUNC int lj_str_haspattern(GCstr *s); 18 | 19 | /* String interning. */ 20 | LJ_FUNC void lj_str_resize(lua_State *L, MSize newmask); 21 | LJ_FUNCA GCstr *lj_str_new(lua_State *L, const char *str, size_t len); 22 | LJ_FUNC void LJ_FASTCALL lj_str_free(global_State *g, GCstr *s); 23 | LJ_FUNC void LJ_FASTCALL lj_str_init(lua_State *L); 24 | #define lj_str_freetab(g) \ 25 | (lj_mem_freevec(g, g->str.tab, g->str.mask+1, GCRef)) 26 | 27 | #define lj_str_newz(L, s) (lj_str_new(L, s, strlen(s))) 28 | #define lj_str_newlit(L, s) (lj_str_new(L, "" s, sizeof(s)-1)) 29 | #define lj_str_size(len) (sizeof(GCstr) + (((len)+4) & ~(MSize)3)) 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_strscan.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** String scanning. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_STRSCAN_H 7 | #define _LJ_STRSCAN_H 8 | 9 | #include "lj_obj.h" 10 | 11 | /* Options for accepted/returned formats. */ 12 | #define STRSCAN_OPT_TOINT 0x01 /* Convert to int32_t, if possible. */ 13 | #define STRSCAN_OPT_TONUM 0x02 /* Always convert to double. */ 14 | #define STRSCAN_OPT_IMAG 0x04 15 | #define STRSCAN_OPT_LL 0x08 16 | #define STRSCAN_OPT_C 0x10 17 | 18 | /* Returned format. */ 19 | typedef enum { 20 | STRSCAN_ERROR, 21 | STRSCAN_NUM, STRSCAN_IMAG, 22 | STRSCAN_INT, STRSCAN_U32, STRSCAN_I64, STRSCAN_U64, 23 | } StrScanFmt; 24 | 25 | LJ_FUNC StrScanFmt lj_strscan_scan(const uint8_t *p, MSize len, TValue *o, 26 | uint32_t opt); 27 | LJ_FUNC int LJ_FASTCALL lj_strscan_num(GCstr *str, TValue *o); 28 | #if LJ_DUALNUM 29 | LJ_FUNC int LJ_FASTCALL lj_strscan_number(GCstr *str, TValue *o); 30 | #else 31 | #define lj_strscan_number(s, o) lj_strscan_num((s), (o)) 32 | #endif 33 | 34 | /* Check for number or convert string to number/int in-place (!). */ 35 | static LJ_AINLINE int lj_strscan_numberobj(TValue *o) 36 | { 37 | return tvisnumber(o) || (tvisstr(o) && lj_strscan_number(strV(o), o)); 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_udata.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Userdata handling. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LJ_UDATA_H 7 | #define _LJ_UDATA_H 8 | 9 | #include "lj_obj.h" 10 | 11 | LJ_FUNC GCudata *lj_udata_new(lua_State *L, MSize sz, GCtab *env); 12 | LJ_FUNC void LJ_FASTCALL lj_udata_free(global_State *g, GCudata *ud); 13 | #if LJ_64 14 | LJ_FUNC void * LJ_FASTCALL lj_lightud_intern(lua_State *L, void *p); 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lj_vmevent.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** VM event handling. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #include 7 | 8 | #define lj_vmevent_c 9 | #define LUA_CORE 10 | 11 | #include "lj_obj.h" 12 | #include "lj_str.h" 13 | #include "lj_tab.h" 14 | #include "lj_state.h" 15 | #include "lj_dispatch.h" 16 | #include "lj_vm.h" 17 | #include "lj_vmevent.h" 18 | 19 | ptrdiff_t lj_vmevent_prepare(lua_State *L, VMEvent ev) 20 | { 21 | global_State *g = G(L); 22 | GCstr *s = lj_str_newlit(L, LJ_VMEVENTS_REGKEY); 23 | cTValue *tv = lj_tab_getstr(tabV(registry(L)), s); 24 | if (tvistab(tv)) { 25 | int hash = VMEVENT_HASH(ev); 26 | tv = lj_tab_getint(tabV(tv), hash); 27 | if (tv && tvisfunc(tv)) { 28 | lj_state_checkstack(L, LUA_MINSTACK); 29 | setfuncV(L, L->top++, funcV(tv)); 30 | if (LJ_FR2) setnilV(L->top++); 31 | return savestack(L, L->top); 32 | } 33 | } 34 | g->vmevmask &= ~VMEVENT_MASK(ev); /* No handler: cache this fact. */ 35 | return 0; 36 | } 37 | 38 | void lj_vmevent_call(lua_State *L, ptrdiff_t argbase) 39 | { 40 | global_State *g = G(L); 41 | uint8_t oldmask = g->vmevmask; 42 | uint8_t oldh = hook_save(g); 43 | int status; 44 | g->vmevmask = 0; /* Disable all events. */ 45 | hook_vmevent(g); 46 | status = lj_vm_pcall(L, restorestack(L, argbase), 0+1, 0); 47 | if (LJ_UNLIKELY(status)) { 48 | /* Really shouldn't use stderr here, but where else to complain? */ 49 | L->top--; 50 | fputs("VM handler failed: ", stderr); 51 | fputs(tvisstr(L->top) ? strVdata(L->top) : "?", stderr); 52 | fputc('\n', stderr); 53 | } 54 | hook_restore(g, oldh); 55 | if (g->vmevmask != VMEVENT_NOCACHE) 56 | g->vmevmask = oldmask; /* Restore event mask, but not if not modified. */ 57 | } 58 | 59 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lua.hpp: -------------------------------------------------------------------------------- 1 | // C++ wrapper for LuaJIT header files. 2 | 3 | extern "C" { 4 | #include "lua.h" 5 | #include "lauxlib.h" 6 | #include "lualib.h" 7 | #include "luajit.h" 8 | } 9 | 10 | -------------------------------------------------------------------------------- /third_party/luajit/luajit/src/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** Standard library header. 3 | ** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h 4 | */ 5 | 6 | #ifndef _LUALIB_H 7 | #define _LUALIB_H 8 | 9 | #include "lua.h" 10 | 11 | #define LUA_FILEHANDLE "FILE*" 12 | 13 | #define LUA_COLIBNAME "coroutine" 14 | #define LUA_MATHLIBNAME "math" 15 | #define LUA_STRLIBNAME "string" 16 | #define LUA_TABLIBNAME "table" 17 | #define LUA_IOLIBNAME "io" 18 | #define LUA_OSLIBNAME "os" 19 | #define LUA_LOADLIBNAME "package" 20 | #define LUA_DBLIBNAME "debug" 21 | #define LUA_BITLIBNAME "bit" 22 | #define LUA_JITLIBNAME "jit" 23 | #define LUA_FFILIBNAME "ffi" 24 | 25 | LUALIB_API int luaopen_base(lua_State *L); 26 | LUALIB_API int luaopen_math(lua_State *L); 27 | LUALIB_API int luaopen_string(lua_State *L); 28 | LUALIB_API int luaopen_table(lua_State *L); 29 | LUALIB_API int luaopen_io(lua_State *L); 30 | LUALIB_API int luaopen_os(lua_State *L); 31 | LUALIB_API int luaopen_package(lua_State *L); 32 | LUALIB_API int luaopen_debug(lua_State *L); 33 | LUALIB_API int luaopen_bit(lua_State *L); 34 | LUALIB_API int luaopen_jit(lua_State *L); 35 | LUALIB_API int luaopen_ffi(lua_State *L); 36 | LUALIB_API int luaopen_string_buffer(lua_State *L); 37 | 38 | LUALIB_API void luaL_openlibs(lua_State *L); 39 | 40 | #ifndef lua_assert 41 | #define lua_assert(x) ((void)0) 42 | #endif 43 | 44 | #endif 45 | --------------------------------------------------------------------------------