# Creating a Time Budget

Minimize CPU usage and jitter in your application by creating a time budget for each task in your application. To create a time budget, you must determine the amount of time required to execute each task and set the rates of the loops accordingly.

4. Use the following formula to target CPU usage at well below 100%: $\text{CPU Usage}\text{}\left(%\right)\text{\hspace{0.17em}}=\text{\hspace{0.17em}}100×\underset{1}{\overset{n}{\sum }}\left[{\mathrm{loop}}_{n}×\left(\frac{\mathrm{duration}}{\mathrm{period}}\right)\right]$. By plugging the numbers from the table into this formula, you can see that the CPU usage in this example is $100×\left(\frac{400}{1,000}+\frac{3,000}{10,000}+\frac{16,000}{30,000}\right)=123%$.
5. To decrease CPU usage, you can increase the period of one or more loops while ensuring that each loop executes at the requested rate. For example, by increasing the period of the monitoring loop to 25,000 µS and increasing the period of the logging loop to 80,000 µS, the theoretical CPU usage becomes $100×\left(\frac{400}{1,000}+\frac{3,000}{25,000}+\frac{16,000}{80,000}\right)=72%$.