MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / enableLinuxPerformanceMode

Function enableLinuxPerformanceMode

app/src/Platform/AppPlatform.cpp:342–369  ·  view source on GitHub ↗

* @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. */

Source from the content-addressed store, hash-verified

340 * EAS places the main thread on a big core. Unprivileged (>= 5.3); failures ignored.
341 */
342static 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

Callers 1

prepareEnvironmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected