Skip to content

Commit

Permalink
Added "-logTimedemo" option to save the benchmark result onto the fil…
Browse files Browse the repository at this point in the history
…e "bench.txt". With this it's possible to run multiple FastDoom benchmarks in a batch and save the results in a single text file.
  • Loading branch information
viti95 committed Sep 15, 2020
1 parent 57ac7a1 commit a12b893
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ boolean forceLowDetail;
boolean forcePotatoDetail;
int forceScreenSize;

boolean logTimedemo;

boolean uncappedFPS;

Expand Down Expand Up @@ -790,6 +791,8 @@ void D_DoomMain(void)

reverseStereo = M_CheckParm("-reverseStereo");

logTimedemo = M_CheckParm("-logTimedemo");

if ((p = M_CheckParm("-size")))
{
if (p < myargc - 1)
Expand Down
2 changes: 2 additions & 0 deletions doomstat.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ extern boolean forceLowDetail;
extern boolean forcePotatoDetail;
extern int forceScreenSize;

extern boolean logTimedemo;

extern boolean uncappedFPS;

// Set if homebrew PWAD stuff has been added.
Expand Down
14 changes: 12 additions & 2 deletions g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,8 +1248,18 @@ boolean G_CheckDemoStatus(void)
realtics = endtime - starttime;

resultfps = FixedMul(FixedDiv(gametic << FRACBITS, realtics << FRACBITS), 35 << FRACBITS);

I_Error("Timed %i gametics in %i realtics. FPS: %i.%03i", gametic, realtics, resultfps >> FRACBITS, ((resultfps & 65535)*1000) >> FRACBITS);

if (logTimedemo)
{
FILE *logFile = fopen("bench.txt", "a");
if (logFile)
{
fprintf(logFile, "Timed %i gametics in %i realtics. FPS: %i.%03i\n", gametic, realtics, resultfps >> FRACBITS, ((resultfps & 65535) * 1000) >> FRACBITS);
fclose(logFile);
}
}

I_Error("Timed %i gametics in %i realtics. FPS: %i.%03i", gametic, realtics, resultfps >> FRACBITS, ((resultfps & 65535) * 1000) >> FRACBITS);
}

if (demoplayback)
Expand Down

0 comments on commit a12b893

Please sign in to comment.