summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraristocratos <gnmjpl@gmail.com>2023-08-27 01:28:36 +0200
committeraristocratos <gnmjpl@gmail.com>2023-08-27 01:28:36 +0200
commit08abf0b9301e9d48f363ec8ffee161b351c4716d (patch)
treef8257fa049ca980efc99336d51efda602ed3a12e /src
parent7290109f80175c8f140fa6abd67ad0183e1f21ec (diff)
Quickfixes for MacOS and FreeBSD compilation.
Diffstat (limited to 'src')
-rw-r--r--src/btop.cpp10
-rw-r--r--src/btop_shared.cpp10
-rw-r--r--src/btop_shared.hpp2
-rw-r--r--src/linux/btop_collect.cpp9
4 files changed, 20 insertions, 11 deletions
diff --git a/src/btop.cpp b/src/btop.cpp
index 2598321..2f755d0 100644
--- a/src/btop.cpp
+++ b/src/btop.cpp
@@ -262,8 +262,10 @@ void clean_quit(int sig) {
#endif
}
+#ifdef __linux__
Gpu::Nvml::shutdown();
Gpu::Rsmi::shutdown();
+#endif
Config::write();
@@ -507,6 +509,7 @@ namespace Runner {
//* Run collection and draw functions for all boxes
try {
+ #ifdef __linux__
//? GPU data collection
const bool gpu_in_cpu_panel = Gpu::gpu_names.size() > 0 and (
Config::getS("cpu_graph_lower").starts_with("gpu-") or Config::getS("cpu_graph_upper").starts_with("gpu-")
@@ -525,6 +528,9 @@ namespace Runner {
if (Global::debug) debug_timer("gpu", collect_done);
}
auto& gpus_ref = gpus;
+ #else
+ vector<Gpu::gpu_info> gpus_ref{};
+ #endif
//? CPU
if (v_contains(conf.boxes, "cpu")) {
@@ -553,7 +559,7 @@ namespace Runner {
throw std::runtime_error("Cpu:: -> " + string{e.what()});
}
}
-
+ #ifdef __linux__
//? GPU
if (not gpu_panels.empty() and not gpus_ref.empty()) {
try {
@@ -570,7 +576,7 @@ namespace Runner {
throw std::runtime_error("Gpu:: -> " + string{e.what()});
}
}
-
+ #endif
//? MEM
if (v_contains(conf.boxes, "mem")) {
try {
diff --git a/src/btop_shared.cpp b/src/btop_shared.cpp
index e5c9027..bb7a9f6 100644
--- a/src/btop_shared.cpp
+++ b/src/btop_shared.cpp
@@ -24,6 +24,16 @@ tab-size = 4
namespace rng = std::ranges;
using namespace Tools;
+namespace Gpu {
+ vector<string> gpu_names;
+ vector<int> gpu_b_height_offsets;
+ unordered_flat_map<string, deque<long long>> shared_gpu_percent = {
+ {"gpu-average", {}},
+ {"gpu-vram-total", {}},
+ {"gpu-pwr-total", {}},
+ };
+ long long gpu_pwr_total_max;
+}
namespace Proc {
void proc_sorter(vector<proc_info>& proc_vec, const string& sorting, bool reverse, bool tree) {
diff --git a/src/btop_shared.hpp b/src/btop_shared.hpp
index cb6c0fe..1d1c71c 100644
--- a/src/btop_shared.hpp
+++ b/src/btop_shared.hpp
@@ -151,12 +151,14 @@ namespace Gpu {
// vector<proc_info> compute_processes = {};
};
+#ifdef __linux__
namespace Nvml {
extern bool shutdown();
}
namespace Rsmi {
extern bool shutdown();
}
+#endif
//* Collect gpu stats and temperatures
auto collect(bool no_update = false) -> vector<gpu_info>&;
diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp
index 91e376c..8ed9fa3 100644
--- a/src/linux/btop_collect.cpp
+++ b/src/linux/btop_collect.cpp
@@ -96,15 +96,6 @@ namespace Cpu {
namespace Gpu {
vector<gpu_info> gpus;
- vector<string> gpu_names;
- vector<int> gpu_b_height_offsets;
- unordered_flat_map<string, deque<long long>> shared_gpu_percent = {
- {"gpu-average", {}},
- {"gpu-vram-total", {}},
- {"gpu-pwr-total", {}},
- };
- long long gpu_pwr_total_max;
-
//? NVIDIA data collection
namespace Nvml {
//? NVML defines, structs & typedefs