Page MenuHomeWildfire Games

pthread -> std::thread (7/7) - Remove clock frequency calculations and remove last usage of pthread
Needs ReviewPublic

Authored by wraitii on May 26 2019, 7:26 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

CPU clock frequency is calculated in an effort to do... Pretty much nothing in the end. The timer fonction ToSeconds is never called and it is not used in hwdetect.js (in general I think we're better off detecting CPU models than trying to guess clock frequency - same applies to most other variables there but that can be cleaned up later).

This removes the last usage of pthread in 0 A.D. code. A later diff will remove the headers.

Test Plan

Compile, review.

Diff Detail

Event Timeline

wraitii created this revision.May 26 2019, 7:26 PM

I think we had that discussion already with @vladislavbelov, and he was for removing the detection, but what about people overclocking their CPUs ?

In D1923#79494, @Stan wrote:

I think we had that discussion already with @vladislavbelov, and he was for removing the detection, but what about people overclocking their CPUs ?

I don't think we care about CPU frequency at all is my point. Where we need precise timing we should use std::chrono stuff moving forward. For toggling features, relying on CPU model is more reliable and anyways we mostly toggle graphical features.

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/lib/sysdep/arch/x86_x64/x86_x64.h
|   1| /*·Copyright·(C)·2010·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2010"

source/lib/sysdep/os_cpu.h
|   1| /*·Copyright·(C)·2010·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2010"

source/lib/sysdep/os_cpu.cpp
|   1| /*·Copyright·(C)·2010·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2010"

source/lib/timer.h
|   1| /*·Copyright·(C)·2010·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2010"

source/lib/sysdep/arch/x86_x64/x86_x64.cpp
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"

source/ps/Util.cpp
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1516/display/redirect