mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Add a function for fetching the RTTIME limit
We can use this to more easily diagnose issues caused by PipeWire.
This commit is contained in:
@@ -48,6 +48,15 @@ bool set_realtime_priority(bool sched_fifo, int priority) noexcept {
|
|||||||
¶ms) == 0;
|
¶ms) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<rlim_t> get_rttime_limit() noexcept {
|
||||||
|
rlimit limits{};
|
||||||
|
if (getrlimit(RLIMIT_RTTIME, &limits) == 0) {
|
||||||
|
return limits.rlim_cur;
|
||||||
|
} else {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool pid_running(pid_t pid) {
|
bool pid_running(pid_t pid) {
|
||||||
// With regular individually hosted plugins we can simply check whether the
|
// With regular individually hosted plugins we can simply check whether the
|
||||||
// process is still running, however Boost.Process does not allow you to do
|
// process is still running, however Boost.Process does not allow you to do
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
#include <sys/resource.h>
|
||||||
|
|
||||||
#ifdef __WINE__
|
#ifdef __WINE__
|
||||||
#include "../wine-host/boost-fix.h"
|
#include "../wine-host/boost-fix.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -86,6 +88,18 @@ boost::filesystem::path get_temporary_directory();
|
|||||||
*/
|
*/
|
||||||
std::optional<int> get_realtime_priority() noexcept;
|
std::optional<int> get_realtime_priority() noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the (soft) `RTTIME` resource limit, or the amount of time a `SCHED_FIFO`
|
||||||
|
* process may spend uninterrupted before being killed by the scheduler. A value
|
||||||
|
* of `-1`/`RLIM_INFINITY` means that there is no limit. If there was some error
|
||||||
|
* fetching this value, then a nullopt will be returned.
|
||||||
|
*
|
||||||
|
* This is useful to diagnose issues caused by PipeWire. They use rtkit at the
|
||||||
|
* moment, and both rtkit and PipeWire's rtkit module will enable a realtime CPU
|
||||||
|
* time limit with some low value.
|
||||||
|
*/
|
||||||
|
std::optional<rlim_t> get_rttime_limit() noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the scheduling policy to `SCHED_FIFO` with priority 5 for this process.
|
* Set the scheduling policy to `SCHED_FIFO` with priority 5 for this process.
|
||||||
* We explicitly don't do this for wineserver itself since from my testing that
|
* We explicitly don't do this for wineserver itself since from my testing that
|
||||||
|
|||||||
Reference in New Issue
Block a user