CRI ADX  Last Updated: 2025-05-07 13:34 p
Measuring CPU Load

Sample directory

/cri/pc/samples/criatomex/display_cpu_load

Data used in the sample

/cri/common/smpdata/criatomex/
  • SampleProject.acf
  • AtomCueSheet.avb
  • AtomCueSheet.awb

Sample description

When using CRI Atom in a multi-threaded framework, the server process runs in a separate thread from the main thread, making it difficult to measure the CPU load of CRI Atom.


CRI Atom has a performance monitor function that allows you to easily measure the load and execution interval of the server process.
/* Initialize the library */
criAtomEx_Initialize(NULL, NULL, 0);
/* Add performance monitoring feature */
/* Reset performance monitor */
for(;;) {
/* Wait for V-synchronization */
criFwSys_WaitVsync();
/* Execute server processing */
/* Get performance information */
}
/* Detach performance monitoring */
/* Finalize the library */
void criAtomEx_Finalize(void)
Finalize the library.
CriBool criAtomEx_Initialize(const CriAtomExConfig *config, void *work, CriSint32 work_size)
Initialize the library.
#define criAtomEx_DetachPerformanceMonitor()
Remove the performance monitor.
Definition: cri_le_atom_ex.h:408
void criAtomEx_ExecuteMain(void)
Execute the server processing.
#define criAtomEx_GetPerformanceInfo(p_info)
Get the performance information.
Definition: cri_le_atom_ex.h:431
#define criAtomEx_AttachPerformanceMonitor()
Add the performance monitor.
Definition: cri_le_atom_ex.h:395
#define criAtomEx_ResetPerformanceMonitor()
Reset the performance monitor.
Definition: cri_le_atom_ex.h:420
Performance information.
Definition: cri_le_atom.h:872


  • Behavior of the performance monitor
    Performance monitor accumulates elapsed time and the time taken by server processing each time server processing is executed, and calculates average based on the number of execution of server processing.
    In addition, it holds each peak value. Each value can be retrieved by the criAtomEx_GetPerformanceInfo function.

  • Initializing the performance monitor
    If you want to initialize information in the performance monitor, call the criAtomEx_ResetPerformanceMonitor function to reset performance statistic stored in the monitor.

It can be used when you want to measure the load of the server processing at certain timing, or it also help you troubleshoot problems such as instability of server activity frequency.