mirror of https://github.com/aristocratos/btop.git
Compare commits
4 Commits
4e5278c234
...
8a6541183c
Author | SHA1 | Date |
---|---|---|
Steffen | 8a6541183c | |
aristocratos | dd4ada7023 | |
aristocratos | b48bf6ae45 | |
Steffen Winter | 658eb675df |
2
Makefile
2
Makefile
|
@ -79,7 +79,7 @@ ifeq ($(CXX_IS_CLANG),true)
|
|||
CLANG_WORKS := true
|
||||
endif
|
||||
else
|
||||
ifneq ($(shell test $(CXX_VERSION_MAJOR) -lt 10; echo $$?),0)
|
||||
ifneq ($(shell test $(CXX_VERSION_MAJOR) -lt 11; echo $$?),0)
|
||||
GCC_WORKS := true
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -354,7 +354,7 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
|
|||
|
||||
## Compilation Linux
|
||||
|
||||
Requires at least GCC 10 or Clang 16.
|
||||
Requires at least GCC 11 or Clang 16.
|
||||
|
||||
The makefile also needs GNU coreutils and `sed` (should already be installed on any modern distribution).
|
||||
|
||||
|
@ -552,7 +552,7 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
|
|||
|
||||
## Compilation macOS OSX
|
||||
|
||||
Requires at least GCC 10 or Clang 16.
|
||||
Requires at least GCC 11 or Clang 16.
|
||||
|
||||
With GCC, version 12 (or better) is needed for macOS Ventura. If you get linker errors on Ventura you'll need to upgrade your command line tools (Version 14.0) is bugged.
|
||||
|
||||
|
@ -723,7 +723,7 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
|
|||
|
||||
## Compilation FreeBSD
|
||||
|
||||
Requires at least GCC 10 or Clang 16.
|
||||
Requires at least GCC 11 or Clang 16.
|
||||
|
||||
Note that GNU make (`gmake`) is required to compile on FreeBSD.
|
||||
|
||||
|
@ -904,7 +904,7 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
|
|||
|
||||
## Compilation OpenBSD
|
||||
|
||||
Requires at least GCC 10.
|
||||
Requires at least GCC 11.
|
||||
|
||||
Note that GNU make (`gmake`) is required to compile on OpenBSD.
|
||||
|
||||
|
|
26
src/btop.cpp
26
src/btop.cpp
|
@ -33,17 +33,13 @@ tab-size = 4
|
|||
#include <tuple>
|
||||
#include <regex>
|
||||
#include <chrono>
|
||||
#include <semaphore>
|
||||
#include <utility>
|
||||
#ifdef __APPLE__
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <mach-o/dyld.h>
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#if !defined(__clang__) && __GNUC__ < 11
|
||||
#include <semaphore.h>
|
||||
#else
|
||||
#include <semaphore>
|
||||
#endif
|
||||
|
||||
#include "btop_shared.hpp"
|
||||
#include "btop_tools.hpp"
|
||||
|
@ -424,18 +420,7 @@ namespace Runner {
|
|||
atomic<bool> redraw (false);
|
||||
atomic<bool> coreNum_reset (false);
|
||||
|
||||
//* Setup semaphore for triggering thread to do work
|
||||
#if !defined(__clang__) && __GNUC__ < 11
|
||||
sem_t do_work;
|
||||
inline void thread_sem_init() { sem_init(&do_work, 0, 0); }
|
||||
inline void thread_wait() { sem_wait(&do_work); }
|
||||
inline void thread_trigger() { sem_post(&do_work); }
|
||||
#else
|
||||
std::binary_semaphore do_work(0);
|
||||
inline void thread_sem_init() { ; }
|
||||
inline void thread_wait() { do_work.acquire(); }
|
||||
inline void thread_trigger() { do_work.release(); }
|
||||
#endif
|
||||
std::binary_semaphore sem { 0 };
|
||||
|
||||
//* RAII wrapper for pthread_mutex locking
|
||||
class thread_lock {
|
||||
|
@ -553,7 +538,7 @@ namespace Runner {
|
|||
|
||||
//* ----------------------------------------------- THREAD LOOP -----------------------------------------------
|
||||
while (not Global::quitting) {
|
||||
thread_wait();
|
||||
sem.acquire();
|
||||
atomic_wait_for(active, true, 5000);
|
||||
if (active) {
|
||||
Global::exit_error_msg = "Runner thread failed to get active lock!";
|
||||
|
@ -840,7 +825,7 @@ namespace Runner {
|
|||
|
||||
if (Menu::active and not current_conf.background_update) Global::overlay.clear();
|
||||
|
||||
thread_trigger();
|
||||
sem.release();
|
||||
atomic_wait_for(active, false, 10);
|
||||
}
|
||||
|
||||
|
@ -868,7 +853,7 @@ namespace Runner {
|
|||
clean_quit(1);
|
||||
}
|
||||
}
|
||||
thread_trigger();
|
||||
sem.release();
|
||||
atomic_wait_for(active, false, 100);
|
||||
atomic_wait_for(active, true, 100);
|
||||
}
|
||||
|
@ -1077,7 +1062,6 @@ int main(int argc, char **argv) {
|
|||
pthread_sigmask(SIG_BLOCK, &mask, &Input::signal_mask);
|
||||
|
||||
//? Start runner thread
|
||||
Runner::thread_sem_init();
|
||||
if (pthread_create(&Runner::runner_id, nullptr, &Runner::_runner, nullptr) != 0) {
|
||||
Global::exit_error_msg = "Failed to create _runner thread!";
|
||||
clean_quit(1);
|
||||
|
|
|
@ -191,7 +191,7 @@ namespace Menu {
|
|||
{"z", "Toggle totals reset for current network device"},
|
||||
{"a", "Toggle auto scaling for the network graphs."},
|
||||
{"y", "Toggle synced scaling mode for network graphs."},
|
||||
{"f, /", "To enter a process filter."},
|
||||
{"f, /", "To enter a process filter. Start with ! for regex."},
|
||||
{"delete", "Clear any entered filter."},
|
||||
{"c", "Toggle per-core cpu usage of processes."},
|
||||
{"r", "Reverse sorting order in processes box."},
|
||||
|
|
|
@ -158,9 +158,11 @@ namespace Gpu {
|
|||
|
||||
//? AMD data collection
|
||||
namespace Rsmi {
|
||||
|
||||
//? RSMI defines, structs & typedefs
|
||||
#define RSMI_DEVICE_NAME_BUFFER_SIZE 128
|
||||
|
||||
#if !defined(RSMI_STATIC)
|
||||
//? RSMI defines, structs & typedefs
|
||||
#define RSMI_DEVICE_NAME_BUFFER_SIZE 128
|
||||
#define RSMI_MAX_NUM_FREQUENCIES_V5 32
|
||||
#define RSMI_MAX_NUM_FREQUENCIES_V6 33
|
||||
#define RSMI_STATUS_SUCCESS 0
|
||||
|
|
Loading…
Reference in New Issue