Thermals
- 8 Devlogs
- 17 Total hours
A desktop app for displaying thermal and load information about your machine, written in Java.
A desktop app for displaying thermal and load information about your machine, written in Java.
I’ve managed to get the live CPU stats (usage, per-core usage and (approx.) clock speed) and the CPU usage graph running.
One problem with the current approach for measuring values (which is done using OSHI) is that on Windows, things like CPU temperature, CPU clock speed and others are not reliable.
On Windows, metrics like CPU temperature are read over WMI. However, the actual CPU temp is often only partially or not at all correctly exposed via WMI. CPU clock is often a stale/cached value or sometimes not at all given.
This requires an external source of data which is both correct and more reliable.
HwManager and live stats/graphs
The hardware manager is a class that can provide all sensor data necessary. It abstracts OSHI and any future methods of aquiring data into one class (with instances of other classes such as Cpu).
It has its own thread which calls the pollValues method of all subclasses (Cpu, …) which then update their internal values, which can be retrieved via getter functions.
The Window class has an internal timer which calls the update method of TopPanel, MiddlePanel and BottomPanel, which then call each component panel’s update method which then update their stats and graphs.
After once again a little time away from this project, I finally finished the fan panel and the disks panel! :)
The fan panel has a 2x3 grid which expands in columns if more than 6 fans are present (which also expands the width of the panel). Each fan is just a Stat instance.
Each Disk is given params such as name, type (NVMe, SATA SSD/HDD, …), usage percentage and read/write rates. Then, the Disk instance manages the layout and drawing.
The Disk class extends BaseBottomEntry, which is a horizontal JPanel with a BoxLayout and a name label. Then, Disk adds a JPanel on the right side of itsself and places stats like the ones given above (type, read/write activity, …) in it. For usage, there’s also a PercentageBar which is also custom-written.
The core UI structure is done now. This includes:
The top row contains CPU and RAM, same as in the last devlog.
The middle row contains all GPUs and fan speeds. This means it can contain 2..n component panels (if n is number of GPUs minus one).
It is horizontally scrollable which prevents this row over-cluttering the popup (which would be caused by methods like wrapping excess panels to the next row).
This row contains two panels which fill the window’s width. The first panel - the disks panel - contains info about all disks or drives in the computer. It will have one “entry” (one row inside the panel with info such as drive name, transfer speed and used/total size).
Same goes for the network panel, which contains all network adapters. It will display info such as download, upload, adapter state and name.
I’ve decided I wanna go for a slightly different UI style, with CPU and RAM in the first row in a 2:1 ratio. Below, there’s the GPU row with 2 cols and as many rows as needed, and below will be one panel for all disks (including their usage, current transfer and so on) and one for all network adapters and their stats.
The CPU and RAM panel are now positioned exactly how they will be in the final product. The CPU panel is also basically done, as its got the usage graph on top and stats on the bottom.
There are two new classes: Stat and Graph. A Graph is… well pretty self explanatory I hope, and a Stat is one value with text on what it is. (as seen below the red graph).
I finally got the UI working in a way I like. You now have one panel per component.
The window contains a JScrollPane (for scrolling when the content gets larger than the window) which contains a JSplitPane for dividing the contents into top and bottom.
Additionally, there are the TopPanel and BottomPanel. The TopPanel contains three fixed panels: CPU, GPU and RAM. (still need to figure out how to properly display multi-GPU setups like this but future problem i guess)
The BottomPanel contains all other devices, like drives and network adapters.
Both TopPanel and BottomPanel are containers for individual “component panels”. Each component panel (CpuPanel, DiskPanel, …) owns its own components like labels, graphs or similar. I also wrote a custom JPanelRounded class for rounded panels.
After being offline for a little touching… grass and stuff (idk if anyone will get the reference) I finally got to work again and made two things work:
The popup window uses one main JSplitPlane which houses two panels (TopPanel, BottomPanel). Each of these panels again contains panels (CpuPanel, GpuPanel, …), of which each one contains stuff like its own labels and other stuff.
OK, don’t take it wrong: the app is nowhere near finished but at least the tray icon is!
The tray icon now displays the CPU temperature represented as a color, interpolated between a cold hue (green, 30°C) and a hot hue (red, 90°C). Also, I added a tooltip which shows temps for CPU and GPU (currently its placeholders but oh well)
I’ve started working on an app called “Thermals”. It serves the purpose of being a simple yet modern and elegant usage and temperature monitor, accessible through a tray icon, made to work on both Windows and Linux.
Build System, Repository and similar is set up and simple tray icon (a white square) is also working.