Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: tools/run-llprof.sh

Issue 11444031: llprof improvements (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/ll_prof.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/run-llprof.sh
diff --git a/tools/check-static-initializers.sh b/tools/run-llprof.sh
similarity index 57%
copy from tools/check-static-initializers.sh
copy to tools/run-llprof.sh
index 1103a9778775dc86e8b59ee4f804670192533f70..d526170d1fab95798ce7380e1fcd87689e5b52cb 100755
--- a/tools/check-static-initializers.sh
+++ b/tools/run-llprof.sh
@@ -1,4 +1,5 @@
-#!/bin/bash
+#!/bin/sh
+#
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
@@ -26,38 +27,43 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Checks that the number of compilation units having at least one static
-# initializer in d8 matches the one defined below.
-# Note that the project must be built with SCons before running this script.
+########## Global variable definitions
-# Allow:
-# - _GLOBAL__I__ZN2v810LineEditor6first_E
-# - _GLOBAL__I__ZN2v88internal32AtomicOps_Internalx86CPUFeaturesE
-# - _GLOBAL__I__ZN2v88internal8ThreadId18highest_thread_id_E
-expected_static_init_count=3
+# Ensure that <your CPU clock> / $SAMPLE_EVERY_N_CYCLES < $MAXIMUM_SAMPLE_RATE.
+MAXIMUM_SAMPLE_RATE=10000000
+SAMPLE_EVERY_N_CYCLES=10000
+SAMPLE_RATE_CONFIG_FILE="/proc/sys/kernel/perf_event_max_sample_rate"
+KERNEL_MAP_CONFIG_FILE="/proc/sys/kernel/kptr_restrict"
-v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../)
+########## Usage
-if [ -n "$1" ] ; then
- d8="${v8_root}/$1"
-else
- d8="${v8_root}/d8"
-fi
+usage() {
+cat << EOF
+usage: $0 <benchmark_command>
+
+Executes <benchmark_command> under observation by the kernel's "perf" \
+framework, then calls the low level tick processor to analyze the results.
+EOF
+}
-if [ ! -f "$d8" ]; then
- echo "d8 binary not found: $d8"
+if [ $# -eq 0 ] || [ "$1" == "-h" ] || [ "$1" == "--help" ] ; then
+ usage
exit 1
fi
-static_inits=$(nm "$d8" | grep _GLOBAL_ | grep _I_ | awk '{ print $NF; }')
+########## Actual script execution
-static_init_count=$(echo "$static_inits" | wc -l)
+ACTUAL_SAMPLE_RATE=$(cat $SAMPLE_RATE_CONFIG_FILE)
+if [ "$ACTUAL_SAMPLE_RATE" -lt "$MAXIMUM_SAMPLE_RATE" ] ; then
+ echo "Setting appropriate maximum sample rate..."
+ echo $MAXIMUM_SAMPLE_RATE | sudo tee $SAMPLE_RATE_CONFIG_FILE
+fi
-if [ $static_init_count -gt $expected_static_init_count ]; then
- echo "Too many static initializers."
- echo "$static_inits"
- exit 1
-else
- echo "Static initializer check passed ($static_init_count initializers)."
- exit 0
+ACTUAL_KERNEL_MAP_RESTRICTION=$(cat $KERNEL_MAP_CONFIG_FILE)
+if [ "$ACTUAL_KERNEL_MAP_RESTRICTION" -ne "0" ] ; then
+ echo "Disabling kernel address map restriction..."
+ echo 0 | sudo tee $KERNEL_MAP_CONFIG_FILE
fi
+
+echo "Running benchmark..."
+perf record -R -e cycles -c $SAMPLE_EVERY_N_CYCLES -f -i $@ --ll-prof
« no previous file with comments | « tools/ll_prof.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698