Skip to content

Commit

Permalink
Initial Concurrency Kit import.
Browse files Browse the repository at this point in the history
  • Loading branch information
akopytov committed Oct 16, 2016
1 parent 8b581ae commit 6bf78c6
Show file tree
Hide file tree
Showing 466 changed files with 59,737 additions and 6 deletions.
6 changes: 5 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ if USE_BUNDLED_LUAJIT
LUAJIT_DIR = third_party/luajit
endif

SUBDIRS = doc $(LUAJIT_DIR) sysbench tests
if USE_BUNDLED_CK
CK_DIR = third_party/concurrency_kit
endif

SUBDIRS = doc $(LUAJIT_DIR) $(CK_DIR) sysbench tests

EXTRA_DIST = autogen.sh README.md README-WIN.txt README-Oracle.md ChangeLog

Expand Down
11 changes: 10 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ AC_MSG_RESULT([$pgsql_support])
# Set LuaJIT flags
SB_LUAJIT

# Set Concurrency Kit flags
SB_CONCURRENCY_KIT

# Check if we should enable large files support
AC_ARG_ENABLE(largefile,
AS_HELP_STRING([--enable-largefile],[enable large files support (default is enabled)]), ,
Expand Down Expand Up @@ -467,7 +470,8 @@ fi

AM_CFLAGS="${CC_WARNINGS} ${GPROF_PROFILING} ${GPROF_COVERAGE} ${AM_CFLAGS} ${PTHREAD_CFLAGS}"

AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(top_srcdir)/sysbench ${LUAJIT_CFLAGS}"
AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(top_srcdir)/sysbench ${LUAJIT_CFLAGS} \
${CK_CFLAGS}"

AM_LDFLAGS="$PTHREAD_LIBS"

Expand All @@ -481,6 +485,7 @@ doc/xsl/Makefile
doc/xsl/catalog.xml
doc/Makefile
third_party/luajit/Makefile
third_party/concurrency_kit/Makefile
sysbench/Makefile
sysbench/drivers/Makefile
sysbench/drivers/mysql/Makefile
Expand Down Expand Up @@ -525,4 +530,8 @@ AC_MSG_RESULT([LuaJIT : ${sb_use_luajit}])
AC_MSG_RESULT([LUAJIT_CFLAGS : ${LUAJIT_CFLAGS}])
AC_MSG_RESULT([LUAJIT_LIBS : ${LUAJIT_LIBS}])
AC_MSG_RESULT([LUAJIT_LDFLAGS : ${LUAJIT_LDFLAGS}])
AC_MSG_RESULT([])
AC_MSG_RESULT([Concurrency Kit : ${sb_use_ck}])
AC_MSG_RESULT([CK_CFLAGS : ${CK_CFLAGS}])
AC_MSG_RESULT([CK_LIBS : ${CK_LIBS}])
AC_MSG_RESULT([===============================================================================])
52 changes: 52 additions & 0 deletions m4/sb_concurrency_kit.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright (C) 2016 Alexey Kopytov <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

# ---------------------------------------------------------------------------
# Macro: SB_CONCURRENCY_KIT
# ---------------------------------------------------------------------------
AC_DEFUN([SB_CONCURRENCY_KIT], [
AC_ARG_WITH([system-ck],
AC_HELP_STRING([--with-system-ck],
[Use system-provided Concurrency Kit headers and library (requires pkg-config)]),
[sb_use_ck="system"],
[sb_use_ck="bundled"])
AC_CACHE_CHECK([whether to build with system or bundled Concurrency Kit],
[sb_cv_lib_ck], [
AS_IF([test "x$sb_use_ck" = "xsystem"],
[
sb_cv_lib_ck=[system]
], [
sb_cv_lib_ck=[bundled]
])
])
AS_IF([test "x$sb_cv_lib_ck" = "xsystem"],
# let PKG_CHECK_MODULES set CK_CFLAGS and CK_LIBS for system libck
[PKG_CHECK_MODULES([CK], [ck])],
# Set CK_CFLAGS and CK_LIBS manually for bundled libck
[
CK_CFLAGS="-I\$(abs_top_builddir)/third_party/concurrency_kit/include"
CK_LIBS="\$(abs_top_builddir)/third_party/concurrency_kit/lib/libck.a"
]
)
AC_DEFINE_UNQUOTED([SB_WITH_CK], ["$sb_use_ck"],
[Whether system or bundled Concurrency Ki is used])
AM_CONDITIONAL([USE_BUNDLED_CK], [test "x$sb_use_ck" = xbundled])
])
4 changes: 1 addition & 3 deletions sysbench/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ if USE_PGSQL
pgsql_ldadd = drivers/pgsql/libsbpgsql.a $(PGSQL_LIBS)
endif

luajit_ldadd = $(LUAJIT_LIBS)

sysbench_SOURCES = sysbench.c sysbench.h sb_timer.c sb_timer.h \
sb_options.c sb_options.h sb_logger.c sb_logger.h sb_list.h db_driver.h \
db_driver.c sb_percentile.c sb_percentile.h sb_rnd.c sb_rnd.h \
Expand All @@ -53,7 +51,7 @@ sysbench_LDADD = tests/fileio/libsbfileio.a tests/threads/libsbthreads.a \
tests/memory/libsbmemory.a tests/cpu/libsbcpu.a \
tests/mutex/libsbmutex.a scripting/libsbscript.a \
$(mysql_ldadd) $(drizzle_ldadd) $(attachsql_ldadd) $(pgsql_ldadd) \
$(ora_ldadd) $(luajit_ldadd)
$(ora_ldadd) $(LUAJIT_LIBS) $(CK_LIBS)

sysbench_LDFLAGS = $(EXTRA_LDFLAGS) $(mysql_ldflags) $(attachsql_ldflags) \
$(pgsql_ldflags) $(ora_ldflags) $(LUAJIT_LDFLAGS)
34 changes: 34 additions & 0 deletions third_party/concurrency_kit/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (C) 2016 Alexey Kopytov <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

EXTRA_DIST = ck

all-local: $(builddir)/lib/libck.a

# Concurrency Kit does not support VPATH builds
$(builddir)/lib/libck.a:
rm -rf tmp
mkdir tmp
tar -C $(srcdir) -cf - ck | tar -xf - -C tmp/
chmod -R u+w tmp
cd tmp/ck && \
./configure \
--prefix=$(abs_top_builddir)/third_party/concurrency_kit && \
$(MAKE) && \
$(MAKE) install

clean-local:
rm -rf tmp include lib share
187 changes: 187 additions & 0 deletions third_party/concurrency_kit/ck/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
/Makefile
build/ck.build
build/ck.pc
build/regressions.build
build/ck.spec
include/ck_md.h
src/Makefile
doc/Makefile
doc/*.3
build/Makefile
.DS_Store
LOG
*.log
*.html
*.gz
*.o
*.a
*.so
*.dSYM
.*.sw[op]
GPATH
GRTAGS
GTAGS
ID
regressions/ck_array/validate/serial
regressions/ck_backoff/validate/validate
regressions/ck_bag/validate/order
regressions/ck_barrier/benchmark/throughput
regressions/ck_barrier/validate/barrier_centralized
regressions/ck_barrier/validate/barrier_combining
regressions/ck_barrier/validate/barrier_dissemination
regressions/ck_barrier/validate/barrier_mcs
regressions/ck_barrier/validate/barrier_tournament
regressions/ck_bitmap/validate/serial
regressions/ck_brlock/benchmark/latency
regressions/ck_brlock/benchmark/throughput
regressions/ck_brlock/validate/validate
regressions/ck_bytelock/benchmark/latency
regressions/ck_bytelock/validate/validate
regressions/ck_cohort/benchmark/ck_cohort.LATENCY
regressions/ck_cohort/benchmark/ck_cohort.THROUGHPUT
regressions/ck_cohort/validate/validate
regressions/ck_epoch/validate/ck_epoch_call
regressions/ck_epoch/validate/ck_epoch_poll
regressions/ck_epoch/validate/ck_epoch_section
regressions/ck_epoch/validate/ck_epoch_section_2
regressions/ck_epoch/validate/torture
regressions/ck_epoch/validate/ck_epoch_synchronize
regressions/ck_epoch/validate/ck_stack
regressions/ck_epoch/validate/ck_stack_read
regressions/ck_fifo/benchmark/latency
regressions/ck_fifo/validate/ck_fifo_mpmc
regressions/ck_fifo/validate/ck_fifo_mpmc_iterator
regressions/ck_fifo/validate/ck_fifo_spsc
regressions/ck_fifo/validate/ck_fifo_spsc_iterator
regressions/ck_hp/benchmark/fifo_latency
regressions/ck_hp/benchmark/stack_latency
regressions/ck_hp/validate/ck_hp_fifo
regressions/ck_hp/validate/ck_hp_fifo_donner
regressions/ck_hp/validate/ck_hp_stack
regressions/ck_hp/validate/nbds_haz_test
regressions/ck_hp/validate/serial
regressions/ck_hs/benchmark/apply
regressions/ck_hs/benchmark/parallel_bytestring
regressions/ck_hs/benchmark/parallel_bytestring.delete
regressions/ck_hs/benchmark/serial
regressions/ck_hs/validate/serial
regressions/ck_ht/benchmark/parallel_bytestring
regressions/ck_ht/benchmark/parallel_bytestring.delete
regressions/ck_ht/benchmark/parallel_direct
regressions/ck_ht/benchmark/serial
regressions/ck_ht/benchmark/serial.delete
regressions/ck_ht/validate/serial
regressions/ck_ht/validate/serial.delete
regressions/ck_pflock/benchmark/latency
regressions/ck_pflock/benchmark/throughput
regressions/ck_pflock/validate/validate
regressions/ck_pr/benchmark/ck_pr_cas_64
regressions/ck_pr/benchmark/ck_pr_cas_64_2
regressions/ck_pr/benchmark/ck_pr_fas_64
regressions/ck_pr/benchmark/fp
regressions/ck_pr/validate/ck_pr_add
regressions/ck_pr/validate/ck_pr_and
regressions/ck_pr/validate/ck_pr_bin
regressions/ck_pr/validate/ck_pr_btc
regressions/ck_pr/validate/ck_pr_btr
regressions/ck_pr/validate/ck_pr_bts
regressions/ck_pr/validate/ck_pr_btx
regressions/ck_pr/validate/ck_pr_cas
regressions/ck_pr/validate/ck_pr_dec
regressions/ck_pr/validate/ck_pr_faa
regressions/ck_pr/validate/ck_pr_fas
regressions/ck_pr/validate/ck_pr_fax
regressions/ck_pr/validate/ck_pr_inc
regressions/ck_pr/validate/ck_pr_load
regressions/ck_pr/validate/ck_pr_n
regressions/ck_pr/validate/ck_pr_or
regressions/ck_pr/validate/ck_pr_store
regressions/ck_pr/validate/ck_pr_sub
regressions/ck_pr/validate/ck_pr_unary
regressions/ck_pr/validate/ck_pr_xor
regressions/ck_queue/validate/ck_list
regressions/ck_queue/validate/ck_slist
regressions/ck_queue/validate/ck_stailq
regressions/ck_rhs/benchmark/parallel_bytestring
regressions/ck_rhs/benchmark/serial
regressions/ck_rhs/validate/serial
regressions/ck_ring/benchmark/latency
regressions/ck_ring/validate/ck_ring_spmc
regressions/ck_ring/validate/ck_ring_spmc_template
regressions/ck_ring/validate/ck_ring_spsc
regressions/ck_ring/validate/ck_ring_spsc_template
regressions/ck_ring/validate/ck_ring_mpmc
regressions/ck_ring/validate/ck_ring_mpmc_template
regressions/ck_rwcohort/benchmark/ck_neutral.LATENCY
regressions/ck_rwcohort/benchmark/ck_neutral.THROUGHPUT
regressions/ck_rwcohort/benchmark/ck_rp.LATENCY
regressions/ck_rwcohort/benchmark/ck_rp.THROUGHPUT
regressions/ck_rwcohort/benchmark/ck_wp.LATENCY
regressions/ck_rwcohort/benchmark/ck_wp.THROUGHPUT
regressions/ck_rwcohort/validate/ck_neutral
regressions/ck_rwcohort/validate/ck_rp
regressions/ck_rwcohort/validate/ck_wp
regressions/ck_rwlock/benchmark/latency
regressions/ck_rwlock/benchmark/throughput
regressions/ck_rwlock/validate/validate
regressions/ck_sequence/benchmark/ck_sequence
regressions/ck_sequence/validate/ck_sequence
regressions/ck_spinlock/benchmark/ck_anderson.LATENCY
regressions/ck_spinlock/benchmark/ck_anderson.THROUGHPUT
regressions/ck_spinlock/benchmark/ck_cas.LATENCY
regressions/ck_spinlock/benchmark/ck_cas.THROUGHPUT
regressions/ck_spinlock/benchmark/ck_clh.LATENCY
regressions/ck_spinlock/benchmark/ck_clh.THROUGHPUT
regressions/ck_spinlock/benchmark/ck_dec.LATENCY
regressions/ck_spinlock/benchmark/ck_dec.THROUGHPUT
regressions/ck_spinlock/benchmark/ck_fas.LATENCY
regressions/ck_spinlock/benchmark/ck_fas.THROUGHPUT
regressions/ck_spinlock/benchmark/ck_hclh.LATENCY
regressions/ck_spinlock/benchmark/ck_hclh.THROUGHPUT
regressions/ck_spinlock/benchmark/ck_mcs.LATENCY
regressions/ck_spinlock/benchmark/ck_mcs.THROUGHPUT
regressions/ck_spinlock/benchmark/ck_spinlock.LATENCY
regressions/ck_spinlock/benchmark/ck_spinlock.THROUGHPUT
regressions/ck_spinlock/benchmark/ck_ticket.LATENCY
regressions/ck_spinlock/benchmark/ck_ticket.THROUGHPUT
regressions/ck_spinlock/benchmark/ck_ticket_pb.LATENCY
regressions/ck_spinlock/benchmark/ck_ticket_pb.THROUGHPUT
regressions/ck_spinlock/benchmark/linux_spinlock.LATENCY
regressions/ck_spinlock/benchmark/linux_spinlock.THROUGHPUT
regressions/ck_spinlock/validate/ck_anderson
regressions/ck_spinlock/validate/ck_cas
regressions/ck_spinlock/validate/ck_clh
regressions/ck_spinlock/validate/ck_dec
regressions/ck_spinlock/validate/ck_fas
regressions/ck_spinlock/validate/ck_hclh
regressions/ck_spinlock/validate/ck_mcs
regressions/ck_spinlock/validate/ck_spinlock
regressions/ck_spinlock/validate/ck_ticket
regressions/ck_spinlock/validate/ck_ticket_pb
regressions/ck_spinlock/validate/linux_spinlock
regressions/ck_stack/benchmark/latency
regressions/ck_stack/validate/mpmc_pair
regressions/ck_stack/validate/mpmc_pop
regressions/ck_stack/validate/mpmc_push
regressions/ck_stack/validate/mpmc_trypair
regressions/ck_stack/validate/mpmc_trypop
regressions/ck_stack/validate/mpmc_trypush
regressions/ck_stack/validate/mpnc_push
regressions/ck_stack/validate/pthreads_pair
regressions/ck_stack/validate/serial
regressions/ck_stack/validate/spinlock_eb_pair
regressions/ck_stack/validate/spinlock_eb_pop
regressions/ck_stack/validate/spinlock_eb_push
regressions/ck_stack/validate/spinlock_pair
regressions/ck_stack/validate/spinlock_pop
regressions/ck_stack/validate/spinlock_push
regressions/ck_stack/validate/upmc_pop
regressions/ck_stack/validate/upmc_push
regressions/ck_stack/validate/upmc_trypop
regressions/ck_stack/validate/upmc_trypush
regressions/ck_swlock/benchmark/latency
regressions/ck_swlock/benchmark/throughput
regressions/ck_swlock/validate/validate
regressions/ck_tflock/benchmark/latency
regressions/ck_tflock/benchmark/throughput
regressions/ck_tflock/validate/validate
54 changes: 54 additions & 0 deletions third_party/concurrency_kit/ck/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
Copyright 2010-2014 Samy Al Bahra.
Copyright 2011-2013 AppNexus, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

Hazard Pointers (src/ck_hp.c) also includes this license:

(c) Copyright 2008, IBM Corporation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

ck_pr_rtm leverages work from Andi Kleen:
Copyright (c) 2012,2013 Intel Corporation

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that: (1) source code distributions
retain the above copyright notice and this paragraph in its entirety, (2)
distributions including binary code include the above copyright notice and
this paragraph in its entirety in the documentation or other materials
provided with the distribution

THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Loading

0 comments on commit 6bf78c6

Please sign in to comment.