mirror of
https://github.com/aristocratos/btop.git
synced 2024-06-17 01:45:34 +12:00
Merge branch 'main' into fix-716
This commit is contained in:
commit
7057d7653d
45
.github/workflows/continuous-build-gpu.yml
vendored
Normal file
45
.github/workflows/continuous-build-gpu.yml
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
name: Continuous Build Gpu
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags-ignore:
|
||||||
|
- '*.*'
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- '!src/osx/**'
|
||||||
|
- '!src/freebsd/**'
|
||||||
|
- '!src/openbsd/**'
|
||||||
|
- 'include/**'
|
||||||
|
- 'Makefile'
|
||||||
|
- '.github/workflows/continuous-build-gpu.yml'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'src/**'
|
||||||
|
- '!src/osx/**'
|
||||||
|
- '!src/freebsd/**'
|
||||||
|
- '!src/openbsd/**'
|
||||||
|
- 'include/**'
|
||||||
|
- 'Makefile'
|
||||||
|
- '.github/workflows/continuous-build-gpu.yml'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
gpu_build_linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: alpine:edge
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install build tools
|
||||||
|
run: apk add --no-cache --update gcc g++ make
|
||||||
|
|
||||||
|
- name: Compile
|
||||||
|
run: make CXX=g++ GPU_SUPPORT=true
|
||||||
|
|
|
@ -65,6 +65,8 @@ if(APPLE)
|
||||||
target_sources(btop PRIVATE src/osx/btop_collect.cpp src/osx/sensors.cpp src/osx/smc.cpp)
|
target_sources(btop PRIVATE src/osx/btop_collect.cpp src/osx/sensors.cpp src/osx/smc.cpp)
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
target_sources(btop PRIVATE src/freebsd/btop_collect.cpp)
|
target_sources(btop PRIVATE src/freebsd/btop_collect.cpp)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||||
|
target_sources(btop PRIVATE src/openbsd/btop_collect.cpp src/openbsd/sysctlbyname.cpp)
|
||||||
elseif(LINUX)
|
elseif(LINUX)
|
||||||
target_sources(btop PRIVATE src/linux/btop_collect.cpp)
|
target_sources(btop PRIVATE src/linux/btop_collect.cpp)
|
||||||
else()
|
else()
|
||||||
|
@ -185,6 +187,12 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
find_package(kvm REQUIRED)
|
find_package(kvm REQUIRED)
|
||||||
target_link_libraries(btop elf::elf kvm::kvm)
|
target_link_libraries(btop elf::elf kvm::kvm)
|
||||||
endif()
|
endif()
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
target_compile_options(btop PRIVATE -static-libstdc++)
|
||||||
|
endif()
|
||||||
|
find_package(kvm REQUIRED)
|
||||||
|
target_link_libraries(btop kvm::kvm)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS btop RUNTIME)
|
install(TARGETS btop RUNTIME)
|
||||||
|
|
72
README.md
72
README.md
|
@ -47,8 +47,8 @@
|
||||||
|
|
||||||
Btop release v1.3.0
|
Btop release v1.3.0
|
||||||
|
|
||||||
Big release with GPU support added for Linux and platform support for OpenBSD. Big thanks to @romner-set (GPU support) and @joske (OpenBSD support) for contributions.
|
Big release with GPU support added for Linux and platform support for OpenBSD. Big thanks to [@romner-set](https://github.com/romner-set) (GPU support) and [@joske](https://github.com/joske) (OpenBSD support) for contributions.
|
||||||
And a multitude of bugfixes and small changes, see [CHANGES.md](CHANGES.md) and latest [release](https://github.com/aristocratos/btop/releases/latest) for detailed list and attributions.
|
And a multitude of bugfixes and small changes, see [CHANGELOG.md](CHANGELOG.md) and latest [release](https://github.com/aristocratos/btop/releases/latest) for detailed list and attributions.
|
||||||
|
|
||||||
See news entry below for more information regarding GPU support.
|
See news entry below for more information regarding GPU support.
|
||||||
|
|
||||||
|
@ -995,6 +995,74 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
|
||||||
gmake help
|
gmake help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
### With CMake (Community maintained)
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
1. **Install build dependencies**
|
||||||
|
|
||||||
|
Requires GCC, CMake, Ninja and Git
|
||||||
|
|
||||||
|
_**Note:** LLVM's libc++ shipped with OpenBSD 7.4 is too old and cannot compile btop._
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pkg_add cmake g++%11 git ninja
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Clone the repository**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/aristocratos/btop.git && cd btop
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Compile**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Configure
|
||||||
|
CXX=eg++ cmake -B build -G Ninja
|
||||||
|
# Build
|
||||||
|
cmake --build build
|
||||||
|
```
|
||||||
|
|
||||||
|
This will automatically build a release version of btop.
|
||||||
|
|
||||||
|
Some useful options to pass to the configure step:
|
||||||
|
|
||||||
|
| Configure flag | Description |
|
||||||
|
|---------------------------------|-------------------------------------------------------------------------|
|
||||||
|
| `-DBTOP_LTO=<ON\|OFF>` | Enables link time optimization (ON by default) |
|
||||||
|
| `-DBTOP_USE_MOLD=<ON\|OFF>` | Use mold to link btop (OFF by default) |
|
||||||
|
| `-DBTOP_PEDANTIC=<ON\|OFF>` | Compile with additional warnings (OFF by default) |
|
||||||
|
| `-DBTOP_WERROR=<ON\|OFF>` | Compile with warnings as errors (OFF by default) |
|
||||||
|
| `-DBTOP_FORTIFY=<ON\|OFF>` | Detect buffer overflows with `_FORTIFY_SOURCE=3` (ON by default) |
|
||||||
|
| `-DCMAKE_INSTALL_PREFIX=<path>` | The installation prefix ('/usr/local' by default) |
|
||||||
|
|
||||||
|
To force any other compiler, run `CXX=<compiler> cmake -B build -G Ninja`
|
||||||
|
|
||||||
|
4. **Install**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake --install build
|
||||||
|
```
|
||||||
|
|
||||||
|
May require root privileges
|
||||||
|
|
||||||
|
5. **Uninstall**
|
||||||
|
|
||||||
|
CMake doesn't generate an uninstall target by default. To remove installed files, run
|
||||||
|
```
|
||||||
|
cat build/install_manifest.txt | xargs rm -irv
|
||||||
|
```
|
||||||
|
|
||||||
|
6. **Cleanup build directory**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake --build build -t clean
|
||||||
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## Installing the snap
|
## Installing the snap
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# Find libkvm, the Kernel Data Access Library
|
# Find libkvm, the Kernel Data Access Library
|
||||||
#
|
#
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
if(BSD)
|
||||||
find_path(kvm_INCLUDE_DIR NAMES kvm.h)
|
find_path(kvm_INCLUDE_DIR NAMES kvm.h)
|
||||||
find_library(kvm_LIBRARY NAMES kvm)
|
find_library(kvm_LIBRARY NAMES kvm)
|
||||||
|
|
||||||
|
|
|
@ -1361,6 +1361,7 @@ namespace Net {
|
||||||
int x = 1, y, width = 20, height;
|
int x = 1, y, width = 20, height;
|
||||||
int b_x, b_y, b_width, b_height, d_graph_height, u_graph_height;
|
int b_x, b_y, b_width, b_height, d_graph_height, u_graph_height;
|
||||||
bool shown = true, redraw = true;
|
bool shown = true, redraw = true;
|
||||||
|
const int MAX_IFNAMSIZ = 15;
|
||||||
string old_ip;
|
string old_ip;
|
||||||
std::unordered_map<string, Draw::Graph> graphs;
|
std::unordered_map<string, Draw::Graph> graphs;
|
||||||
string box;
|
string box;
|
||||||
|
@ -1381,7 +1382,7 @@ namespace Net {
|
||||||
out.reserve(width * height);
|
out.reserve(width * height);
|
||||||
const string title_left = Theme::c("net_box") + Fx::ub + Symbols::title_left;
|
const string title_left = Theme::c("net_box") + Fx::ub + Symbols::title_left;
|
||||||
const string title_right = Theme::c("net_box") + Fx::ub + Symbols::title_right;
|
const string title_right = Theme::c("net_box") + Fx::ub + Symbols::title_right;
|
||||||
const int i_size = min((int)selected_iface.size(), 10);
|
const int i_size = min((int)selected_iface.size(), MAX_IFNAMSIZ);
|
||||||
const long long down_max = (net_auto ? safeVal(graph_max, "download"s) : ((long long)(Config::getI("net_download")) << 20) / 8);
|
const long long down_max = (net_auto ? safeVal(graph_max, "download"s) : ((long long)(Config::getI("net_download")) << 20) / 8);
|
||||||
const long long up_max = (net_auto ? safeVal(graph_max, "upload"s) : ((long long)(Config::getI("net_upload")) << 20) / 8);
|
const long long up_max = (net_auto ? safeVal(graph_max, "upload"s) : ((long long)(Config::getI("net_upload")) << 20) / 8);
|
||||||
|
|
||||||
|
@ -1403,7 +1404,7 @@ namespace Net {
|
||||||
//? Interface selector and buttons
|
//? Interface selector and buttons
|
||||||
|
|
||||||
out += Mv::to(y, x+width - i_size - 9) + title_left + Fx::b + Theme::c("hi_fg") + "<b " + Theme::c("title")
|
out += Mv::to(y, x+width - i_size - 9) + title_left + Fx::b + Theme::c("hi_fg") + "<b " + Theme::c("title")
|
||||||
+ uresize(selected_iface, 10) + Theme::c("hi_fg") + " n>" + title_right
|
+ uresize(selected_iface, MAX_IFNAMSIZ) + Theme::c("hi_fg") + " n>" + title_right
|
||||||
+ Mv::to(y, x+width - i_size - 15) + title_left + Theme::c("hi_fg") + (safeVal(net.stat, "download"s).offset + safeVal(net.stat, "upload"s).offset > 0 ? Fx::b : "") + 'z'
|
+ Mv::to(y, x+width - i_size - 15) + title_left + Theme::c("hi_fg") + (safeVal(net.stat, "download"s).offset + safeVal(net.stat, "upload"s).offset > 0 ? Fx::b : "") + 'z'
|
||||||
+ Theme::c("title") + "ero" + title_right;
|
+ Theme::c("title") + "ero" + title_right;
|
||||||
Input::mouse_mappings["b"] = {y, x+width - i_size - 8, 1, 3};
|
Input::mouse_mappings["b"] = {y, x+width - i_size - 8, 1, 3};
|
||||||
|
|
|
@ -160,37 +160,44 @@ namespace Gpu {
|
||||||
namespace Rsmi {
|
namespace Rsmi {
|
||||||
#if !defined(RSMI_STATIC)
|
#if !defined(RSMI_STATIC)
|
||||||
//? RSMI defines, structs & typedefs
|
//? RSMI defines, structs & typedefs
|
||||||
#define RSMI_MAX_NUM_FREQUENCIES 32
|
#define RSMI_MAX_NUM_FREQUENCIES_V5 32
|
||||||
#define RSMI_STATUS_SUCCESS 0
|
#define RSMI_MAX_NUM_FREQUENCIES_V6 33
|
||||||
#define RSMI_MEM_TYPE_VRAM 0
|
#define RSMI_STATUS_SUCCESS 0
|
||||||
#define RSMI_TEMP_CURRENT 0
|
#define RSMI_MEM_TYPE_VRAM 0
|
||||||
#define RSMI_TEMP_TYPE_EDGE 0
|
#define RSMI_TEMP_CURRENT 0
|
||||||
#define RSMI_CLK_TYPE_MEM 4
|
#define RSMI_TEMP_TYPE_EDGE 0
|
||||||
#define RSMI_CLK_TYPE_SYS 0
|
#define RSMI_CLK_TYPE_MEM 4
|
||||||
#define RSMI_TEMP_MAX 1
|
#define RSMI_CLK_TYPE_SYS 0
|
||||||
|
#define RSMI_TEMP_MAX 1
|
||||||
|
|
||||||
typedef int rsmi_status_t,
|
typedef int rsmi_status_t,
|
||||||
rsmi_temperature_metric_t,
|
rsmi_temperature_metric_t,
|
||||||
rsmi_clk_type_t,
|
rsmi_clk_type_t,
|
||||||
rsmi_memory_type_t;
|
rsmi_memory_type_t;
|
||||||
|
|
||||||
struct rsmi_frequencies_t {uint32_t num_supported, current, frequency[RSMI_MAX_NUM_FREQUENCIES];};
|
struct rsmi_version_t {uint32_t major, minor, patch; const char* build;};
|
||||||
|
struct rsmi_frequencies_t_v5 {uint32_t num_supported, current; uint64_t frequency[RSMI_MAX_NUM_FREQUENCIES_V5];};
|
||||||
|
struct rsmi_frequencies_t_v6 {bool has_deep_sleep; uint32_t num_supported, current; uint64_t frequency[RSMI_MAX_NUM_FREQUENCIES_V6];};
|
||||||
|
|
||||||
//? Function pointers
|
//? Function pointers
|
||||||
rsmi_status_t (*rsmi_init)(uint64_t);
|
rsmi_status_t (*rsmi_init)(uint64_t);
|
||||||
rsmi_status_t (*rsmi_shut_down)();
|
rsmi_status_t (*rsmi_shut_down)();
|
||||||
|
rsmi_status_t (*rsmi_version_get)(rsmi_version_t*);
|
||||||
rsmi_status_t (*rsmi_num_monitor_devices)(uint32_t*);
|
rsmi_status_t (*rsmi_num_monitor_devices)(uint32_t*);
|
||||||
rsmi_status_t (*rsmi_dev_name_get)(uint32_t, char*, size_t);
|
rsmi_status_t (*rsmi_dev_name_get)(uint32_t, char*, size_t);
|
||||||
rsmi_status_t (*rsmi_dev_power_cap_get)(uint32_t, uint32_t, uint64_t*);
|
rsmi_status_t (*rsmi_dev_power_cap_get)(uint32_t, uint32_t, uint64_t*);
|
||||||
rsmi_status_t (*rsmi_dev_temp_metric_get)(uint32_t, uint32_t, rsmi_temperature_metric_t, int64_t*);
|
rsmi_status_t (*rsmi_dev_temp_metric_get)(uint32_t, uint32_t, rsmi_temperature_metric_t, int64_t*);
|
||||||
rsmi_status_t (*rsmi_dev_busy_percent_get)(uint32_t, uint32_t*);
|
rsmi_status_t (*rsmi_dev_busy_percent_get)(uint32_t, uint32_t*);
|
||||||
rsmi_status_t (*rsmi_dev_memory_busy_percent_get)(uint32_t, uint32_t*);
|
rsmi_status_t (*rsmi_dev_memory_busy_percent_get)(uint32_t, uint32_t*);
|
||||||
rsmi_status_t (*rsmi_dev_gpu_clk_freq_get)(uint32_t, rsmi_clk_type_t, rsmi_frequencies_t*);
|
rsmi_status_t (*rsmi_dev_gpu_clk_freq_get_v5)(uint32_t, rsmi_clk_type_t, rsmi_frequencies_t_v5*);
|
||||||
|
rsmi_status_t (*rsmi_dev_gpu_clk_freq_get_v6)(uint32_t, rsmi_clk_type_t, rsmi_frequencies_t_v6*);
|
||||||
rsmi_status_t (*rsmi_dev_power_ave_get)(uint32_t, uint32_t, uint64_t*);
|
rsmi_status_t (*rsmi_dev_power_ave_get)(uint32_t, uint32_t, uint64_t*);
|
||||||
rsmi_status_t (*rsmi_dev_memory_total_get)(uint32_t, rsmi_memory_type_t, uint64_t*);
|
rsmi_status_t (*rsmi_dev_memory_total_get)(uint32_t, rsmi_memory_type_t, uint64_t*);
|
||||||
rsmi_status_t (*rsmi_dev_memory_usage_get)(uint32_t, rsmi_memory_type_t, uint64_t*);
|
rsmi_status_t (*rsmi_dev_memory_usage_get)(uint32_t, rsmi_memory_type_t, uint64_t*);
|
||||||
rsmi_status_t (*rsmi_dev_pci_throughput_get)(uint32_t, uint64_t*, uint64_t*, uint64_t*);
|
rsmi_status_t (*rsmi_dev_pci_throughput_get)(uint32_t, uint64_t*, uint64_t*, uint64_t*);
|
||||||
|
|
||||||
|
uint32_t version_major = 0;
|
||||||
|
|
||||||
//? Data
|
//? Data
|
||||||
void* rsmi_dl_handle;
|
void* rsmi_dl_handle;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1259,13 +1266,13 @@ namespace Gpu {
|
||||||
|
|
||||||
LOAD_SYM(rsmi_init);
|
LOAD_SYM(rsmi_init);
|
||||||
LOAD_SYM(rsmi_shut_down);
|
LOAD_SYM(rsmi_shut_down);
|
||||||
|
LOAD_SYM(rsmi_version_get);
|
||||||
LOAD_SYM(rsmi_num_monitor_devices);
|
LOAD_SYM(rsmi_num_monitor_devices);
|
||||||
LOAD_SYM(rsmi_dev_name_get);
|
LOAD_SYM(rsmi_dev_name_get);
|
||||||
LOAD_SYM(rsmi_dev_power_cap_get);
|
LOAD_SYM(rsmi_dev_power_cap_get);
|
||||||
LOAD_SYM(rsmi_dev_temp_metric_get);
|
LOAD_SYM(rsmi_dev_temp_metric_get);
|
||||||
LOAD_SYM(rsmi_dev_busy_percent_get);
|
LOAD_SYM(rsmi_dev_busy_percent_get);
|
||||||
LOAD_SYM(rsmi_dev_memory_busy_percent_get);
|
LOAD_SYM(rsmi_dev_memory_busy_percent_get);
|
||||||
LOAD_SYM(rsmi_dev_gpu_clk_freq_get);
|
|
||||||
LOAD_SYM(rsmi_dev_power_ave_get);
|
LOAD_SYM(rsmi_dev_power_ave_get);
|
||||||
LOAD_SYM(rsmi_dev_memory_total_get);
|
LOAD_SYM(rsmi_dev_memory_total_get);
|
||||||
LOAD_SYM(rsmi_dev_memory_usage_get);
|
LOAD_SYM(rsmi_dev_memory_usage_get);
|
||||||
|
@ -1281,6 +1288,26 @@ namespace Gpu {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(RSMI_STATIC)
|
||||||
|
//? Check version
|
||||||
|
rsmi_version_t version;
|
||||||
|
result = rsmi_version_get(&version);
|
||||||
|
if (result != RSMI_STATUS_SUCCESS) {
|
||||||
|
Logger::warning("ROCm SMI: Failed to get version");
|
||||||
|
return false;
|
||||||
|
} else if (version.major == 5) {
|
||||||
|
if ((rsmi_dev_gpu_clk_freq_get_v5 = (decltype(rsmi_dev_gpu_clk_freq_get_v5))load_rsmi_sym("rsmi_dev_gpu_clk_freq_get")) == nullptr)
|
||||||
|
return false;
|
||||||
|
} else if (version.major == 6) {
|
||||||
|
if ((rsmi_dev_gpu_clk_freq_get_v6 = (decltype(rsmi_dev_gpu_clk_freq_get_v6))load_rsmi_sym("rsmi_dev_gpu_clk_freq_get")) == nullptr)
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
Logger::warning("ROCm SMI: Dynamic loading only supported for version 5 and 6");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
version_major = version.major;
|
||||||
|
#endif
|
||||||
|
|
||||||
//? Device count
|
//? Device count
|
||||||
result = rsmi_num_monitor_devices(&device_count);
|
result = rsmi_num_monitor_devices(&device_count);
|
||||||
if (result != RSMI_STATUS_SUCCESS) {
|
if (result != RSMI_STATUS_SUCCESS) {
|
||||||
|
@ -1364,7 +1391,46 @@ namespace Gpu {
|
||||||
if constexpr(is_init) gpus_slice[i].supported_functions.mem_utilization = false;
|
if constexpr(is_init) gpus_slice[i].supported_functions.mem_utilization = false;
|
||||||
} else gpus_slice[i].mem_utilization_percent.push_back((long long)utilization);
|
} else gpus_slice[i].mem_utilization_percent.push_back((long long)utilization);
|
||||||
}
|
}
|
||||||
|
#if !defined(RSMI_STATIC)
|
||||||
|
//? Clock speeds
|
||||||
|
if (gpus_slice[i].supported_functions.gpu_clock) {
|
||||||
|
if (version_major == 5) {
|
||||||
|
rsmi_frequencies_t_v5 frequencies;
|
||||||
|
result = rsmi_dev_gpu_clk_freq_get_v5(i, RSMI_CLK_TYPE_SYS, &frequencies);
|
||||||
|
if (result != RSMI_STATUS_SUCCESS) {
|
||||||
|
Logger::warning("ROCm SMI: Failed to get GPU clock speed: ");
|
||||||
|
if constexpr(is_init) gpus_slice[i].supported_functions.gpu_clock = false;
|
||||||
|
} else gpus_slice[i].gpu_clock_speed = (long long)frequencies.frequency[frequencies.current]/1000000; // Hz to MHz
|
||||||
|
}
|
||||||
|
else if (version_major == 6) {
|
||||||
|
rsmi_frequencies_t_v6 frequencies;
|
||||||
|
result = rsmi_dev_gpu_clk_freq_get_v6(i, RSMI_CLK_TYPE_SYS, &frequencies);
|
||||||
|
if (result != RSMI_STATUS_SUCCESS) {
|
||||||
|
Logger::warning("ROCm SMI: Failed to get GPU clock speed: ");
|
||||||
|
if constexpr(is_init) gpus_slice[i].supported_functions.gpu_clock = false;
|
||||||
|
} else gpus_slice[i].gpu_clock_speed = (long long)frequencies.frequency[frequencies.current]/1000000; // Hz to MHz
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpus_slice[i].supported_functions.mem_clock) {
|
||||||
|
if (version_major == 5) {
|
||||||
|
rsmi_frequencies_t_v5 frequencies;
|
||||||
|
result = rsmi_dev_gpu_clk_freq_get_v5(i, RSMI_CLK_TYPE_MEM, &frequencies);
|
||||||
|
if (result != RSMI_STATUS_SUCCESS) {
|
||||||
|
Logger::warning("ROCm SMI: Failed to get VRAM clock speed: ");
|
||||||
|
if constexpr(is_init) gpus_slice[i].supported_functions.mem_clock = false;
|
||||||
|
} else gpus_slice[i].mem_clock_speed = (long long)frequencies.frequency[frequencies.current]/1000000; // Hz to MHz
|
||||||
|
}
|
||||||
|
else if (version_major == 6) {
|
||||||
|
rsmi_frequencies_t_v6 frequencies;
|
||||||
|
result = rsmi_dev_gpu_clk_freq_get_v6(i, RSMI_CLK_TYPE_MEM, &frequencies);
|
||||||
|
if (result != RSMI_STATUS_SUCCESS) {
|
||||||
|
Logger::warning("ROCm SMI: Failed to get VRAM clock speed: ");
|
||||||
|
if constexpr(is_init) gpus_slice[i].supported_functions.mem_clock = false;
|
||||||
|
} else gpus_slice[i].mem_clock_speed = (long long)frequencies.frequency[frequencies.current]/1000000; // Hz to MHz
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
//? Clock speeds
|
//? Clock speeds
|
||||||
if (gpus_slice[i].supported_functions.gpu_clock) {
|
if (gpus_slice[i].supported_functions.gpu_clock) {
|
||||||
rsmi_frequencies_t frequencies;
|
rsmi_frequencies_t frequencies;
|
||||||
|
@ -1383,6 +1449,7 @@ namespace Gpu {
|
||||||
if constexpr(is_init) gpus_slice[i].supported_functions.mem_clock = false;
|
if constexpr(is_init) gpus_slice[i].supported_functions.mem_clock = false;
|
||||||
} else gpus_slice[i].mem_clock_speed = (long long)frequencies.frequency[frequencies.current]/1000000; // Hz to MHz
|
} else gpus_slice[i].mem_clock_speed = (long long)frequencies.frequency[frequencies.current]/1000000; // Hz to MHz
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//? Power usage & state
|
//? Power usage & state
|
||||||
if (gpus_slice[i].supported_functions.pwr_usage) {
|
if (gpus_slice[i].supported_functions.pwr_usage) {
|
||||||
|
|
|
@ -686,7 +686,7 @@ namespace Mem {
|
||||||
if (host_statistics64(mach_host_self(), HOST_VM_INFO64, (host_info64_t)&p, &info_size) == 0) {
|
if (host_statistics64(mach_host_self(), HOST_VM_INFO64, (host_info64_t)&p, &info_size) == 0) {
|
||||||
mem.stats.at("free") = p.free_count * Shared::pageSize;
|
mem.stats.at("free") = p.free_count * Shared::pageSize;
|
||||||
mem.stats.at("cached") = p.external_page_count * Shared::pageSize;
|
mem.stats.at("cached") = p.external_page_count * Shared::pageSize;
|
||||||
mem.stats.at("used") = (p.active_count + p.inactive_count + p.wire_count) * Shared::pageSize;
|
mem.stats.at("used") = (p.active_count + p.wire_count) * Shared::pageSize;
|
||||||
mem.stats.at("available") = Shared::totalMem - mem.stats.at("used");
|
mem.stats.at("available") = Shared::totalMem - mem.stats.at("used");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue