tfcache-comparison

added overwrite argument

11/27/2019 3:39:11 AM

Changes

reduce.sh 13(+9 -4)

Details

reduce.sh 13(+9 -4)

diff --git a/reduce.sh b/reduce.sh
index ed4559b..621828c 100755
--- a/reduce.sh
+++ b/reduce.sh
@@ -4,13 +4,14 @@ source functions.sh
 
 function initialize-output() {
 	reduce="$1"
+	overwrite="$2"
 	if [[ "$reduce" = "*" || "$reduce" = "requests" ]]; then
-		if [[ ! -f  applications/output/requests-handled.csv ]]; then
+		if [[ ! -f  applications/output/requests-handled.csv || "$overwrite" == "overwrite" ]]; then
 			echo 'application,version,users,execution,time,requests' > applications/output/requests-handled.csv
 		fi
 	fi
 	if [[ "$reduce" = "*" || "$reduce" = "cache" ]]; then
-		if [[ ! -f  applications/output/hits-distribution.csv ]]; then
+		if [[ ! -f  applications/output/hits-distribution.csv || "$overwrite" == "overwrite" ]]; then
 			echo 'application,version,users,name,identifier,event,amount' > applications/output/hits-distribution.csv
 		fi
 	fi
@@ -27,6 +28,7 @@ host="localhost"
 versions="uncached developers aplcache memoizeit"
 applications="*"
 reduce="*"
+overwrite="false"
 if [[ ! -z $1 ]]; then
 	host=$1
 	if [[ ! -z $2 ]]; then
@@ -35,15 +37,18 @@ if [[ ! -z $1 ]]; then
 			applications=$3
 			if [[ ! -z $4 ]]; then
 				reduce=$4
+				if [[ ! -z $5 ]]; then
+					overwrite=$5
+				fi
 			fi
 		fi
 	fi
 fi
 
 if [[ $host = "localhost" ]]; then
-	initialize-output "$reduce"
+	initialize-output "$reduce" "$overwrite"
 else
-	initialize-output "requests"
+	initialize-output "requests" "$overwrite"
 	command="bash reduce.sh localhost \"$versions\" \"$applications\" cache"
 	execute "$host" "$command"
 fi