#!/bin/bash

# Simple CPU monitoring script
echo "🖥️  Monitoring CPU usage during Docker build..."
echo "💻 System: i7-4790K (4 cores / 8 threads)"
echo "📊 Target: 80-90% CPU utilization"
echo ""

while true; do
    # Get CPU usage
    cpu_usage=$(top -bn1 | grep "Cpu(s)" | awk '{print $2}' | cut -d'%' -f1)
    
    # Get memory usage  
    mem_usage=$(free | grep Mem | awk '{printf "%.1f", $3/$2 * 100.0}')
    
    # Get Docker processes count
    docker_procs=$(ps aux | grep -c docker)
    
    # Clear line and print status
    printf "\r🔄 CPU: %s%% | RAM: %s%% | Docker processes: %d " "$cpu_usage" "$mem_usage" "$docker_procs"
    
    sleep 2
done
