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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/ll_prof.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/sh
2 #
2 # Copyright 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
5 # met: 6 # met:
6 # 7 #
7 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following 11 # copyright notice, this list of conditions and the following
11 # disclaimer in the documentation and/or other materials provided 12 # disclaimer in the documentation and/or other materials provided
12 # with the distribution. 13 # with the distribution.
13 # * Neither the name of Google Inc. nor the names of its 14 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived 15 # contributors may be used to endorse or promote products derived
15 # from this software without specific prior written permission. 16 # from this software without specific prior written permission.
16 # 17 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 29
29 # Checks that the number of compilation units having at least one static 30 ########## Global variable definitions
30 # initializer in d8 matches the one defined below.
31 # Note that the project must be built with SCons before running this script.
32 31
33 # Allow: 32 # Ensure that <your CPU clock> / $SAMPLE_EVERY_N_CYCLES < $MAXIMUM_SAMPLE_RATE.
34 # - _GLOBAL__I__ZN2v810LineEditor6first_E 33 MAXIMUM_SAMPLE_RATE=10000000
35 # - _GLOBAL__I__ZN2v88internal32AtomicOps_Internalx86CPUFeaturesE 34 SAMPLE_EVERY_N_CYCLES=10000
36 # - _GLOBAL__I__ZN2v88internal8ThreadId18highest_thread_id_E 35 SAMPLE_RATE_CONFIG_FILE="/proc/sys/kernel/perf_event_max_sample_rate"
37 expected_static_init_count=3 36 KERNEL_MAP_CONFIG_FILE="/proc/sys/kernel/kptr_restrict"
38 37
39 v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../) 38 ########## Usage
40 39
41 if [ -n "$1" ] ; then 40 usage() {
42 d8="${v8_root}/$1" 41 cat << EOF
43 else 42 usage: $0 <benchmark_command>
44 d8="${v8_root}/d8"
45 fi
46 43
47 if [ ! -f "$d8" ]; then 44 Executes <benchmark_command> under observation by the kernel's "perf" \
48 echo "d8 binary not found: $d8" 45 framework, then calls the low level tick processor to analyze the results.
46 EOF
47 }
48
49 if [ $# -eq 0 ] || [ "$1" == "-h" ] || [ "$1" == "--help" ] ; then
50 usage
49 exit 1 51 exit 1
50 fi 52 fi
51 53
52 static_inits=$(nm "$d8" | grep _GLOBAL_ | grep _I_ | awk '{ print $NF; }') 54 ########## Actual script execution
53 55
54 static_init_count=$(echo "$static_inits" | wc -l) 56 ACTUAL_SAMPLE_RATE=$(cat $SAMPLE_RATE_CONFIG_FILE)
57 if [ "$ACTUAL_SAMPLE_RATE" -lt "$MAXIMUM_SAMPLE_RATE" ] ; then
58 echo "Setting appropriate maximum sample rate..."
59 echo $MAXIMUM_SAMPLE_RATE | sudo tee $SAMPLE_RATE_CONFIG_FILE
60 fi
55 61
56 if [ $static_init_count -gt $expected_static_init_count ]; then 62 ACTUAL_KERNEL_MAP_RESTRICTION=$(cat $KERNEL_MAP_CONFIG_FILE)
57 echo "Too many static initializers." 63 if [ "$ACTUAL_KERNEL_MAP_RESTRICTION" -ne "0" ] ; then
58 echo "$static_inits" 64 echo "Disabling kernel address map restriction..."
59 exit 1 65 echo 0 | sudo tee $KERNEL_MAP_CONFIG_FILE
60 else
61 echo "Static initializer check passed ($static_init_count initializers)."
62 exit 0
63 fi 66 fi
67
68 echo "Running benchmark..."
69 perf record -R -e cycles -c $SAMPLE_EVERY_N_CYCLES -f -i $@ --ll-prof
OLDNEW
« 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