title: How can I write a test application to fully load the CPU?
body: <p>The CPU is designed to drop into low power modes whenever it can to save power and keep cool, I'd like to make a program to prevent that from happening. </p>
  
  <p>I'm working on a few different embedded platforms (Freescale Coldfire 8052, TI Sitara AM3359, probably a few others in the pipeworks) and so I wanted to make an application that will just keep the CPU fully loaded for benchmarking. I want to write my own since it would be easier to cross-compile then to look for a solution per target. </p>
  
  <p>My initial thought was just:</p>
  
  <pre><code>while(1);
  </code></pre>
  
  <p><strong>Question 1:</strong><br>
  But at I over simplifing this? top shows that program taking about 99.4% CPU usage, so I guess it's working, but it doesn't seem like it should be so simple. :) Anyone know if there should be more to it than that?</p>
  
  <p><strong>Question 2:</strong><br>If I wanted to expand this to do different loads (say, 50%, 75%, or whatever) how could I do that? I managed to get a 18~20% CPU usage via:</p>
  
  <pre><code>while(1){usleep(1);}
  </code></pre>
  
  <p>Is there a more, scientific way rather than just guessing and checking at sleep values? I would think these would be different per target anyway.</p>