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

Side by Side Diff: tools/run-perf.sh

Issue 1776853003: Add Linux perf profiling wrapper script. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: No "benchmark" in run message. Created 4 years, 9 months 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
« no previous file with comments | « no previous file | 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
(Empty)
1 #! /bin/sh
2 #
3 # Copyright 2016 the V8 project authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6 #
7
8 ########## Global variable definitions
9
10 # Ensure that <your CPU clock> / $SAMPLE_EVERY_N_CYCLES < $MAXIMUM_SAMPLE_RATE.
11 MAXIMUM_SAMPLE_RATE=10000000
12 SAMPLE_EVERY_N_CYCLES=10000
13 SAMPLE_RATE_CONFIG_FILE="/proc/sys/kernel/perf_event_max_sample_rate"
14 KERNEL_MAP_CONFIG_FILE="/proc/sys/kernel/kptr_restrict"
15 CALL_GRAPH_METHOD="fp" # dwarf does not play nice with JITted objects.
16
17 ########## Usage
18
19 usage() {
20 cat << EOF
21 usage: $0 <benchmark_command>
22
23 Executes <benchmark_command> under observation by Linux perf.
24 Sampling event is cycles in user space, call graphs are recorded.
25 EOF
26 }
27
28 if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
29 usage
30 exit 1
31 fi
32
33 ########## Actual script execution
34
35 ACTUAL_SAMPLE_RATE=$(cat $SAMPLE_RATE_CONFIG_FILE)
36 if [ "$ACTUAL_SAMPLE_RATE" -lt "$MAXIMUM_SAMPLE_RATE" ] ; then
37 echo "Setting appropriate maximum sample rate..."
38 echo $MAXIMUM_SAMPLE_RATE | sudo tee $SAMPLE_RATE_CONFIG_FILE
39 fi
40
41 ACTUAL_KERNEL_MAP_RESTRICTION=$(cat $KERNEL_MAP_CONFIG_FILE)
42 if [ "$ACTUAL_KERNEL_MAP_RESTRICTION" -ne "0" ] ; then
43 echo "Disabling kernel address map restriction..."
44 echo 0 | sudo tee $KERNEL_MAP_CONFIG_FILE
45 fi
46
47 echo "Running..."
48 perf record -R \
49 -e cycles:u \
50 -c $SAMPLE_EVERY_N_CYCLES \
51 --call-graph $CALL_GRAPH_METHOD \
52 -i $@ --perf_basic_prof
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698