Skip to content

Commit

Permalink
perf: Ignore some system processes
Browse files Browse the repository at this point in the history
Ignoring system processes from going through our auto game detection should in theory improve performance and create less logging trash.

This does not catch all cases because some processes are protected and do not show us our executablePath here.
  • Loading branch information
lulzsun committed Aug 5, 2022
1 parent 31731d8 commit ac7c3cc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Classes/Recorders/BaseRecorder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ public void ProcessCreation_EventArrived(object sender, EventArrivedEventArgs e)
var executablePath = instanceDescription.GetPropertyValue("ExecutablePath");
var cmdLine = instanceDescription.GetPropertyValue("CommandLine"); // may or may not be useful in the future

AutoDetectGame(processId);
if (executablePath != null) {
if (executablePath.ToString().ToLower().StartsWith(@"c:\windows\")) { // if this program is starting from here,
return; // we can assume it is not a game
}
AutoDetectGame(processId, executablePath.ToString());
}
else if (processId != 0)
AutoDetectGame(processId);
}
}
catch (ManagementException) { }
Expand Down

0 comments on commit ac7c3cc

Please sign in to comment.