forked from gormanm/mmtests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile-disabled-hooks-oprofile.sh
49 lines (42 loc) · 1.46 KB
/
profile-disabled-hooks-oprofile.sh
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
if [ "$SAMPLE_CYCLE_FACTOR" = "" ]; then
SAMPLE_CYCLE_FACTOR=1
fi
CALLGRAPH=
if [ "$OPROFILE_REPORT_CALLGRAPH" != "" ]; then
CALLGRAPH=$OPROFILE_REPORT_CALLGRAPH
CALLGRAPH_SWITCH=--callgraph
if [ $SAMPLE_CYCLE_FACTOR -lt 15 ]; then
SAMPLE_CYCLE_FACTOR=15
fi
fi
# Create profiling hooks
PROFILE_TITLE="timer"
echo "#!/bin/bash" > monitor-pre-hook
case `uname -m` in
i?86)
echo "oprofile_start.sh $CALLGRAPH_SWITCH $CALLGRAPH --sample-cycle-factor $SAMPLE_CYCLE_FACTOR --event timer" >> monitor-pre-hook
export PROFILE_EVENTS=timer
;;
x86_64)
echo "oprofile_start.sh $CALLGRAPH_SWITCH $CALLGRAPH --sample-cycle-factor $SAMPLE_CYCLE_FACTOR --event timer" >> monitor-pre-hook
export PROFILE_EVENTS=timer
;;
ppc64)
echo "oprofile_start.sh $CALLGRAPH_SWITCH $CALLGRAPH --sample-cycle-factor $SAMPLE_CYCLE_FACTOR --event timer" >> monitor-pre-hook
export PROFILE_EVENTS=timer
;;
*)
echo Unrecognised architecture
exit -1
;;
esac
echo "#!/bin/bash" > monitor-post-hook
echo "opcontrol --dump" >> monitor-post-hook
echo "opcontrol --stop" >> monitor-post-hook
echo "oprofile_report.sh > \$1/oprofile-\$2-report-$PROFILE_TITLE.txt" >> monitor-post-hook
echo "#!/bin/bash" > monitor-cleanup-hook
echo "rm \$1/oprofile-\$2-report-$PROFILE_TITLE.txt" >> monitor-cleanup-hook
echo "#!/bin/bash" > monitor-reset
echo "opcontrol --stop > /dev/null 2> /dev/null" >> monitor-reset
echo "opcontrol --deinit > /dev/null 2> /dev/null" >> monitor-reset
chmod u+x monitor-*