Skip to content

Commit

Permalink
- Fix clocking of timer when doing cumulative loads in `loaddefinitio…
Browse files Browse the repository at this point in the history
…nsfile()`.
  • Loading branch information
mjr4077au committed Apr 22, 2021
1 parent 733f4f7 commit 6fca2de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/core/defparser.cpp
Expand Up @@ -2126,12 +2126,12 @@ void loaddefinitionsfile(const char* fn, bool cumulative)

cycle_t deftimer;
deftimer.Reset();
deftimer.Clock();

auto printtimer = [&](const char* fn)
{
deftimer.Unclock();
DPrintf(DMSG_SPAMMY, "Definitions file \"%s\" loaded, %f ms.\n", fn, deftimer.TimeMS());
deftimer.Reset();
};

if (!cumulative)
Expand All @@ -2140,6 +2140,7 @@ void loaddefinitionsfile(const char* fn, bool cumulative)
if (lump >= 0)
{
Printf(PRINT_NONOTIFY, "Loading \"%s\"\n", fn);
deftimer.Clock();
parseit(lump);
printtimer(fn);
}
Expand All @@ -2150,6 +2151,7 @@ void loaddefinitionsfile(const char* fn, bool cumulative)
while ((lump = fileSystem.FindLumpFullName(fn, &lastlump)) >= 0)
{
Printf(PRINT_NONOTIFY, "Loading \"%s\"\n", fileSystem.GetFileFullPath(lump).GetChars());
deftimer.Clock();
parseit(lump);
printtimer(fn);
}
Expand Down

0 comments on commit 6fca2de

Please sign in to comment.