Page MenuHomeWildfire Games

Allow calling timer_DisplayClientTotals multiple times
ClosedPublic

Authored by echotangoecho on Aug 20 2017, 4:46 PM.

Details

Summary

Currently timer_DisplayClientTotals() only works a single time as it modifies some globals, this allows it to be called multiple times.

Test Plan

Verify that calling timer_DisplayClientTotals() multiple times does indeed work.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

echotangoecho created this revision.Aug 20 2017, 4:46 PM
Vulcan added a subscriber: Vulcan.Aug 20 2017, 7:29 PM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...

http://jw:8080/job/phabricator/1889/ for more details.

vladislavbelov added inline comments.Sep 16 2017, 2:41 PM
source/lib/timer.cpp
192 ↗(On Diff #3209)

Why was this removed? It looks like an additional check. Also if you removed the decreasing, this line is invalid:

ENSURE(numClients != 0);

Because numClients isn't changed in the function.

The check is unneeded, as the list is only modified in timer_AddClient. (and both clients / numClients are static, so will be zero-initialized).

wraitii accepted this revision.May 14 2018, 11:39 AM

Tested this a while back and it worked, I'll commit it at some point.

This revision is now accepted and ready to land.May 14 2018, 11:39 AM
In D812#60971, @wraitii wrote:

Tested this a while back and it worked, I'll commit it at some point.

(Don't forget to assess correctness, completeness and improveability before a commit)

source/lib/timer.cpp
1 ↗(On Diff #5487)

8

Stan added a subscriber: Stan.May 10 2019, 8:40 AM

@wraitii Still good to go or missing stuff ?

vladislavbelov accepted this revision.Dec 12 2019, 4:00 PM

According to the comment V it seems that the function had the wrong behaviour.

/**
 * display all clients' totals; does not reset them.
 * typically called at exit.
 **/
LIB_API void timer_DisplayClientTotals();
source/lib/timer.cpp
187 ↗(On Diff #5487)
for (TimerClient* tc = clients; tc; tc = tc->next)
{
    // ...
}
vladislavbelov added inline comments.Dec 12 2019, 4:01 PM
source/lib/timer.cpp
1 ↗(On Diff #5487)

9

This revision was automatically updated to reflect the committed changes.