gb.getCpuLoad

Description

uint8_t gb.getCpuLoad()

gb.getCpuLoad returns the current load of the CPU in percent. So, if it returns 50, that means it took 50% of the time it had to create a frame. CPU usage above 100% means that your game is running at a slower framerate than set.

Parameters

none

Returns

uint8_t: percentage of CPU usage

Example

#include <Gamebuino-Meta.h>

void setup() { gb.begin(); }

void loop() { while(!gb.update()); gb.display.clear();

// here we fetch the CPU usage percentage uint8_t load = gb.getCpuLoad(); gb.display.print("CPU:"); gb.display.print(load); gb.display.println("%"); }