Blog Home

Analog gauge array helps evaluate compilation efficiency

Arduino TeamDecember 4th, 2023

There is an old joke response in the programming industry for whenever you’re caught slacking off: “I’m waiting for the code to compile.” That still holds up, because even today’s blazing fast computers can take ages to compile. That’s true even when the compiler can run tasks across multiple CPU cores. To find out if that is as efficient as it could be, Lex built this analog gauge array that displays the utilization of each core.

Lex created this for their own computer, which has a 12-core CPU. There is one gauge for each of those cores, plus an additional gauge for swap memory and another for RAM. The same basic idea could apply to computers that have CPUs with fewer cores — the device would just need a number of gauges equal to the number of CPU cores, plus two.

The device contains an Arduino Mega 2560 board and it receives utilization data through serial from a PC running a custom Rust program. That program uses some resources, but it is trivial compared to everything else. The Arduino employs pulse-width modulation (PWM) to control the positions of the gauge needles. There is also a strip of WS2812B individually addressable RGB LEDs illuminating the gauges, with the colors corresponding to utilization. So high utilization will move a gauge’s needle to the right and cause it to light up red.

This gives Lex a quick and easy way to visualize how their computer distributes tasks across the CPU cores. That is interesting when compiling code, but it is also useful for other jobs that attempt to parallelize tasks.

Boards:Mega
Categories:Arduino

Leave a Reply

You must be logged in with your Arduino account to post a comment.