Skip to content

Store history in a circular buffer

Ghost User requested to merge (removed):circular into master

The circular buffer avoids memmove() when adding a history item, changing the temporal complexity of the addition from O(N) to O(1).

This enables the history buffer to store - at almost no cost - more items than the user has configured to be displayed. If the user enlarges the width of the displayed history, the newly displayed area will show valid CPU load data. The minimum capacity of the buffer (128) matches the maximum configurable width of the display area (128).

The capacity of the circular buffer is a power of two.

Edited by Ghost User

Merge request reports