From 548bd8c9424cf8fcaf7eb4206f267894efacc612 Mon Sep 17 00:00:00 2001 From: leo-git Date: Thu, 13 Jul 2023 12:36:59 +0200 Subject: [PATCH 1/5] bugfix(script): fix permission of several scripts before script do not have execution permissions, now they have Signed-off-by: leo-git --- script/clone_modules.sh | 0 script/create_machine_conf.sh | 0 script/generate_dat.sh | 0 script/plotresults.sh | 0 script/run_rand_batch_test.sh | 0 script/utils/aggregate_rand_batch_test.sh | 0 6 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 script/clone_modules.sh mode change 100644 => 100755 script/create_machine_conf.sh mode change 100644 => 100755 script/generate_dat.sh mode change 100644 => 100755 script/plotresults.sh mode change 100644 => 100755 script/run_rand_batch_test.sh mode change 100644 => 100755 script/utils/aggregate_rand_batch_test.sh diff --git a/script/clone_modules.sh b/script/clone_modules.sh old mode 100644 new mode 100755 diff --git a/script/create_machine_conf.sh b/script/create_machine_conf.sh old mode 100644 new mode 100755 diff --git a/script/generate_dat.sh b/script/generate_dat.sh old mode 100644 new mode 100755 diff --git a/script/plotresults.sh b/script/plotresults.sh old mode 100644 new mode 100755 diff --git a/script/run_rand_batch_test.sh b/script/run_rand_batch_test.sh old mode 100644 new mode 100755 diff --git a/script/utils/aggregate_rand_batch_test.sh b/script/utils/aggregate_rand_batch_test.sh old mode 100644 new mode 100755 From 8be542f3d403e792ea99a014e704bdad233130c4 Mon Sep 17 00:00:00 2001 From: leo-git Date: Thu, 13 Jul 2023 12:47:31 +0200 Subject: [PATCH 2/5] bigfix(script): renamed file I renamed the file script/plotresults.sh Signed-off-by: leo-git --- script/{plotresults.sh => plot_results.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename script/{plotresults.sh => plot_results.sh} (100%) diff --git a/script/plotresults.sh b/script/plot_results.sh similarity index 100% rename from script/plotresults.sh rename to script/plot_results.sh From 646aab044d928255743462551563bc84acc86467 Mon Sep 17 00:00:00 2001 From: leo-git Date: Tue, 18 Jul 2023 10:19:15 +0200 Subject: [PATCH 3/5] bugfix(script): fix python brackets I corrected the missing parentheses in the python commands. Signed-off-by: leo-git --- script/create_machine_conf.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/script/create_machine_conf.sh b/script/create_machine_conf.sh index 68bd9a4..f367cab 100755 --- a/script/create_machine_conf.sh +++ b/script/create_machine_conf.sh @@ -25,7 +25,7 @@ make clean cd .. val=`../bin/test-QUEUED_SPINLOCK_LOCK -s 1 -rnd_cs_lower 100000 -rnd_cs_higher 100000 -rnd_ncs_lower 0 -rnd_ncs_higher 0 -t 1 -seq | grep CS/sec` -val=`python -c "print '$val'.strip().split(' ')[-1]"` +val=`python -c "print ('$val'.strip().split(' ')[-1])"` result=`echo 100000/$val | bc` echo LAST LOOPER $result @@ -34,20 +34,20 @@ cpucount=`lscpu | grep "CPU(s):"|head -n1` vendor=`lscpu | grep "Vendor ID"` -cpu=`python -c "print '$cpu'.split(':')[1]"` -cpucount=`python -c "print '$cpucount'.split(':')[1].replace(' ', '')"` -vendor=`python -c "print '$vendor'.split(':')[1].replace(' ', '')"` +cpu=`python -c "print ('$cpu'.split(':')[1])"` +cpucount=`python -c "print ('$cpucount'.split(':')[1].replace(' ', ''))"` +vendor=`python -c "print ('$vendor'.split(':')[1].replace(' ', ''))"` cpu_label=$cpu -cpu_label=`python -c "print '$cpu_label'.replace('Intel(R) ', '').replace('Xeon(R)', '').replace('Core(TM)', '').replace('CPU', '').replace(' ', '').split('@')[0]"` -cpu_label=`python -c "print '$cpu_label'.replace('(tm)', '').replace('AMD', '').replace('Processor', '-').replace(' ', '')"` +cpu_label=`python -c "print ('$cpu_label'.replace('Intel(R) ', '').replace('Xeon(R)', '').replace('Core(TM)', '').replace('CPU', '').replace(' ', '').split('@')[0])"` +cpu_label=`python -c "print ('$cpu_label'.replace('(tm)', '').replace('AMD', '').replace('Processor', '-').replace(' ', ''))"` -python -c "print '$cpu_label'" -python -c "print '$cpucount'" -python -c "print '$vendor'" +python -c "print ('$cpu_label')" +python -c "print ('$cpucount')" +python -c "print ('$vendor')" distro=`lsb_release -a | grep Descr` -distro=`python -c "print '$distro'.split(':')[1].strip()"` +distro=`python -c "print ('$distro'.split(':')[1].strip())"` file="machine_conf/`uname -n`.conf" From cdff4f466ff2340994e7a463c3427fdbb0150fc6 Mon Sep 17 00:00:00 2001 From: leo-git Date: Tue, 18 Jul 2023 10:30:27 +0200 Subject: [PATCH 4/5] add variable comments - add control directory 'out' I added comments to identify the variables used in the scripts. I added the 'if' construct to check the './out' folder. Signed-off-by: leo-git --- script/generate_dat.sh | 16 ++++++++++++++-- script/plot_results.sh | 2 +- script/run_rand_batch_test.sh | 5 +++-- script/utils/aggregate_rand_batch_test.sh | 1 + 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/script/generate_dat.sh b/script/generate_dat.sh index 31c0c47..50c8060 100755 --- a/script/generate_dat.sh +++ b/script/generate_dat.sh @@ -2,6 +2,7 @@ # $1 confing_test # $2 confing_machine +# $3 confing_thread @@ -44,9 +45,20 @@ FOLDER="batch_res_${LOWER_RANGE_CS}_${UPPER_RANGE_CS}_${LOWER_RANGE_NCS}_${UPPER SRC_FOLDER="../out/${MACHINE_NAME}-out-$FOLDER/dat" DST_FOLDER="../out/${MACHINE_NAME}-out-$FOLDER/dat-aggregated" -if [ ! -d ../out ]; then + +# if './out' directory exists remove it and run './utils/aggregate_rand_batch_test.sh' +# if './out' directory does not exist run './utils/aggregate_rand_batch_test.sh' +# '../out' because when executing 'generate_dat.sh' we are in the directory 'lockbench/script/' and 'out' is in 'lockbench/out/' +if [ -d ../out ]; then + echo "The './out' directory exists: removing it." + rm ../out -r + echo "Aggregating data..." + ./utils/aggregate_rand_batch_test.sh $1 $2 $3 + echo "DONE!" +elif [ ! -d ../out ]; then + echo "The './out' directory does not exist." echo "Aggregating data..." - ./utils/aggregate_rand_batch_test.sh $1 $2 + ./utils/aggregate_rand_batch_test.sh $1 $2 $3 echo "DONE!" fi diff --git a/script/plot_results.sh b/script/plot_results.sh index 4704c7b..7064dea 100755 --- a/script/plot_results.sh +++ b/script/plot_results.sh @@ -3,7 +3,7 @@ # $1 confing_test # $2 confing_machine - +# $3 confing_thread source ./$1 source ./$2 diff --git a/script/run_rand_batch_test.sh b/script/run_rand_batch_test.sh index 4d08880..e124969 100755 --- a/script/run_rand_batch_test.sh +++ b/script/run_rand_batch_test.sh @@ -1,7 +1,8 @@ #!/bin/bash -# $1 confing_test -# $2 confing_machine +# $1 confing_machine +# $2 confing_test +# $3 confing_thread MAX_RETRY="5" diff --git a/script/utils/aggregate_rand_batch_test.sh b/script/utils/aggregate_rand_batch_test.sh index 417b02e..d237fa2 100755 --- a/script/utils/aggregate_rand_batch_test.sh +++ b/script/utils/aggregate_rand_batch_test.sh @@ -6,6 +6,7 @@ # $1 confing_test # $2 confing_machine +# $3 confing_thread source ./$1 source ./$2 From af0c3e0511d3e96bd27864dd70ea25a1d3abdb8d Mon Sep 17 00:00:00 2001 From: leo-git Date: Tue, 18 Jul 2023 10:42:00 +0200 Subject: [PATCH 5/5] fix-readme: dependencies and order of parameters I added the dependencies needed to run the project. I corrected the order of the parameters in the script: generate_dat, plot_results Signed-off-by: leo-git --- Readme.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Readme.md b/Readme.md index cb496e2..ec81e9d 100644 --- a/Readme.md +++ b/Readme.md @@ -1,5 +1,12 @@ # Lockbench - A benchmarks suite for evaluating lock implementations +### Dependencies + +Install these software before using Lockbench: + +1. gnuplot +2. texlive-font-utils + ### Build Compile the suite by simply typing make and tests will be ready to run. @@ -21,14 +28,19 @@ It will generate a configuration file in `script/machine_conf/`. Now, you can run standard benchmarks by executing: ```sh -$ ./run_rand_batch_test.sh machine_conf/ tests_conf/ thread_conf/ +$ ./run_rand_batch_test.sh machine_conf/ tests_conf/ thread_conf/ ``` ### Plotting results Obtaining plots resuming the benchmark results is quite straightforward, but it might require some minutes. -1. First aggregate results by executing the following command -`./generate_dat.sh machine_conf/ tests_conf/` -2. Obtain the plots -`./plot_results.sh machine_conf/ tests_conf/` + +1. First aggregate results by executing the following command: +```sh +$ ./generate_dat.sh tests_conf/ machine_conf/ thread_conf/ +``` +2. Obtain the plots: +```sh +$ ./plot_results.sh tests_conf/ machine_conf/ thread_conf/ +``` 3. Find the charts in the `plots` directory