-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinflatsim
More file actions
executable file
·65 lines (60 loc) · 1.44 KB
/
inflatsim
File metadata and controls
executable file
·65 lines (60 loc) · 1.44 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
#!/usr/bin/env bash
DEFLATE_ROOT=$(dirname $(realpath $0))
DEFLATE=${DEFLATE:=${DEFLATE_ROOT}/simulate}
QEMU_X86_64=${QEMU_X86_64:=qemu-x86_64}
TRACE_FILE=trace.txt
ANALYSIS_FILE=analysis.txt
BT=ideal
usage() {
echo "${0##*/}: decompose the DBT inflation"
echo "Usage: ${0##*/} [-h] [-v] [-f <TRACE_FILE>] [-o <ANALYSIS_FILE>] [-t <BT>] -- <COMMAND>"
echo " -h: show this message"
echo " -v: output verbose analysis"
echo " -f <TRACE_FILE>: the output path for trace file"
echo " default: ${TRACE_FILE}"
echo " -o <ANALYSIS_FILE>: the output path for analysis file"
echo " default: ${ANALYSIS_FILE}"
echo " -t <BT>: binary translator to be simulated"
echo " available: ideal, exagear, rosetta, latx"
echo " default: ${BT}"
exit 1
}
options=$(getopt -o hvfot -- "$@")
[ $? -eq 0 ] || usage
eval set -- "$options"
while true; do
case $1 in
-h)
usage
;;
-v)
VERBOSE=-v
;;
-f)
shift
TRACE_FILE=$1
;;
-o)
shift
ANALYSIS_FILE=$1
;;
-t)
shift
BT=$1
;;
--)
shift
break
;;
esac
shift
done
if [[ -z $1 ]]; then
usage
fi
# instrument
${QEMU_X86_64} -d plugin -D ${TRACE_FILE} -plugin ${DEFLATE_ROOT}/instrument.so "$(command -v $1)" "${@:2}"
${DEFLATE} -f ${TRACE_FILE} -t ideal ${VERBOSE} > ${ANALYSIS_FILE}
echo
echo "Analysis summary:"
tail -n1 ${ANALYSIS_FILE}