I’m working on a project right now that requires certain behavior when in case the system starts spinning out of control. Specifically, if the CPU the system is on hits 90% for more than 5 minutes in a row or if we run out of RAM for 5 minutes, we need to take certain actions.
The question I’m addressing in this post is not how to detect CPU utilization or Memory usage in C#… it’s how to load up your system so you can actually hit 100% CPU or use up all the RAM.
You could write a program that does it, but it turns out there’s already a tool for it. The CONSUME command in Windows will allow you to load your system the way you want.
Using the command, you can spool up your CPU utilization so you can test your program. It’s really slick.