You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/06/03 13:02:21 UTC
[avro] branch rust-improve-cpu-and-memory-usage updated: Add a build.sh task for CPU profiling
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch rust-improve-cpu-and-memory-usage
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/rust-improve-cpu-and-memory-usage by this push:
new 1c40fda5b Add a build.sh task for CPU profiling
1c40fda5b is described below
commit 1c40fda5bc33850b387522c763d7dfe22487b323
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Fri Jun 3 15:56:29 2022 +0300
Add a build.sh task for CPU profiling
Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
---
lang/rust/build.sh | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/lang/rust/build.sh b/lang/rust/build.sh
index 3a20e07ac..0a9aa895b 100755
--- a/lang/rust/build.sh
+++ b/lang/rust/build.sh
@@ -69,16 +69,26 @@ do
cargo run --example test_interop_single_object_encoding
;;
profile-heap)
- echo "Heap memory profiling using KDE heaptrack tool"
- EXAMPLE_APP=$2
- EXAMPLE_APP=${EXAMPLE_APP:-"benchmark"}
- echo $EXAMPLE_APP
+ echo "Heap memory profiling with https://github.com/KDE/heaptrack"
+ EXAMPLE_APP=${2:-"benchmark"}
RUSTFLAGS=-g cargo build --release --example $EXAMPLE_APP
- rm -rf heaptrack.${EXAMPLE_APP}.*
+ rm -f heaptrack.${EXAMPLE_APP}.*
heaptrack ./target/release/examples/$EXAMPLE_APP
heaptrack --analyze heaptrack.${EXAMPLE_APP}.*
exit
;;
+ profile-cpu)
+ echo "CPU profiling with perf and https://github.com/KDAB/hotspot"
+ EXAMPLE_APP=${2:-"benchmark"}
+ RUSTFLAGS=-g cargo build --release --example $EXAMPLE_APP
+ NOW=$(date +%y%m%d%H%M%S)
+ DATA_FILE=perf-${EXAMPLE_APP}-${NOW}.data
+ # sudo sysctl kernel.perf_event_paranoid=-1
+ # sudo sysctl kernel.kptr_restrict=0
+ perf record --call-graph=dwarf --output=$DATA_FILE ./target/release/examples/$EXAMPLE_APP
+ hotspot $DATA_FILE
+ exit
+ ;;
*)
echo "Usage: $0 {lint|test|dist|clean|interop-data-generate|interop-data-test|profile-heap}" >&2
exit 1