GSRunner: Write log and disable cache in parallel runs

This commit is contained in:
Connor McLaughlin 2022-10-22 21:34:03 +10:00 committed by refractionpcsx2
parent 5e9710a8c6
commit dc8cdc95d0
2 changed files with 39 additions and 4 deletions

View File

@ -129,6 +129,13 @@ bool GSRunner::InitializeConfig()
si.SetBoolValue("EmuCore/GS", "OsdShowResolution", true);
si.SetBoolValue("EmuCore/GS", "OsdShowGSStats", true);
// remove memory cards, so we don't have sharing violations
for (u32 i = 0; i < 2; i++)
{
si.SetBoolValue("MemoryCards", fmt::format("Slot{}_Enable", i + 1).c_str(), false);
si.SetStringValue("MemoryCards", fmt::format("Slot{}_Filename", i + 1).c_str(), "");
}
CommonHost::LoadStartupSettings();
return true;
}
@ -436,6 +443,8 @@ static void PrintCommandLineHelp(const char* progname)
std::fprintf(stderr, " -renderer <renderer>: Sets the graphics renderer. Defaults to Auto.\n");
std::fprintf(stderr, " -window: Forces a window to be displayed.\n");
std::fprintf(stderr, " -surfaceless: Disables showing a window.\n");
std::fprintf(stderr, " -logfile <filename>: Writes emu log to filename.\n");
std::fprintf(stderr, " -noshadercache: Disables the shader cache (useful for parallel runs).\n");
std::fprintf(stderr, " --: Signals that no more arguments will follow and the remaining\n"
" parameters make up the filename. Use when the filename contains\n"
" spaces or starts with a dash.\n");
@ -522,6 +531,26 @@ static bool ParseCommandLineArgs(int argc, char* argv[], VMBootParameters& param
s_settings_interface.SetIntValue("EmuCore/GS", "Renderer", static_cast<int>(type));
continue;
}
else if (CHECK_ARG_PARAM("-logfile"))
{
const char* logfile = argv[++i];
if (std::strlen(logfile) > 0)
{
// disable timestamps, since we want to be able to diff the logs
Console.WriteLn("Logging to %s...", logfile);
CommonHost::SetFileLogPath(logfile);
s_settings_interface.SetBoolValue("Logging", "EnableFileLogging", true);
s_settings_interface.SetBoolValue("Logging", "EnableTimestamps", false);
}
continue;
}
else if (CHECK_ARG("-noshadercache"))
{
Console.WriteLn("Disabling shader cache");
s_settings_interface.SetBoolValue("EmuCore/GS", "disable_shader_cache", false);
continue;
}
else if (CHECK_ARG("-window"))
{
Console.WriteLn("Creating window");
@ -608,6 +637,7 @@ int main(int argc, char* argv[])
return false;
}
// apply new settings (e.g. pick up renderer change)
VMManager::ApplySettings();
if (VMManager::Initialize(params))

View File

@ -16,24 +16,29 @@ def is_gs_path(path):
return False
def run_regression_test(runner, dumpdir, renderer, gspath):
def run_regression_test(runner, dumpdir, renderer, parallel, gspath):
args = [runner]
gsname = Path(gspath).name
while gsname.rfind('.') >= 0:
gsname = gsname[:gsname.rfind('.')]
real_dumpdir = os.path.join(dumpdir, gsname)
real_dumpdir = os.path.join(dumpdir, gsname).strip()
if not os.path.exists(real_dumpdir):
os.mkdir(real_dumpdir)
if renderer is not None:
args.extend(["-renderer", renderer])
args.extend(["-dumpdir", real_dumpdir])
args.extend(["-logfile", os.path.join(real_dumpdir, "emulog.txt")])
# loop a couple of times for those stubborn merge/interlace dumps that don't render anything
# the first time around
args.extend(["-loop", "2"])
# disable shader cache for parallel runs, otherwise it'll have sharing violations
if parallel > 1:
args.append("-noshadercache")
args.append("--")
args.append(gspath)
@ -52,10 +57,10 @@ def run_regression_tests(runner, gsdir, dumpdir, renderer, parallel=1):
if parallel <= 1:
for game in gamepaths:
run_regression_test(runner, dumpdir, renderer, game)
run_regression_test(runner, dumpdir, renderer, parallel, game)
else:
print("Processing %u games on %u processors" % (len(gamepaths), parallel))
func = partial(run_regression_test, runner, dumpdir, renderer)
func = partial(run_regression_test, runner, dumpdir, renderer, parallel)
pool = multiprocessing.Pool(parallel)
pool.map(func, gamepaths)
pool.close()