Skip to content

Commit

Permalink
Add profile option to net scripts (solana-labs#25624)
Browse files Browse the repository at this point in the history
* add image option to cloud CreateInstaces

* add script to install perf

* add profile option to gce.sh

* add profile option for net.sh start

* Revert "add image option to cloud CreateInstaces"

This reverts commit fd63991.

* remove imageName from gce.sh

* fix for gce.sh

* add comments on permissions setup

* remove profile option for gce.sh

* remove short arg
  • Loading branch information
KirillLykov authored Jun 21, 2022
1 parent 4031a37 commit cd01c1a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions net/gce.sh
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,7 @@ $(
install-libssl-compatability.sh \
install-redis.sh \
install-rsync.sh \
install-perf.sh \
localtime.sh \
network-config.sh \
remove-docker-interface.sh \
Expand Down
10 changes: 9 additions & 1 deletion net/net.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,13 @@ build() {
buildVariant=--debug
fi

if $profileBuild; then
profilerFlags="RUSTFLAGS='-C force-frame-pointers=y -g ${RUSTFLAGS}'"
fi

$MAYBE_DOCKER bash -c "
set -ex
scripts/cargo-install-all.sh farf $buildVariant --validator-only
$profilerFlags scripts/cargo-install-all.sh farf $buildVariant --validator-only
"
)

Expand Down Expand Up @@ -783,6 +787,7 @@ maybeAllowPrivateAddr=""
maybeAccountsDbSkipShrink=""
maybeSkipRequireTower=""
debugBuild=false
profileBuild=false
doBuild=true
gpuMode=auto
netemPartition=""
Expand Down Expand Up @@ -869,6 +874,9 @@ while [[ -n $1 ]]; do
elif [[ $1 = --debug ]]; then
debugBuild=true
shift 1
elif [[ $1 = --profile ]]; then
profileBuild=true
shift 1
elif [[ $1 = --partition ]]; then
netemPartition=$2
shift 2
Expand Down
17 changes: 17 additions & 0 deletions net/scripts/install-perf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
#
# perf setup
#
set -ex

[[ $(uname) = Linux ]] || exit 1
[[ $USER = root ]] || exit 1

# install perf
apt-get --assume-yes install linux-tools-common linux-tools-generic "linux-tools-$(uname -r)"

# setup permissions
# Impose no scope and access restrictions on using perf_events performance monitoring
echo -1 | tee /proc/sys/kernel/perf_event_paranoid
# Allow recording kernel reference relocation symbol to avoid skewing symbol resolution if relocation was used
echo 0 | tee /proc/sys/kernel/kptr_restrict

0 comments on commit cd01c1a

Please sign in to comment.