bunch of shit clang-tidy and clion made me do
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
namespace cpu {
|
||||
|
||||
void detectHwmon(cpuSensors* target, const std::string& pci) {
|
||||
std::string path = "/sys/bus/pci/devices/" + pci + "/hwmon";
|
||||
const std::string path = "/sys/bus/pci/devices/" + pci + "/hwmon";
|
||||
|
||||
try {
|
||||
target->hwmon = utils::getFirstDir(path);
|
||||
@@ -36,18 +36,18 @@ void update(cpuSensors* c) {
|
||||
curr.ts = std::chrono::steady_clock::now();
|
||||
// utils::fastReadNum("/sys/class/powercap/intel-rapl:0/energy_uj", curr.energy);
|
||||
curr.energy = utils::fastReadNum("/sys/class/powercap/intel-rapl:0/energy_uj", buf);
|
||||
c->ptotal = (float)(curr.energy - prev.energy) / (float)(std::chrono::duration_cast<std::chrono::microseconds>(curr.ts - prev.ts).count());
|
||||
c->ptotal = static_cast<float>(curr.energy - prev.energy) / static_cast<float>(std::chrono::duration_cast<std::chrono::microseconds>(curr.ts - prev.ts).count());
|
||||
prev = curr;
|
||||
|
||||
// lots of reads but still faster than reading /proc/cpuinfo
|
||||
c->avg_freq = 0;
|
||||
for (uint8_t i = 0; i < N_CPU; i++) {
|
||||
utils::readFile("/sys/devices/system/cpu/cpu" + std::to_string(i) + "/cpufreq/cpuinfo_avg_freq", buf, sizeof(buf));
|
||||
c->avg_freq += strtol(buf, NULL, 10) / 1000;
|
||||
c->avg_freq += strtol(buf, nullptr, 10) / 1000;
|
||||
}
|
||||
c->avg_freq /= N_CPU;
|
||||
|
||||
if (c->hwmon == "") return; // break if no module
|
||||
if (c->hwmon.empty()) return; // break if no module
|
||||
|
||||
// commented out unused values so its faster
|
||||
if (c->zenpower) {
|
||||
|
||||
Reference in New Issue
Block a user