#!/usr/bin/env bash
echo "===== RAM SPEED TEST (LIGHT) ====="

# Small test: 16MB blocks, total 64MB
BLOCK_SIZE=16M
COUNT=4

# Use tmpfs so it actually hits RAM
mkdir -p /mnt/ramdisk
sudo mount -t tmpfs -o size=128M tmpfs /mnt/ramdisk

# Run dd and capture speed
SPEED=$(dd if=/dev/zero of=/mnt/ramdisk/test bs=$BLOCK_SIZE count=$COUNT conv=fdatasync 2>&1 | grep -o '[0-9.]* MB/s')
echo "RAM write speed: $SPEED"

# Clean up
sudo umount /mnt/ramdisk
rmdir /mnt/ramdisk

echo "=========================="
