-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmark-htrace.sh
More file actions
69 lines (53 loc) · 2.38 KB
/
benchmark-htrace.sh
File metadata and controls
69 lines (53 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
# Benchmark script to compare performance with/without hierarchical trace
EMU="./build/Release/xtensa-emu.exe"
FIRMWARE="C:/Users/26200.7462/cyd-emulator/test-firmware/10-freertos-minimal/build/freertos-minimal-test.bin"
ELF="C:/Users/26200.7462/cyd-emulator/test-firmware/10-freertos-minimal/build/freertos-minimal-test.elf"
echo "=========================================="
echo "Hierarchical Trace Performance Benchmark"
echo "=========================================="
echo ""
# Test configurations
CYCLES_SHORT=10000000 # 10M cycles
CYCLES_MEDIUM=50000000 # 50M cycles
CYCLES_LONG=100000000 # 100M cycles
echo "Test 1: 10M cycles (short test)"
echo "--------------------------------"
echo -n "WITHOUT hierarchical trace: "
time_output=$( { time $EMU -q -s "$ELF" -c $CYCLES_SHORT "$FIRMWARE" > /dev/null 2>&1; } 2>&1 )
echo "$time_output" | grep real
echo -n "WITH hierarchical trace: "
time_output=$( { time $EMU -H -q -s "$ELF" -c $CYCLES_SHORT "$FIRMWARE" > /dev/null 2>&1; } 2>&1 )
echo "$time_output" | grep real
echo ""
echo "Test 2: 50M cycles (medium test)"
echo "---------------------------------"
echo -n "WITHOUT hierarchical trace: "
time_output=$( { time $EMU -q -s "$ELF" -c $CYCLES_MEDIUM "$FIRMWARE" > /dev/null 2>&1; } 2>&1 )
echo "$time_output" | grep real
echo -n "WITH hierarchical trace: "
time_output=$( { time $EMU -H -q -s "$ELF" -c $CYCLES_MEDIUM "$FIRMWARE" > /dev/null 2>&1; } 2>&1 )
echo "$time_output" | grep real
echo ""
echo "Test 3: 100M cycles (long test)"
echo "--------------------------------"
echo -n "WITHOUT hierarchical trace: "
time_output=$( { time $EMU -q -s "$ELF" -c $CYCLES_LONG "$FIRMWARE" > /dev/null 2>&1; } 2>&1 )
echo "$time_output" | grep real
echo -n "WITH hierarchical trace: "
time_output=$( { time $EMU -H -q -s "$ELF" -c $CYCLES_LONG "$FIRMWARE" > /dev/null 2>&1; } 2>&1 )
echo "$time_output" | grep real
echo ""
echo "=========================================="
echo "Memory usage test"
echo "=========================================="
echo ""
# Run a brief test with -H to show memory statistics
echo "Running with hierarchical trace to measure memory usage..."
$EMU -H -q -s "$ELF" -c 1000000 "$FIRMWARE" 2>&1 | grep -A 20 "HIERARCHICAL TRACE"
echo ""
echo "Memory calculation:"
echo " Entry size: 24 bytes"
echo " Entries per level: 65536"
echo " Levels: 16"
echo " Total: 24 * 65536 * 16 = 25,165,824 bytes (~24 MB)"