On-Chip Intelligent Dynamic Frequency Scaling for Real-Time Systems