You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.1 KiB
69 lines
2.1 KiB
#! /bin/bash -u
|
|
# Copyright 2015 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
# This script takes the out.txt, generated by heatmap_generator.py
|
|
# and sorted into a heatmap data file (inst-histo.txt) and then
|
|
# call gnu plot to draw the heat map and the time map.
|
|
# A heat map shows the overall hotness of instructions being executed
|
|
# while the time map shows the hotness of instruction at different time.
|
|
#
|
|
# Usage:
|
|
# ./perf-to-inst-page.sh HEATMAP_TITLE
|
|
# HEATMAP_TITLE: the title to display on the heatmap
|
|
|
|
HEAT_PNG="heat_map.png"
|
|
TIMELINE_PNG="timeline.png"
|
|
HEATMAP_TITLE=$1
|
|
ENABLE_HUGEPAGE=$2
|
|
|
|
heatmap_command="
|
|
set terminal png size 600,450
|
|
set xlabel \"Instruction Virtual Address (MB)\"
|
|
set ylabel \"Sample Occurance\"
|
|
set grid
|
|
|
|
set output \"${HEAT_PNG}\"
|
|
set title \"${HEATMAP_TITLE}\"
|
|
"
|
|
|
|
if [[ "${ENABLE_HUGEPAGE}" = "hugepage" ]]; then
|
|
hugepage_hist="inst-histo-hp.txt"
|
|
smallpage_hist="inst-histo-sp.txt"
|
|
cat out.txt | grep hugepage | awk '{print $3}' \
|
|
| sort -n | uniq -c > "${hugepage_hist}"
|
|
cat out.txt | grep smallpage | awk '{print $3}' \
|
|
| sort -n | uniq -c > "${smallpage_hist}"
|
|
# generate inst heat map
|
|
heatmap_in_hugepage=("'${hugepage_hist}' using \
|
|
(\$2/1024/1024):1 with impulses notitle lt rgb 'red'")
|
|
heatmap_outside_hugepage=("'${smallpage_hist}' using \
|
|
(\$2/1024/1024):1 with impulses notitle lt rgb 'blue'")
|
|
echo "
|
|
${heatmap_command}
|
|
plot ${heatmap_in_hugepage}, ${heatmap_outside_hugepage}
|
|
" | gnuplot
|
|
else
|
|
awk '{print $3}' out.txt | sort -n | uniq -c > inst-histo.txt
|
|
# generate inst heat map
|
|
echo "
|
|
${heatmap_command}
|
|
plot 'inst-histo.txt' using (\$2/1024/1024):1 with impulses notitle
|
|
" | gnuplot
|
|
fi
|
|
|
|
# generate instruction page access timeline
|
|
num=$(awk 'END {print NR+1}' out.txt)
|
|
|
|
echo "
|
|
set terminal png size 600,450
|
|
set xlabel \"time (sec)\"
|
|
set ylabel \"Instruction Virtual Address (MB)\"
|
|
|
|
set output \"${TIMELINE_PNG}\"
|
|
set title \"instruction page accessd timeline\"
|
|
|
|
plot 'out.txt' using (\$0/$num*10):(\$3/1024/1024) with dots notitle
|
|
" | gnuplot
|