Resources | Resources |



Stress CPU utility

Stress CPU is a stress testing utility application. Stress CPU hogs the available CPU cycles from a minimum to a maximum amount according to the setting on the control. Stress CPU continues to run if applications are launched on top of it.


The Simulator screen displays a meter control that allows the user to set the desired amount of CPU hogging. Drag the indicator to the desired level of hogging. The application can also be configured with an .ini file.

Command-line parameters

Stress CPU takes a single command-line parameter, a number from 0 through 100, corresponding to the amount of available CPU to hog.


To run the c_basicapp sample code, you need the following:

  • Brew MP 1.0 SDK rev 7.11.1 or higher
  • Brew MP-enabled device or a Simulator target
  • Installed copy of Sample Code from the SDK Manager

Sample code location



Run application


Sample code installation folder

  • Open the stresscpu.sln in Visual Studio.
  • Compile the applet.
  • Click the Click2Run icon.

Event handling

Stress CPU is designed to run as a background application and has minimal event handling.


Stress CPU uses a simple algorithm to hog the CPU cycles that are available to the user. Unlike Stress File, Stress CPU does not measure or meter the full system CPU usage, only the available CPU usage.
void DrawTick(void *pThis)
   StressCPU* pMe = (StressCPU*)pThis;
   uint32 iStart = GETUPTIMEMS();
   uint32 iEnd = iStart;
   int iTimes = 2;
   ISHELL_SetTimer(pMe->applet.m_pIShell, 100, (PFNNOTIFY)DrawTick, pMe);

   while ((iEnd - iStart) < pMe->m_iHogPercent)
      iEnd = GETUPTIMEMS();
      iTimes *= 2;

Error handling

The application uses the following macros for error handling.

#define ERR_CATCH        __errcatch

#define ERR_TRY(x)  do{nErr = (x); if(AEE_SUCCESS != nErr) goto ERR_CATCH;} while(0)
#define ERR_THROW(e) do { nErr = (e); goto ERR_CATCH; } while(0)
#define ERR_CHECK_PTR(p)      if (NULL == p) ERR_THROW(AEE_EFAILED);