Skip to content

Commit 1282ee7

Browse files
committed
mem props POC
1 parent 2028242 commit 1282ee7

31 files changed

+759
-401
lines changed

bench.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
#!/bin/bash
3+
#
4+
# Copyright (C) 2025 Intel Corporation
5+
#
6+
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
7+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8+
#
9+
10+
# Check if at least one argument is provided
11+
if [ "$#" -lt 1 ]; then
12+
echo "Usage: $0 <application> [args...]"
13+
exit 1
14+
fi
15+
16+
# Variables
17+
APP="$1" # The application to run
18+
shift # Remove the application from the arguments list
19+
ARGS="$@" # Remaining arguments passed to the application
20+
USER="rrudnick" # The user to own the generated perf data
21+
FLAMEGRAPH_DIR="./FlameGraph" # Path to the FlameGraph repository
22+
23+
# Check if FlameGraph repository exists
24+
if [ ! -d "$FLAMEGRAPH_DIR" ]; then
25+
echo "Error: FlameGraph directory not found at $FLAMEGRAPH_DIR."
26+
echo "Clone it using: git clone https://github.com/brendangregg/FlameGraph.git"
27+
exit 1
28+
fi
29+
30+
# Run application under perf
31+
echo "Recording performance data..."
32+
sudo perf record -F 99 -g --call-graph dwarf -- "$APP" $ARGS
33+
34+
# Change ownership of the generated perf data
35+
echo "Changing ownership of perf data..."
36+
sudo chown "$USER" perf.data
37+
38+
# Process perf.data into a readable format
39+
echo "Processing perf data..."
40+
perf script > out.perf
41+
42+
# Generate folded stacks
43+
echo "Generating folded stacks..."
44+
"$FLAMEGRAPH_DIR/stackcollapse-perf.pl" out.perf > out.folded
45+
46+
# Generate the flame graph
47+
echo "Generating flame graph..."
48+
"$FLAMEGRAPH_DIR/flamegraph.pl" out.folded > flamegraph.svg
49+
50+
# Open the flame graph in Firefox
51+
echo "Opening flame graph in Firefox..."
52+
firefox flamegraph.svg &
53+
54+
echo "Done! The flame graph is saved as flamegraph.svg."
55+
56+

0 commit comments

Comments
 (0)