From the course: Visual Studio: Advanced Debugging Tools

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Analyze CPU usage with Diagnostics tools

Analyze CPU usage with Diagnostics tools - Visual Studio Tutorial

From the course: Visual Studio: Advanced Debugging Tools

Start my 1-month free trial

Analyze CPU usage with Diagnostics tools

- [Instructor] Let's start by looking at the code that's going to stress test my CPU. I've got two buttons, one will stress test one core on this eight core machine, and the other one will stress test four cores on this machine. The code itself that actually does the work is these lines of code here. So I've declared this list of ant... And this is the percentage of the core that I want to stress, 90%. And then I call this testing code that I wrote. I'll show you the code in there in a minute. I call that using parallel for each. Now, on this first button click, it's only going to run one instance of this CPU test in parallel, so it's only going to stress one core. Down here, when you click on this other button, I've got four values in here, so it will launch four of those in parallel. And then you pass in which percent of the processor to utilize and how long before the method returns? Now let's go take a look at the…

Contents