From: weiyu Date: Tue, 15 Dec 2020 05:45:03 +0000 (-0800) Subject: add scripts and key X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=37e7d14e591833c59c814bdaf1911f49ffa19c20;p=tsan11-tsan11rec-docker.git add scripts and key --- diff --git a/insecure_key b/insecure_key new file mode 100644 index 0000000..36498f6 --- /dev/null +++ b/insecure_key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEA1ZswRub+3DvSEnBiyM5YRpRzRYV88vO1X2j867u6pyCHUNXv +RRCr7ahMLPIVYsZwlHb4sF+Zb3DJOBH+E265o93chdMxbWG44k0spf10JRevA0JX +NrEwHR8vesCR74e5MuddbSic88lsEqnnn+Fo3lStvE6nBp6tbqdEu7GhTtHSYejn +wwINnA5ocsHkd1YE9L2Scqw1e4bXveTAQnSvhqe33QshGXFpt0tQwRWngah887f2 +P54wFSm2C/UyFT7pvIjINKzIi4vUoXz/nU+V7neTmt3XDdjloYg3ycOaX4RSVneO +HCf7hkcEKbzbPzzSrGAAYYC5UzFB+ImsIbtV2wIDAQABAoIBAQCjROxgtX2Gft7y +Ix8Ol9IXmK6HLCI2XZt7ovb3hFWGGzHy0qMBql2P2Tzoed1o038Hq+woe9n+uTnE +dtQ6rD6PByzgyW2VSsWTjCOdeJ5HH9Qw7ItXDZZWHBkhfYHOkXI4e2oI3qshGAtY +NLALn7KVhioJriCyyaSM2KOLx5khcY+EJ1inQfwQJKqPGsdKc72liz07T8ifRj+m +NLKtwrxlK3IXYfIdgLp/1pCKdrC80DhprMsD4xvNgq4pCR9jd4FoqM9t/Up5ppTm ++p6A/bDwdIPh6cFFeyMP+G3+bTlW1Gg7RLoNCc6qh53WWVgEOQqdLHcQ8Ge4RLmb +wLUmnRuRAoGBAPfXYfjpPZi8rPIQpux13Bs7xaS1/Fa9WqrEfrPptFdUVHeFCGY8 +qOUVewPviHdbs0nB71Ynk9/e96agFYijQdqTQzVnpYI4i8GiGk5gPMiB2UYeJ/HZ +mIB3jtWyf6Z/GO0hJ1a6mX0XD3zJGNqFaiwqaYgdO1Fwh9gcH3O2lHyjAoGBANyj +TGDBYHpxPu6uKcGreLd0SgO61PEj7aOSNfrBB2PK83A+zjZCFZRIWqjfrkxGG6+a +2WuHbEHuCGvu2V5juHYxbAD/38iV/lQl/2xyvN1eR/baE3US06qn6idxjnmeNZDy +DelAx1RGuEvLX1TNAzDTxBwYyzH3W2RpKAUAD11pAoGAN38YJhd8Pn5JL68A4cQG +dGau/BHwHjAqZEC5qmmzgzaT72tvlQ0SOLHVqOzzHt7+x45QnHciSqfvxnTkPYNp +FJuTGhtKWV12FfbJczFjivZgg63u/d3eoy2iY0GkCdE98KNS3r3L7tHCGwwgr5Xe +T2Nz3BHHnZXYJVEuzcddeocCgYEAnhDjPAHtw2p0Inxlb9kPb6aBC/ECcwtBSUkL +IOy/BZA1HPnxs89eNFAtmwQ8k2o6lXDDSJTJSuZj5CdGVKfuU8aOUJz/Tm2eudxL +A/+jLJhJyCBthhcJyx3m04E4CAr+5ytyKeP9qXPMvoghcNg66/UabuKYV+CU+feX +8xUa7NkCgYEAlX8HGvWMmiG+ZRFB//3Loy87bBxGlN0pUtCEScabZxdB2HkI9Vp7 +Yr67QIZ3y7T88Mhkwam54JCjiV+3TZbSyRMOjkqf7UhTCZC6hHNqdUnlpv4bJWeW +i5Eun8ltYxBnemNc2QGxA4r+KCspi+pRvWNGzL3PFVBGXiLsmOMul78= +-----END RSA PRIVATE KEY----- diff --git a/scripts/assertion_test.sh b/scripts/assertion_test.sh new file mode 100644 index 0000000..8ee5011 --- /dev/null +++ b/scripts/assertion_test.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +MABAINLIB="../src" +MABAINDIR="mabain/examples" + +TESTS="silo" + +TOTAL_RUN=$1 + +if [ -z "$1" ]; then + TOTAL_RUN=10 +fi + +function run_silo_test { + echo "Silo assertion test" + COUNT_ASSERT=0 + EXE='./dbtest --verbose -t 5' + + cd 'silo/out-perf.debug.check.masstree/benchmarks/' + for i in `seq 1 1 $TOTAL_RUN` + do + OUTPUT="$($EXE 2>&1)" + ASSERT="$(echo "$OUTPUT" | grep "Assert")" + if [ -n "$ASSERT" ] ; then + ((++COUNT_ASSERT)) + fi + done + + cd ../../.. + + AVG_ASSERT=$(echo "${COUNT_ASSERT} * 100 / ${TOTAL_RUN}" | bc -l | xargs printf "%.1f") + echo "Runs: ${TOTAL_RUN} | Assertion rate: ${AVG_ASSERT}%" +} + +function run_mabain_test { + export LD_LIBRARY_PATH="$${MABAINLIB}" + + echo "Mabain assertion test" + COUNT_ASSERT=0 + EXE='./mb_multi_thread_insert_test_assert' + + cd ${MABAINDIR} + for i in `seq 1 1 $TOTAL_RUN` + do + OUTPUT="$(/usr/bin/time -f "time: %E" $EXE 2>&1)" + ASSERT="$(echo "$OUTPUT" | grep "Assert")" + if [ -n "$ASSERT" ] ; then + ((++COUNT_ASSERT)) + fi + + rm ./multi_test/* 2> /dev/null + done + + cd ../.. + + AVG_ASSERT=$(echo "${COUNT_ASSERT} * 100 / ${TOTAL_RUN}" | bc -l | xargs printf "%.1f") + echo "Runs: ${TOTAL_RUN} | Assertion rate: ${AVG_ASSERT}%" +} + +#function run_all_tests { +# for t in ${TESTS} +# do +# echo "running ${t}" +# (run_${t}_test 2>&1) > "${t}.log" +# run_${t}_test &> "${t}.log" +# done +#} + +run_silo_test +run_mabain_test diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..d3aef3e --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# Mabain +cd /data/tsan11-benchmarks/mabain +make clean +rm -r -f examples/multi_test +make install +cd examples +make +mkdir multi_test + +# Gdax +cd /data/tsan11-benchmarks/gdax-orderbook-hpp/demo +make clean +make + +# Iris +cd /data/tsan11-benchmarks/iris +make clean +make +make test + +# Silo +cd /data/tsan11-benchmarks/silo +make clean +MODE=perf CHECK_INVARIANTS=0 USE_MALLOC_MODE=0 make -j dbtest + +# Data structure benchmarks +cd /data/tsan11-benchmarks/cdschecker_modified_benchmarks +make clean +make + +# Data structures with injected bugs that tsan11 and tsan11rec cannot detect +cd ~/c11tester-benchmarks/tsan11-missingbug +make clean +make diff --git a/scripts/build_firefox_jsshell.sh b/scripts/build_firefox_jsshell.sh new file mode 100755 index 0000000..06a78a4 --- /dev/null +++ b/scripts/build_firefox_jsshell.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# Download firefox +cd /data +if [ ! -d "firefox" ]; then + wget https://ftp.mozilla.org/pub/firefox/releases/50.0.1/source/firefox-50.0.1.source.tar.xz + tar -xf firefox-50.0.1.source.tar.xz + mv firefox-50.0.1 firefox + rm firefox-50.0.1.source.tar.xz +fi + +cp /data/scripts/jsshell-tsan11.sh firefox/js/src +cp /data/scripts/jsshell-tsan11rec.sh firefox/js/src +cp /data/scripts/icu.m4 /data/firefox/build/autoconf +cd /data/firefox/js/src + +if [ -d "tsan11" ]; then rm -Rf tsan11; fi +sh jsshell-tsan11.sh tsan11 +cp tsan11/js/src/shell/js /data/tsan11-benchmarks + +if [ -d "tsan11rec" ]; then rm -Rf tsan11rec; fi +sh jsshell-tsan11rec.sh tsan11rec +cp tsan11rec/js/src/shell/js /data/tsan11rec-benchmarks diff --git a/scripts/calculator.py b/scripts/calculator.py new file mode 100644 index 0000000..8989701 --- /dev/null +++ b/scripts/calculator.py @@ -0,0 +1,74 @@ +#!/bin/python +import re +import statistics +import sys + +def GdaxStatistics(filename): + gdax_data = [] + with open(filename, 'r') as f: + content = f.read() + allruns = re.findall(r'(0-0\.49.*?19.99 s: \d+)', content, flags=re.DOTALL) + for run in allruns: + iterations = 0 + for entry in run.split('\n'): + if entry: + (_, count) = entry.split(': ') + iterations += int(count) + + gdax_data.append(iterations) + + return gdax_data + +def SiloStatistics(filename): + data = [] + with open(filename, 'r') as f: + content = f.read() + allruns = re.findall(r'agg_throughput: (\d+\.?\d*) ops', content) + data = [float(x) for x in allruns] + + return data + +def TimeStatistics(filename): + data = [] + with open(filename, 'r') as f: + content = f.read() + allruns = re.findall(r'real.*?(\d+)m(\d+\.\d+)s', content) + for run in allruns: + (minute,second) = run + time = int(minute) * 60 + float(second) + data.append(time) + + return data + +def JsbenchStatistics(filename): + with open(filename, 'r') as f: + content = f.read() + result = re.search(r'(Final results.*?runs)', content, flags=re.DOTALL) + print(result.group(0)) + +def printData(data): + str_data = [str(x) for x in data] + print 'raw data:', ', '.join(str_data) + print 'mean:', statistics.mean(data) + print 'stddev:', statistics.stdev(data) + print '' + +if __name__ == "__main__": + base = '.' + if len(sys.argv) == 2: + base = sys.argv[1] + + print 'Silo measurement: agg_throughput, unit: ops/sec' + printData(SiloStatistics( base + '/silo.log')) + + print 'Gdax measurement: number of iterations' + printData(GdaxStatistics( base + '/gdax.log')) + + print 'Iris measurement: real time unit: seccond' + printData(TimeStatistics( base + '/iris.log')) + + print 'Mabain measurement: real time, unit: second' + printData(TimeStatistics( base + '/mabain.log')) + + print 'Jsbench results:' + JsbenchStatistics( base + '/jsbench.log'); diff --git a/scripts/icu.m4 b/scripts/icu.m4 new file mode 100644 index 0000000..0b30df9 --- /dev/null +++ b/scripts/icu.m4 @@ -0,0 +1,111 @@ +dnl This Source Code Form is subject to the terms of the Mozilla Public +dnl License, v. 2.0. If a copy of the MPL was not distributed with this +dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. + +dnl Set the MOZ_ICU_VERSION variable to denote the current version of the +dnl ICU library, as well as a few other things. + +AC_DEFUN([MOZ_CONFIG_ICU], [ + +ICU_LIB_NAMES= +MOZ_SYSTEM_ICU= +MOZ_ARG_WITH_BOOL(system-icu, +[ --with-system-icu + Use system ICU (located with pkgconfig)], + MOZ_SYSTEM_ICU=1) + +if test -n "$MOZ_SYSTEM_ICU"; then + PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1) + CFLAGS="$CFLAGS $MOZ_ICU_CFLAGS" + CXXFLAGS="$CXXFLAGS $MOZ_ICU_CFLAGS" +fi + +AC_SUBST(MOZ_SYSTEM_ICU) + +MOZ_ARG_WITH_STRING(intl-api, +[ --with-intl-api, --with-intl-api=build, --without-intl-api + Determine the status of the ECMAScript Internationalization API. The first + (or lack of any of these) builds and exposes the API. The second builds it + but doesn't use ICU or expose the API to script. The third doesn't build + ICU at all.], + _INTL_API=$withval) + +ENABLE_INTL_API= +EXPOSE_INTL_API= +case "$_INTL_API" in +no) + ;; +build) + ENABLE_INTL_API=1 + ;; +yes) + ENABLE_INTL_API=1 + EXPOSE_INTL_API=1 + ;; +*) + AC_MSG_ERROR([Invalid value passed to --with-intl-api: $_INTL_API]) + ;; +esac + +if test -n "$ENABLE_INTL_API"; then + USE_ICU=1 +fi + +if test -n "$EXPOSE_INTL_API"; then + AC_DEFINE(EXPOSE_INTL_API) +fi + +if test -n "$ENABLE_INTL_API"; then + AC_DEFINE(ENABLE_INTL_API) +fi + +dnl Settings for the implementation of the ECMAScript Internationalization API +if test -n "$USE_ICU"; then + icudir="$_topsrcdir/intl/icu/source" + if test ! -d "$icudir"; then + icudir="$_topsrcdir/../../intl/icu/source" + if test ! -d "$icudir"; then + AC_MSG_ERROR([Cannot find the ICU directory]) + fi + fi + + version=`sed -n 's/^[[[:space:]]]*#[[:space:]]*define[[:space:]][[:space:]]*U_ICU_VERSION_MAJOR_NUM[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p' "$icudir/common/unicode/uvernum.h"` + if test x"$version" = x; then + AC_MSG_ERROR([cannot determine icu version number from uvernum.h header file $lineno]) + fi + MOZ_ICU_VERSION="$version" + + # TODO: the l is actually endian-dependent + # We could make this set as 'l' or 'b' for little or big, respectively, + # but we'd need to check in a big-endian version of the file. + ICU_DATA_FILE="icudt${version}l.dat" + + dnl We won't build ICU data as a separate file when building + dnl JS standalone so that embedders don't have to deal with it. + dnl We also don't do it on Windows because sometimes the file goes + dnl missing -- possibly due to overzealous antivirus software? -- + dnl which prevents the browser from starting up :( + if test -z "$JS_STANDALONE" -a -z "$MOZ_SYSTEM_ICU" -a "$OS_TARGET" != WINNT -a "$MOZ_WIDGET_TOOLKIT" != "android"; then + MOZ_ICU_DATA_ARCHIVE=1 + else + MOZ_ICU_DATA_ARCHIVE= + fi +fi + +AC_SUBST(MOZ_ICU_VERSION) +AC_SUBST(ENABLE_INTL_API) +AC_SUBST(USE_ICU) +AC_SUBST(ICU_DATA_FILE) +AC_SUBST(MOZ_ICU_DATA_ARCHIVE) + +if test -n "$USE_ICU" -a -z "$MOZ_SYSTEM_ICU"; then + if test -z "$YASM" -a -z "$GNU_AS" -a "$COMPILE_ENVIRONMENT"; then + AC_MSG_ERROR([Building ICU requires either yasm or a GNU assembler. If you do not have either of those available for this platform you must use --without-intl-api]) + fi + dnl We build ICU as a static library. + AC_DEFINE(U_STATIC_IMPLEMENTATION) + dnl Source files that use ICU should have control over which parts of the ICU + dnl namespace they want to use. + AC_DEFINE(U_USING_ICU_NAMESPACE,0) +fi +]) diff --git a/scripts/jsshell-tsan11.sh b/scripts/jsshell-tsan11.sh new file mode 100644 index 0000000..e5acf91 --- /dev/null +++ b/scripts/jsshell-tsan11.sh @@ -0,0 +1,19 @@ +#! /bin/sh + +if [ -z $1 ] ; then + echo "usage: $0 " +elif [ -d $1 ] ; then + echo "directory $1 already exists" +else + autoconf2.13 + mkdir $1 + cd $1 + LLVM_ROOT="/data/tsan11_build/llvm_patched_build" + CC="/data/tsan11_build/llvm_patched_build/bin/clang" \ + CXX="/data/tsan11_build/llvm_patched_build/bin/clang++" \ + CFLAGS="-fsanitize=thread" \ + CXXFLAGS="-fsanitize=thread" \ + LDFLAGS="-fsanitize=thread" \ + ../configure --disable-debug --enable-optimize="-O2 -gline-tables-only" --enable-llvm-hacks --disable-jemalloc + make -j 8 +fi diff --git a/scripts/jsshell-tsan11rec.sh b/scripts/jsshell-tsan11rec.sh new file mode 100644 index 0000000..1f2f12b --- /dev/null +++ b/scripts/jsshell-tsan11rec.sh @@ -0,0 +1,19 @@ +#! /bin/sh + +if [ -z $1 ] ; then + echo "usage: $0 " +elif [ -d $1 ] ; then + echo "directory $1 already exists" +else + autoconf2.13 + mkdir $1 + cd $1 + LLVM_ROOT="/data/tsan11rec_build/llvm_patched_build" + CC="/data/tsan11rec_build/llvm_patched_build/bin/clang" \ + CXX="/data/tsan11rec_build/llvm_patched_build/bin/clang++" \ + CFLAGS="-fsanitize=thread" \ + CXXFLAGS="-fsanitize=thread" \ + LDFLAGS="-fsanitize=thread" \ + ../configure --disable-debug --enable-optimize="-O2 -gline-tables-only" --enable-llvm-hacks --disable-jemalloc + make -j 8 +fi diff --git a/scripts/run.sh b/scripts/run.sh new file mode 100755 index 0000000..865c44a --- /dev/null +++ b/scripts/run.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +GDAXLIB="./dependencies/libcds-2.3.2/build-release/bin" +GDAXDIR="gdax-orderbook-hpp/demo" + +MABAINLIB="../src" +MABAINDIR="mabain/examples" + +JSBENCH_DIR="jsbench-2013.1" +JSEXE_PATH="/data/tsan11-benchmarks/js" + +TESTS="gdax silo mabain iris jsbench" + +TOTAL_RUN=$1 + +REDUNDANT="jemalloc.stats log.txt" + +function run_gdax_test { + cd ${GDAXDIR} + export LD_LIBRARY_PATH="${GDAXLIB}" + + for i in `seq 1 1 $TOTAL_RUN` + do + echo "round ${i}" + ./demo 120 + done + cd ../.. +} + +function run_silo_test { + for i in `seq 1 1 $TOTAL_RUN` + do + echo "round ${i}" + ./silo/out-perf.masstree/benchmarks/dbtest --verbose -t 5 + done +} + +function run_mabain_test { + cd ${MABAINDIR} + export LD_LIBRARY_PATH="${MABAINLIB}" + + for i in `seq 1 1 $TOTAL_RUN` + do + echo "round ${i}" + rm ./multi_test/* 2> /dev/null + time ./mb_multi_thread_insert_test + done + cd ../.. +} + +function run_iris_test { + for i in `seq 1 1 $TOTAL_RUN` + do + echo "round ${i}" + time ./iris/test_lfringbuffer + done +} + +function run_jsbench_test { + cd ${JSBENCH_DIR} + python ./harness.py ${JSEXE_PATH} ${TOTAL_RUN} + cd .. +} + +function run_all_tests { + for t in ${TESTS} + do + echo "running ${t}" + (run_${t}_test 2>&1) > "${t}.log" +# run_${t}_test &> "${t}.log" + done +} + +# Remove previous output files +rm *.log 2> /dev/null +rm $REDUNDANT 2> /dev/null + +run_all_tests diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 0000000..9cfd1fa --- /dev/null +++ b/scripts/setup.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +# Compile tsan11 benchmarks +cd /data +git clone git://plrg.eecs.uci.edu/c11concurrency-benchmarks.git tsan11-benchmarks +cd tsan11-benchmarks +git checkout tsan11-docker +cp /data/scripts/build.sh . +cp /data/scripts/run.sh . +cp /data/scripts/test_all.sh . +cp /data/scripts/calculator.py . +./build.sh +cd .. + +# Compile tsan11rec benchmarks +cd /data +git clone git://plrg.eecs.uci.edu/c11concurrency-benchmarks.git tsan11rec-benchmarks +cd tsan11rec-benchmarks +git checkout tsan11-docker +cp /data/scripts/build.sh . +cp /data/scripts/run.sh . +cp /data/scripts/test_all.sh . +cp /data/scripts/calculator.py . +sed -i "s/tsan11/tsan11rec/g" clang clang++ gcc g++ build.sh run.sh +./build.sh +cd .. + +## Firefox +cd /data/scripts +./build_firefox_jsshell.sh +echo >&2 "Setup is now complete. To run the benchmarks, please look at our READE.md" diff --git a/scripts/test_all.sh b/scripts/test_all.sh new file mode 100755 index 0000000..4ac1597 --- /dev/null +++ b/scripts/test_all.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +TOTAL_RUN=$1 + +if [ -z "$1" ]; then + TOTAL_RUN=10 +fi + +# Clear data +rm *.log 2> /dev/null + +echo "test application benchmarks" +# Run in all-core configuration +if [ ! -d "all-core" ]; then + mkdir all-core +fi + +echo "running each benchmark with multiple cores for ${TOTAL_RUN} times" +rm all-core/*.log 2> /dev/null +./run.sh $TOTAL_RUN +mv *.log all-core +echo "done" +python calculator.py all-core + +# Run in single-core configuration +if [ ! -d "single-core" ]; then + mkdir single-core +fi + +echo "running each benchmark with a single core for ${TOTAL_RUN} times" +rm single-core/*.log 2> /dev/null +taskset -c 0 ./run.sh $TOTAL_RUN +mv *.log single-core +echo "done" +python calculator.py single-core +