add cpu clock
This commit is contained in:
@@ -14,7 +14,7 @@ Same as plugins. Just write more features scrub, learn some C++, damn
|
||||
- In the LCDDisplay lib, reimplement all the features I have in picoSmartie + maybe finally add keypad support for both so I can toggle backlight (?) or change screens if I want any
|
||||
- Screens could be automatic tbh, like if it detects media playing it switches to media screen, if GPU power > 80W it switches to main (hwmon) screen
|
||||
- Measure execution time of main loop, if it's close enough to 1000ms, add network monitoring
|
||||
- Add more getters in general, CPU clock would be nice
|
||||
- Add more getters in general, still need wall socket power
|
||||
|
||||
## LCD layout
|
||||
It looks something like this
|
||||
|
||||
18
main.cpp
18
main.cpp
@@ -21,6 +21,7 @@
|
||||
#define LCD_INTERVAL_MS 500
|
||||
#define LCD_CONTRAST 215
|
||||
#define FILL_CHAR ' '
|
||||
#define N_CPU 16
|
||||
|
||||
struct mem_usage_t {
|
||||
uint64_t free;
|
||||
@@ -127,21 +128,29 @@ auto getCpuTemp(std::string hw) {
|
||||
double ptotal = 0.0;
|
||||
double vcore = 0.0;
|
||||
double vsoc = 0.0;
|
||||
uint32_t avg_freq = 0;
|
||||
} cpu;
|
||||
|
||||
// commented out unused values so its faster
|
||||
if (readFile(hw + "/name") == "zenpower") {
|
||||
cpu.tdie = (double)(std::stoul(readFile(hw + "/temp1_input")) / 1000.0);
|
||||
// cpu.tdie = (double)(std::stoul(readFile(hw + "/temp1_input")) / 1000.0);
|
||||
cpu.tctl = (double)(std::stoul(readFile(hw + "/temp2_input")) / 1000.0);
|
||||
cpu.tccd1 = (double)(std::stoul(readFile(hw + "/temp3_input")) / 1000.0);
|
||||
cpu.pcore = (double)(std::stoul(readFile(hw + "/power1_input")) / 1000000.0);
|
||||
cpu.psoc = (double)(std::stoul(readFile(hw + "/power2_input")) / 1000000.0);
|
||||
cpu.ptotal = cpu.pcore + cpu.psoc;
|
||||
cpu.vcore = (double)(std::stoul(readFile(hw + "/in1_input")) / 1000.0);
|
||||
cpu.vsoc = (double)(std::stoul(readFile(hw + "/in2_input")) / 1000.0);
|
||||
// cpu.vsoc = (double)(std::stoul(readFile(hw + "/in2_input")) / 1000.0);
|
||||
} else {
|
||||
cpu.tctl = (double)(std::stoul(readFile(hw + "/temp1_input")) / 1000.0);
|
||||
cpu.tccd1 = (double)(std::stoul(readFile(hw + "/temp3_input")) / 1000.0);
|
||||
}
|
||||
|
||||
// lots of reads but still faster than reading /proc/cpuinfo
|
||||
for(uint8_t i = 0; i < N_CPU; i++)
|
||||
cpu.avg_freq += (long)(std::stol(readFile("/sys/devices/system/cpu/cpu" + std::to_string(i) + "/cpufreq/cpuinfo_avg_freq", 3)));
|
||||
cpu.avg_freq /= N_CPU;
|
||||
|
||||
return cpu;
|
||||
}
|
||||
|
||||
@@ -208,8 +217,9 @@ int main(int argc, char *argv[]) {
|
||||
lines[2] += pad(pNum(gpu.fan_speed) + "R", 5);
|
||||
lines[2] += pad(std::to_string(gpu.power_avg) + "/" + std::to_string(gpu.power_cap) + "W", 9);
|
||||
|
||||
lines[3] = pad(pNum(cpu.vcore, 3) + "V", 6, true);
|
||||
lines[3] += fill(15);
|
||||
lines[3] = pad(pNum(cpu.vcore, 3) + "V", 7, true);
|
||||
lines[3] += std::to_string(cpu.avg_freq) + "MHz";
|
||||
lines[3] += fill(7);
|
||||
lines[3] += pad(pNum(gpu.core_clock) + "/" + pNum(gpu.mem_clock) + "MHz ", 13);
|
||||
lines[3] += pad(pNum(gpu.vcore, 3) + "V", 5);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user