CRI ADX  Last Updated: 2024-07-17 10:47 p
Measuring CPU Load

Samples Directory

/CRIWARE/SDK/pc/samples/criatomex/display_cpu_load


Sample Description

When CRI Atom is used in multithread framework, since the server processing is executed in different thread than main tread, it is difficult to measure CPU load of CRI Atom.

CRI Atom has a performance monitoring feature to easily measure the load and execution frequency of the server processing.

The following is a code to use the performance monitoring feature.

/* 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.