The process runs above normal priority, pipeline workers below the title's loading
VICTORY_PROCESS_PRIORITY=normal and VICTORY_PIPELINE_LOWEST=0 for the old ways. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
0c46a8cfe0
commit
5b3e97f713
2 files changed
+25
-2
No files matched your search
@@ -318,11 +318,15 @@ fn workers() -> bool {
|
||||
let spawned = std::thread::Builder::new()
|
||||
.name(format!("victory-pipelines-{i}"))
|
||||
.spawn(|| {
|
||||
// Below the title's own threads (loading, recording).
|
||||
// Below the title's own threads (loading, recording),
|
||||
// and the streaming one, which is below normal itself
|
||||
// (`VICTORY_PIPELINE_LOWEST=0`: level with it, as before).
|
||||
let lowest = std::env::var_os("VICTORY_PIPELINE_LOWEST").is_none_or(|v| v != "0");
|
||||
// SAFETY: a plain call on our own thread.
|
||||
unsafe {
|
||||
use windows::Win32::System::Threading::*;
|
||||
let _ = SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
|
||||
let priority = if lowest { THREAD_PRIORITY_LOWEST } else { THREAD_PRIORITY_BELOW_NORMAL };
|
||||
let _ = SetThreadPriority(GetCurrentThread(), priority);
|
||||
}
|
||||
loop {
|
||||
next().make();
|
||||
|
||||
@@ -258,6 +258,25 @@ pub fn use_console_timers() {
|
||||
);
|
||||
timeBeginPeriod(1);
|
||||
}
|
||||
ahead_of_other_programs();
|
||||
}
|
||||
|
||||
/// The title's streaming thread runs below normal priority (on the console
|
||||
/// nobody else wants its core) and does all of the title's loading: a
|
||||
/// program that keeps the processors busy at normal priority (a build, a
|
||||
/// virus scan) starved it, loading took 40 to 60 s instead of 28 to 33, and
|
||||
/// the opening ran without the models that were to be there (runs cpu-1,
|
||||
/// play-1125-0203). The process runs above normal, as long as it runs.
|
||||
/// `VICTORY_PROCESS_PRIORITY=normal`: as it was started.
|
||||
#[cfg(windows)]
|
||||
fn ahead_of_other_programs() {
|
||||
use windows_sys::Win32::System::Threading::{ABOVE_NORMAL_PRIORITY_CLASS, GetCurrentProcess, SetPriorityClass};
|
||||
if std::env::var_os("VICTORY_PROCESS_PRIORITY").is_some_and(|v| v == "normal" || v == "0") {
|
||||
return;
|
||||
}
|
||||
// SAFETY: a plain process setting.
|
||||
let set = unsafe { SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS) } != 0;
|
||||
tracing::info!(set, "the process runs above normal priority (VICTORY_PROCESS_PRIORITY=normal: not)");
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in new issue
Block a user