forked from arcolife/perf-script-postprocessor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperf_script_processor
More file actions
executable file
·31 lines (27 loc) · 1.1 KB
/
perf_script_processor
File metadata and controls
executable file
·31 lines (27 loc) · 1.1 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
#!/bin/bash
# usage: $ ./perf_script_process.sh <dir where perf.data exists>
# $DUMP_PATH='/tmp/pp_results/'
DUMP_PATH=$1
# run perf script, grep for qemu-kvm (this can be adjusted)
# then get the timestamp and metric fields, clean them and
# dump the data in a csv file
if [[ ! -z $DUMP_PATH ]]; then
if [ -f $DUMP_PATH'/perf.data' ]; then
perf script | grep qemu-kvm | awk -F' ' '{print $4,$5}' | \
sed 's/sched://g' | sed 's/kvm://g' | sed 's/syscall://g' | \
sed 's/://g' | sed 's/ /,/g' > $DUMP_PATH'perf_data.csv'
# add header to csv file
sed -i '1s/^/tstamp,entry\n/' $DUMP_PATH'perf_data.csv'
elif [ -f $DUMP_PATH'/perf_data.csv' ]; then
# run postprocessor on that
delta_processor --input=$DUMP_PATH'/perf_data.csv' --output=$DUMP_PATH #--per_metric=True
# else
# echo "ERROR! Failed to somehow write to intermediate result file perf_data.csv."
# fi
else
echo "ERROR! This path doesn't contain 'perf.data'. I Quit.."
fi
else
echo "ERROR! You need to specify a dir path where perf.data resides"
echo -e "Usage:\t$ ./perf_script_process.sh <dir where perf.data exists>"
fi