Fixed cpu module: Provide stub implementation for parseCpuFrequencies
This commit is contained in:
parent
91b6629103
commit
d5203e5b37
|
@ -201,6 +201,8 @@ elif is_dragonfly or is_freebsd or is_netbsd or is_openbsd
|
||||||
add_project_arguments('-DHAVE_MEMORY_BSD', language: 'cpp')
|
add_project_arguments('-DHAVE_MEMORY_BSD', language: 'cpp')
|
||||||
src_files += files(
|
src_files += files(
|
||||||
'src/modules/cpu.cpp',
|
'src/modules/cpu.cpp',
|
||||||
|
'src/modules/cpu_frequency/bsd.cpp',
|
||||||
|
'src/modules/cpu_frequency/common.cpp',
|
||||||
'src/modules/cpu_usage/bsd.cpp',
|
'src/modules/cpu_usage/bsd.cpp',
|
||||||
'src/modules/cpu_usage/common.cpp',
|
'src/modules/cpu_usage/common.cpp',
|
||||||
'src/modules/memory/bsd.cpp',
|
'src/modules/memory/bsd.cpp',
|
||||||
|
|
|
@ -99,9 +99,11 @@ waybar::AModule* waybar::Factory::makeModule(const std::string& name) const {
|
||||||
if (ref == "cpu") {
|
if (ref == "cpu") {
|
||||||
return new waybar::modules::Cpu(id, config_[name]);
|
return new waybar::modules::Cpu(id, config_[name]);
|
||||||
}
|
}
|
||||||
|
#if defined(HAVE_CPU_LINUX)
|
||||||
if (ref == "cpu_frequency") {
|
if (ref == "cpu_frequency") {
|
||||||
return new waybar::modules::CpuFrequency(id, config_[name]);
|
return new waybar::modules::CpuFrequency(id, config_[name]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (ref == "cpu_usage") {
|
if (ref == "cpu_usage") {
|
||||||
return new waybar::modules::CpuUsage(id, config_[name]);
|
return new waybar::modules::CpuUsage(id, config_[name]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
|
#include <cmath> // NAN
|
||||||
|
|
||||||
|
#include "modules/cpu_frequency.hpp"
|
||||||
|
|
||||||
|
std::vector<float> waybar::modules::CpuFrequency::parseCpuFrequencies() {
|
||||||
|
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;
|
||||||
|
}
|
Loading…
Reference in New Issue