-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmem-catch
More file actions
executable file
·45 lines (37 loc) · 1.01 KB
/
mem-catch
File metadata and controls
executable file
·45 lines (37 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
if [ -z "$1" ] || [ -z "$2" ]
then
echo "$0 <text file> <pattern file>"
exit
fi
textFile=$1
patternFile=$2
declare -a implementations=(
"-p h -n 0 -e 0"
"-p s -n 0 -e 0"
"-p n -n 0 -e 0"
"-p p -n 1 -e 0"
"-p p -n 2 -e 0"
"-p p -n 3 -e 0"
"-p p -n 4 -e 0"
"-p m -n 0 -e 0"
"-p m -n 0 -e 1"
"-p m -n 0 -e 2"
# "-p m -n 0 -e 3"
# "-p m -n 0 -e 4"
# "-p m -n 0 -e 5"
)
RootDir=data
mkdir -p $RootDir
while read line_content; do
for p in "${implementations[@]}"
do
output=$(valgrind ./pattern-matching -i $textFile $p -t $line_content -s 2>&1 >/dev/null | grep -P 'total heap usage' | awk '{print $9}' | sed 's/,//g')
numOfCharsFile=$(wc -c $textFile | awk '{print $1}')
numOfCharsPattern=${#line_content}
execArgs=$(echo "$p" | awk '{print $4" "$6}')
Implementation=$(echo "$p" | awk '{print $2}')
memory=$output
echo "$Implementation $numOfCharsFile $numOfCharsPattern" $memory "$execArgs">> "$RootDir/""mem.txt"
done
done < $patternFile