mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-07-12 18:19:42 -07:00
FASE 1: Switch ZRAM to zstd, disable zswap
- ZRAM compression: lzo-rle → zstd (better 1:3 ratio vs 1:2.5, saves ~50MB more RAM on 512MB ZRAM at cost of slightly more CPU) - Add zswap.enabled=0 to kernel cmdline (zswap intercepts before ZRAM, preventing efficient compressed swap) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
KERNEL_MAKE_EXTRACMD=" $(get_kernel_make_extracmd)"
|
||||
|
||||
# Kernel cmdline
|
||||
EXTRA_CMDLINE="quiet console=ttyS2,1500000 console=tty0 loglevel=0 vt.global_cursor_default=0 consoleblank=0 net.ifnames=0 systemd.show_status=false mitigations=off audit=0 nowatchdog threadirqs loop.max_loop=16"
|
||||
EXTRA_CMDLINE="quiet console=ttyS2,1500000 console=tty0 loglevel=0 vt.global_cursor_default=0 consoleblank=0 net.ifnames=0 systemd.show_status=false mitigations=off audit=0 nowatchdog threadirqs zswap.enabled=0 loop.max_loop=16"
|
||||
|
||||
# Bootloader to use (syslinux / u-boot)
|
||||
BOOTLOADER="u-boot"
|
||||
@@ -76,7 +76,7 @@
|
||||
DEBUG_TTY="/dev/ttyS2"
|
||||
|
||||
# ZRAM Algorithm
|
||||
ZRAM_COMPRESSION_ALGO="lzo-rle"
|
||||
ZRAM_COMPRESSION_ALGO="zstd"
|
||||
|
||||
# ZRAM Size
|
||||
ZRAM_SWAP_SIZE="512"
|
||||
|
||||
Executable
+103
@@ -0,0 +1,103 @@
|
||||
#!/bin/bash
|
||||
# ArchR Performance Benchmark Script
|
||||
# Run on device: bash /flash/bench.sh <scenario> [duration_seconds]
|
||||
# Results saved to /storage/bench-results/
|
||||
|
||||
DURATION=${2:-60}
|
||||
RESULTS_DIR="/storage/bench-results/$(date +%Y%m%d-%H%M%S)-${1:-general}"
|
||||
mkdir -p "$RESULTS_DIR"
|
||||
|
||||
echo "========================================"
|
||||
echo " ArchR Benchmark: ${1:-general}"
|
||||
echo " Duration: ${DURATION}s"
|
||||
echo " Output: $RESULTS_DIR"
|
||||
echo "========================================"
|
||||
|
||||
# Metadata
|
||||
cat > "$RESULTS_DIR/meta.json" << METAEOF
|
||||
{
|
||||
"timestamp": "$(date -Iseconds)",
|
||||
"kernel": "$(uname -r)",
|
||||
"distro": "$(grep ^NAME /etc/os-release | cut -d= -f2)",
|
||||
"cpu_governor": "$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null)",
|
||||
"gpu_governor": "$(cat /sys/class/devfreq/ff400000.gpu/governor 2>/dev/null)",
|
||||
"dmc_governor": "$(cat /sys/class/devfreq/dmc/governor 2>/dev/null)",
|
||||
"mem_available_kb": $(grep MemAvailable /proc/meminfo | awk '{print $2}'),
|
||||
"cma_total_kb": $(grep CmaTotal /proc/meminfo | awk '{print $2}'),
|
||||
"cma_free_kb": $(grep CmaFree /proc/meminfo | awk '{print $2}'),
|
||||
"zram_algo": "$(cat /sys/block/zram0/comp_algorithm 2>/dev/null | tr -d '[]')",
|
||||
"swap": "$(swapon --show --noheadings 2>/dev/null | head -1)",
|
||||
"swappiness": $(sysctl -n vm.swappiness 2>/dev/null),
|
||||
"vfs_cache_pressure": $(sysctl -n vm.vfs_cache_pressure 2>/dev/null),
|
||||
"temperature_start": $(cat /sys/class/thermal/thermal_zone0/temp 2>/dev/null),
|
||||
"sd_model": "$(cat /sys/block/mmcblk0/device/name 2>/dev/null)",
|
||||
"scenario": "${1:-general}"
|
||||
}
|
||||
METAEOF
|
||||
|
||||
# PSI monitoring (background)
|
||||
echo "Starting PSI monitoring..."
|
||||
(
|
||||
while true; do
|
||||
echo "$(date +%s.%N) $(cat /proc/pressure/cpu 2>/dev/null | head -1) $(cat /proc/pressure/memory 2>/dev/null | head -1) $(cat /proc/pressure/io 2>/dev/null | head -1)"
|
||||
sleep 1
|
||||
done
|
||||
) > "$RESULTS_DIR/psi.log" &
|
||||
PSI_PID=$!
|
||||
|
||||
# Frequency + temperature monitoring (background)
|
||||
echo "Starting freq/temp monitoring..."
|
||||
(
|
||||
while true; do
|
||||
CPU_FREQ=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq 2>/dev/null)
|
||||
GPU_FREQ=$(cat /sys/class/devfreq/ff400000.gpu/cur_freq 2>/dev/null)
|
||||
DMC_FREQ=$(cat /sys/class/devfreq/dmc/cur_freq 2>/dev/null)
|
||||
TEMP=$(cat /sys/class/thermal/thermal_zone0/temp 2>/dev/null)
|
||||
MEM=$(grep MemAvailable /proc/meminfo | awk '{print $2}')
|
||||
echo "$(date +%s.%N) cpu=$CPU_FREQ gpu=$GPU_FREQ dmc=$DMC_FREQ temp=$TEMP mem=$MEM"
|
||||
sleep 1
|
||||
done
|
||||
) > "$RESULTS_DIR/freq-therm.log" &
|
||||
FREQ_PID=$!
|
||||
|
||||
# vmstat monitoring
|
||||
vmstat 1 $DURATION > "$RESULTS_DIR/vmstat.log" &
|
||||
VMSTAT_PID=$!
|
||||
|
||||
# dmesg monitoring
|
||||
dmesg -w > "$RESULTS_DIR/dmesg.log" 2>/dev/null &
|
||||
DMESG_PID=$!
|
||||
|
||||
echo ""
|
||||
echo "Monitors running. Now launch your game/emulator."
|
||||
echo "Press Ctrl+C after ${DURATION}s or when done testing."
|
||||
echo ""
|
||||
|
||||
# Wait
|
||||
sleep $DURATION 2>/dev/null || true
|
||||
|
||||
# Cleanup
|
||||
kill $PSI_PID $FREQ_PID $VMSTAT_PID $DMESG_PID 2>/dev/null
|
||||
wait 2>/dev/null
|
||||
|
||||
# Generate summary
|
||||
TEMP_END=$(cat /sys/class/thermal/thermal_zone0/temp 2>/dev/null)
|
||||
MEM_END=$(grep MemAvailable /proc/meminfo | awk '{print $2}')
|
||||
|
||||
cat > "$RESULTS_DIR/summary.json" << SUMEOF
|
||||
{
|
||||
"duration_s": $DURATION,
|
||||
"temperature_end": $TEMP_END,
|
||||
"mem_available_end_kb": $MEM_END,
|
||||
"psi_samples": $(wc -l < "$RESULTS_DIR/psi.log"),
|
||||
"freq_samples": $(wc -l < "$RESULTS_DIR/freq-therm.log")
|
||||
}
|
||||
SUMEOF
|
||||
|
||||
echo ""
|
||||
echo "========================================"
|
||||
echo " Benchmark complete!"
|
||||
echo " Results: $RESULTS_DIR"
|
||||
echo " Files: $(ls $RESULTS_DIR | wc -l)"
|
||||
echo "========================================"
|
||||
ls -lh "$RESULTS_DIR"
|
||||
Reference in New Issue
Block a user