-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlib.sh
More file actions
executable file
·78 lines (67 loc) · 1.91 KB
/
lib.sh
File metadata and controls
executable file
·78 lines (67 loc) · 1.91 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#/bin/bash
set -e
function clean {
baseDir="log_archive"
if [ "$1" != "" ]; then
baseDir=$1
fi
dir="./$baseDir/$(date +%m-%d_%H-%M-%S)/"
echo "moving left-overs to $dir"
mkdir -p "$dir"
mv ./*{Log,Encoded}.txt Shiviz.log ./*.dtrace ./*.gz ./*.output ./*.json output.txt $2 \
-t "$dir" 2>/dev/null || true
if [ $(find "$dir" -mindepth 1 -maxdepth 1 | wc -l) -eq 0 ]; then
echo "nothing to clean up"
rm -r $dir
else
ln -s -f "$dir" last_run
echo "moved left-overs to $baseDir/last_run"
fi
}
# TODO instrument all function that applies dinv and govec to all arguments
function installDinv {
echo "compile dinv"
go install bitbucket.org/bestchai/dinv
}
# first argument to runLogMerger ($1) is passed to dinv
# ex: use to specify merging strategy: runLogMerger '-plan SCM -shiviz'
function runLogMerger {
t1=$(date +'%s')
if [ "$1" != "" ]; then
echo "merge logs with extra args '$1'"
fi
dinv -l $1 $2 $3 $4 ./*Encoded.txt ./*Log.txt
# dinv -v -l $1 -name="fruits" -shiviz ./*Encoded.txt ./*Log.txt
echo "logmerger took $(($(date +'%s') - $t1))s to run"
}
function runDaikon {
t1=$(date +'%s')
echo "run daikon"
# redirect output both to output.txt and stdout
for file in ./*.dtrace; do
java daikon.Daikon $file >> output.txt
done
echo "daikon took $(($(date +'%s') - $t1))s to run"
}
case $1 in
"clean" )
clean "$2" "$3"
;;
"installDinv" )
installDinv
;;
"runLogMerger")
runLogMerger "$2"
;;
"runDaikon" )
runDaikon
;;
"" )
echo "available commands"
echo "clean [directory to move left-overs to] [list of extra files to include]"
echo "installDinv"
echo "runLogMerger [extra dinv arguments, i.e. '-plan SCM -shiviz'"
echo "runDaikon"
exit 1
;;
esac