Restructure scripts and add flamegraph generator
This commit is contained in:
parent
b649180def
commit
3c364134ec
@ -14,7 +14,7 @@ script:
|
||||
- cargo install xargo || echo "Skipping xargo install"
|
||||
- cargo install hyperfine || echo "Skipping hyperfine install"
|
||||
- ./prepare_libcore.sh
|
||||
- ./build.sh
|
||||
- ./test.sh
|
||||
|
||||
env:
|
||||
- RUST_BACKTRACE=1
|
||||
|
23
config.sh
Normal file
23
config.sh
Normal file
@ -0,0 +1,23 @@
|
||||
set -e
|
||||
|
||||
unamestr=`uname`
|
||||
if [[ "$unamestr" == 'Linux' ]]; then
|
||||
dylib_ext='so'
|
||||
elif [[ "$unamestr" == 'Darwin' ]]; then
|
||||
dylib_ext='dylib'
|
||||
else
|
||||
echo "Unsupported os"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$1" == "--release" ]]; then
|
||||
channel='release'
|
||||
cargo build --release
|
||||
else
|
||||
channel='debug'
|
||||
cargo build
|
||||
fi
|
||||
|
||||
export RUSTFLAGS='-Zalways-encode-mir -Cpanic=abort -Zcodegen-backend='$(pwd)'/target/'$channel'/librustc_codegen_cranelift.'$dylib_ext
|
||||
export XARGO_RUST_SRC=$(pwd)'/target/libcore/src'
|
||||
RUSTC="rustc $RUSTFLAGS -L crate=target/out --out-dir target/out"
|
11
flamegraph.sh
Executable file
11
flamegraph.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
source config.sh
|
||||
|
||||
# These files grow really big (~1.4G) because of the sample frequency
|
||||
rm perf.data* || true
|
||||
|
||||
# Profile compiling libcore
|
||||
perf record -F 9000 --call-graph dwarf -- $RUSTC --crate-type lib target/libcore/src/libcore/lib.rs --crate-name core
|
||||
|
||||
# Generate the flamegraph
|
||||
perf script | ../FlameGraph/stackcollapse-perf.pl | grep cranelift | ../FlameGraph/flamegraph.pl > abc.svg
|
@ -17,7 +17,7 @@ pushd $DST_DIR
|
||||
git init
|
||||
git add .
|
||||
git commit -m "Initial commit" -q
|
||||
git apply ../../000*.patch
|
||||
git apply ../../patches/*.patch
|
||||
popd
|
||||
|
||||
# `alloc_system` has been merged with libstd, which doesn't build yet.
|
||||
|
@ -173,6 +173,11 @@ impl CodegenBackend for CraneliftCodegenBackend {
|
||||
|
||||
let mut flags_builder = settings::builder();
|
||||
flags_builder.enable("is_pic").unwrap();
|
||||
flags_builder.set("enable_verifier", if cfg!(debug_assertions) {
|
||||
"true"
|
||||
} else {
|
||||
"false"
|
||||
}).unwrap();
|
||||
|
||||
use rustc::session::config::OptLevel;
|
||||
match tcx.sess.opts.optimize {
|
||||
|
@ -1,34 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
unamestr=`uname`
|
||||
if [[ "$unamestr" == 'Linux' ]]; then
|
||||
dylib_ext='so'
|
||||
elif [[ "$unamestr" == 'Darwin' ]]; then
|
||||
dylib_ext='dylib'
|
||||
else
|
||||
echo "Unsupported os"
|
||||
exit 1
|
||||
fi
|
||||
source config.sh
|
||||
|
||||
build_example_bin() {
|
||||
$RUSTC $2 --crate-name $1 --crate-type bin
|
||||
sh -c ./target/out/$1 || true
|
||||
}
|
||||
|
||||
if [[ "$1" == "--release" ]]; then
|
||||
channel='release'
|
||||
cargo build --release
|
||||
else
|
||||
channel='debug'
|
||||
cargo build
|
||||
fi
|
||||
|
||||
export RUSTFLAGS='-Zalways-encode-mir -Cpanic=abort -Zcodegen-backend='$(pwd)'/target/'$channel'/librustc_codegen_cranelift.'$dylib_ext
|
||||
export XARGO_RUST_SRC=$(pwd)'/target/libcore/src'
|
||||
RUSTC="rustc $RUSTFLAGS -L crate=target/out --out-dir target/out"
|
||||
|
||||
rm -r target/out || true
|
||||
mkdir -p target/out/clif
|
||||
|
Loading…
x
Reference in New Issue
Block a user