Stub parseCpuFrequencies on *BSD platforms

This commit is contained in:
Genesis 2021-02-21 21:57:55 +01:00
parent 08ea5ebe1f
commit 99643ba2e6
No known key found for this signature in database
GPG Key ID: BC5BD506E7579978

View File

@ -2,8 +2,10 @@
#include <sys/types.h>
#include <sys/sysctl.h>
#include <spdlog/spdlog.h>
#include <cstdlib> // malloc
#include <unistd.h> // sysconf
#include <cmath> // NAN
#if defined(__NetBSD__) || defined(__OpenBSD__)
# include <sys/sched.h>
@ -97,5 +99,10 @@ std::vector<std::tuple<size_t, size_t>> waybar::modules::Cpu::parseCpuinfo() {
}
std::vector<float> waybar::modules::Cpu::parseCpuFrequencies() {
throw std::runtime_error("Cpu frequency is not implemented on BSD.");
static std::vector<float> frequencies;
if (frequencies.empty()) {
spdlog::warn("cpu/bsd: parseCpuFrequencies is not implemented, expect garbage in {*_frequency}");
frequencies.push_back(NAN);
}
return frequencies;
}