* @brief Linux analog of the Windows EcoQoS opt-out: raises the scheduler utilization clamp so * EAS places the main thread on a big core. Unprivileged (>= 5.3); failures ignored. */
| 340 | * EAS places the main thread on a big core. Unprivileged (>= 5.3); failures ignored. |
| 341 | */ |
| 342 | static void enableLinuxPerformanceMode() |
| 343 | { |
| 344 | # ifdef SYS_sched_setattr |
| 345 | struct SchedAttr { |
| 346 | uint32_t size; |
| 347 | uint32_t sched_policy; |
| 348 | uint64_t sched_flags; |
| 349 | int32_t sched_nice; |
| 350 | uint32_t sched_priority; |
| 351 | uint64_t sched_runtime; |
| 352 | uint64_t sched_deadline; |
| 353 | uint64_t sched_period; |
| 354 | uint32_t sched_util_min; |
| 355 | uint32_t sched_util_max; |
| 356 | }; |
| 357 | |
| 358 | constexpr uint64_t kKeepPolicy = 0x08; |
| 359 | constexpr uint64_t kKeepParams = 0x10; |
| 360 | constexpr uint64_t kUtilClampMin = 0x20; |
| 361 | |
| 362 | SchedAttr attr = {}; |
| 363 | attr.size = sizeof(attr); |
| 364 | attr.sched_flags = kKeepPolicy | kKeepParams | kUtilClampMin; |
| 365 | attr.sched_util_min = 1024; |
| 366 | |
| 367 | (void)syscall(SYS_sched_setattr, 0, &attr, 0); |
| 368 | # endif |
| 369 | } |
| 370 | |
| 371 | #endif |
| 372 |
no outgoing calls
no test coverage detected