---
title: "LVGL: Benchmark"
canonical_url: https://developer.repebble.com/pebbleos/docs/samples/third_party/lvgl/benchmark/
last_updated: 2026-11-21
sdk_version: 4.44
---
# LVGL: Benchmark

Source: https://developer.repebble.com/pebbleos/docs/samples/third_party/lvgl/benchmark/

This sample runs the benchmark demo that comes with [LVGL](https://developer.repebble.com/pebbleos/docs/third_party/lvgl.md): a series of scenes, from an empty screen to rotated images and a screen full of widgets, each measured for a few seconds. When the last one ends it prints the frame rate, the CPU load and the render and flush times of each scene, and their averages.

It takes about a minute.

Run:

`pbl samples samples/third_party/lvgl/benchmark`

Boards:

every board

## Sources

src/main.c

```
#include \<stdio.h\>#include \<pbl/kernel/delay.h\>#include \<demos/lv\_demos.h\>#include \<pbl\_lvgl.h\>static bool s\_done;/\* Runs from lv\_timer\_handler(), after the last scene. \*/static void prv\_end(const lv\_demo\_benchmark\_summary\_t \*summary) {for (const lv\_demo\_benchmark\_scene\_dsc\_t \*scene = summary-\>scenes; scene-\>create\_cb != nullptr;scene++) {if (scene-\>measurement\_cnt == 0U) {continue;}printf("lvgl: %s: %d fps, %d%% CPU, render %d ms, flush %d ms\n", scene-\>name,(int)(scene-\>fps\_avg / scene-\>measurement\_cnt),(int)(scene-\>cpu\_avg\_usage / scene-\>measurement\_cnt),(int)(scene-\>render\_avg\_time / scene-\>measurement\_cnt),(int)(scene-\>flush\_avg\_time / scene-\>measurement\_cnt));}/\* The totals are sums of the averages of the scenes. \*/if (summary-\>valid\_scene\_cnt \> 0) {printf("lvgl: %d scenes: %d fps, %d%% CPU, render %d ms, flush %d ms\n",(int)summary-\>valid\_scene\_cnt, (int)(summary-\>total\_avg\_fps / summary-\>valid\_scene\_cnt),(int)(summary-\>total\_avg\_cpu / summary-\>valid\_scene\_cnt),(int)(summary-\>total\_avg\_render\_time / summary-\>valid\_scene\_cnt),(int)(summary-\>total\_avg\_flush\_time / summary-\>valid\_scene\_cnt));}s\_done = true;}int main(void) {int ret;ret = pbl\_lvgl\_init();if (ret != 0) {fprintf(stderr, "lvgl: init failed (%d)\n", ret);return ret;}printf("lvgl: benchmark on %dx%d\n",(int)lv\_display\_get\_horizontal\_resolution(pbl\_lvgl\_get\_display()),(int)lv\_display\_get\_vertical\_resolution(pbl\_lvgl\_get\_display()));/\* The demos come with LVGL, each enabled by its CONFIG\_LV\_USE\_DEMO\_\* option. \*/lv\_demo\_benchmark\_set\_end\_cb(prv\_end);lv\_demo\_benchmark();while (!s\_done) {pbl\_sleep\_ms(lv\_timer\_handler());}printf("Sample done\n");return 0;}
```

## Output

```
lvgl: benchmark on \d+x\d+
lvgl: \d+ scenes: \d+ fps, \d+% CPU, render \d+ ms, flush \d+ ms
Sample done
```

Generated from PebbleOS [4bbc630fa](https://github.com/coredevices/pebbleos/commit/4bbc630fa451369e352c06b8276c7fe37c67f4fd). This page is maintained in the pebbleos repository: [docs/samples/third\_party/lvgl/benchmark.md](https://github.com/coredevices/pebbleos/blob/4bbc630fa451369e352c06b8276c7fe37c67f4fd/docs/samples/third_party/lvgl/benchmark.md).
