Hi, I’m Lex (they/them), I make silly projects.
This one is a physical CPU usage display. Kinda like the CPU usage display in task manager, but with a physical analog meter for each CPU.
It also does memory usage!
Enjoy!
FAQ:
Q: How do you get the performance numbers from the computer to the arduino
A: I wrote a Rust program that uses the systemstat crate to get the data from linux, it then does a little bit of maths to transform the data, and sends that to the ardunio over USB-serial
Q: What’s the music?
A: Just some random thing I threw together in a midi editor, I’m not very experienced with music production.
Q: Does this slow down the computer?
A: Not significantly. Yes, it does take a little bit of CPU time to calculate the numbers, transform them, and send them out the serial port, but as you can see from the meters, the CPUs are often almost totally idle, so it’s not a burden on the computer at all.
Q: Is the code available? A parts list? A wiring diagram?
A: Not really, but I can explain what you need: The wiring is very simple, you can follow an arduino tutorial for wiring up LEDs, and the meters just need to be connected up to PWM pins with the right resistor. The parts are just an arduino, some addressible LEDs, and any suitable ammeter. The software is designed specifically for my needs and I don’t intend to update it to work in the general case where the number of meters might be different to mine, so I’m not releasing the code. Sorry.
Q: Why is the swap meter so high all the time?
A: I’m not exactly sure, but it’s probably a side effect of the way that Linux manages swap space. There might be some other more useful measure that I could use instead. EDIT: okay, update, it hasn’t ever been that high since I filmed the video. I’ve been using it regularly and the swap mostly stays around 0 now, I don’t think I changed the code, so I guess this was an anomaly.
Q: Why not make the refresh rate higher? (related: Why not make it a rolling average instead of polling?)
A: TL;DR: this sample rate is the most sensible. Long answer: Okay, so the answer to this question could get really technical and go into the details of how the CPU usage is calculated by the OS. If you open Windows task manager, MacOS activity monitor, or your favourite linux system monitor utility, you’ll see that the refresh rate is about once per second by default. This is because higher sample rates actually produce less meaningful numbers. Suppose you were to sample at about 100hz. That means that even a really short computation that only takes one hundredth of a second to complete will show up as 100% cpu usage in that time, and then 0% for the rest, insead of being 1% in the past second. There is no such thing as an instantaneous CPU usage reading, becuase it’s either running or sleeping, there is no in between. Any CPU usage number that’s meaningful is an average of the run/sleep time over some period. You have to sample slowly to get meaningful numbers at all. This is also why a rolling average isn’t useful. It doesn’t really tell you more information. This display does, in fact, interpolate between readings. This is why the needles slowly move to the next value instead of jumping there immediately (and then wobbling around a bit as they settle at the new reading). This is effectively the same thing you’d see if it was possible to get a rolling average from the OS. (well not quite, but close enough.) I don’t think any OS does provide an API for a rolling average like that, since doing so would require a significant computational overhead that doesn’t provide any meaningful benefit.
3 views
118
24
7 months ago 00:17:12 1
Around The World in 1896 Colorized (4K 60fps) New York, London, Jerusalem, Paris ++
7 months ago 00:02:45 1
Island Ding: EXPANDED [Feature Length]
7 months ago 00:02:55 1
⭐ I Saw this Idea in a Fashion Brand Store. Dollar Tree Store are Out of Tissues! (Part #78)
7 months ago 00:03:33 1
MiniMogus - DOWNFALL VIA [W1ld Pr1zes] - (A Spamton EX fantrack)
7 months ago 00:03:08 1
Наталья Влади - СИЛЬНЫЕ ЛЮДИ (Премьера клипа, 2024)