Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPUTimer: switch to clock_gettime #4667

Merged
merged 1 commit into from Jul 17, 2014

Conversation

fwyzard
Copy link
Contributor

@fwyzard fwyzard commented Jul 16, 2014

  • switch from gettimeofday/getrusage to clock_gettime, with the same speed but better accuracy (at least on x86_64 Linux)
  • switch from clock_gettime(CLOCK_REALTIME) to clock_gettime(CLOCK_MONOTONIC), with a very similar performance, but conceptually more sound

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @fwyzard (Andrea Bocci) for CMSSW_7_2_X.

CPUTimer: switch to clock_gettime

It involves the following packages:

FWCore/Utilities

@cmsbuild, @Degano, @Dr15Jones, @ktf, @nclopezo can you please review it and eventually sign? Thanks.
@wddgit, @wmtan this is something you requested to watch as well.
You can sign-off by replying to this message having '+1' in the first line of your reply.
You can reject by replying to this message having '-1' in the first line of your reply.

@fwyzard
Copy link
Contributor Author

fwyzard commented Jul 16, 2014

Here is the speed and resolution of the real-time and cpu-time clocks used by CPUTimer, as measured by $CMSSW_RELEASE_BASE/test/$SCRAM_ARCH/testChrono .

CMSSW 7.2.x on lxplus (SLC6, virtual machine)

Linux 2.6.32-431.17.1.el6.x86_64 x86_64
glibc version: 2.12
clock source: kvm-clock
For each timer the resolution reported is the MINIMUM (MEDIAN) (MEAN +/- its STDDEV) of the increments measured during the test.

Performance of clock_gettime(CLOCK_REALTIME)
Average time per call: 328.8 ns
Clock tick period: 1.0 ns
Measured resolution: 312.0 ns (median: 319.0 ns) (sigma: 351.9 ns) (average: 328.8 +/- 0.4 ns)

Performance of clock_gettime(CLOCK_MONOTONIC)
Average time per call: 324.7 ns
Clock tick period: 1.0 ns
Measured resolution: 311.0 ns (median: 317.0 ns) (sigma: 396.4 ns) (average: 324.7 +/- 0.4 ns)

Performance of clock_gettime(CLOCK_PROCESS_CPUTIME_ID)
Average time per call: 473.2 ns
Clock tick period: 1.0 ns
Measured resolution: 455.0 ns (median: 461.0 ns) (sigma: 367.9 ns) (average: 472.7 +/- 0.4 ns)

Performance of gettimeofday()
Average time per call: 351.1 ns
Clock tick period: 1000.0 ns
Measured resolution: 1000.0 ns (median: 1000.0 ns) (sigma: 519.5 ns) (average: 1020.9 +/- 0.9 ns)

Performance of getrusage(RUSAGE_SELF)
Average time per call: 466.9 ns
Clock tick period: 1000.0 ns
Measured resolution: 999000.0 ns (median: 1000000.0 ns) (sigma: 359.4 ns) (average: 999848.0 +/- 16.6 ns)

CMSSW 7.1.1 on an HLT machine (SLC6, Sandy Bridge Xeon)

Linux 2.6.32-358.11.1.el6.x86_64 x86_64
glibc version: 2.12
clock source: tsc
For each timer the resolution reported is the MINIMUM (MEDIAN) (MEAN +/- its STDDEV) of the increments measured during the test.

Performance of clock_gettime(CLOCK_REALTIME)
Average time per call: 28.7 ns
Clock tick period: 1.0 ns
Measured resolution: 26.0 ns (median: 29.0 ns) (sigma: 10.5 ns) (average: 28.7 +/- 0.1 ns)

Performance of clock_gettime(CLOCK_MONOTONIC)
Average time per call: 30.0 ns
Clock tick period: 1.0 ns
Measured resolution: 26.0 ns (median: 30.0 ns) (sigma: 16.4 ns) (average: 30.0 +/- 0.1 ns)

Performance of clock_gettime(CLOCK_PROCESS_CPUTIME_ID)
Average time per call: 168.5 ns
Clock tick period: 1.0 ns
Measured resolution: 160.0 ns (median: 168.0 ns) (sigma: 19.2 ns) (average: 168.1 +/- 0.1 ns)

Performance of gettimeofday()
Average time per call: 30.3 ns
Clock tick period: 1000.0 ns
Measured resolution: 1000.0 ns (median: 1000.0 ns) (sigma: 50.5 ns) (average: 1001.3 +/- 0.3 ns)

Performance of getrusage(RUSAGE_SELF)
Average time per call: 187.6 ns
Clock tick period: 1000.0 ns
Measured resolution: 999000.0 ns (median: 1000000.0 ns) (sigma: 357.8 ns) (average: 999850.3 +/- 26.2 ns)

@Dr15Jones
Copy link
Contributor

+1

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_2_X IBs unless changes or unless it breaks tests.

@cmsbuild
Copy link
Contributor

-1

Tested at: cc3b07d
I ran the usual tests and I found errors in the following unit tests:

---> test TestFWCoreServicesDriver had ERRORS

you can see the results of the tests here:
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-4667/353/summary.html

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_2_X IBs unless changes (but tests are reportedly failing).

  - switch from gettimeofday/getrusage to clock_gettime,
    with the same speed but better accuracy (at least on x86_64 Linux)
  - switch from clock_gettime(CLOCK_REALTIME) to clock_gettime(CLOCK_MONOTONIC)
    with a very similar performance, but conceptually more sound
@cmsbuild
Copy link
Contributor

Pull request #4667 was updated. @cmsbuild, @Degano, @Dr15Jones, @ktf, @nclopezo can you please check and sign again.

@fwyzard
Copy link
Contributor Author

fwyzard commented Jul 16, 2014

Fixed (and tested) - sorry about that.

@Dr15Jones
Copy link
Contributor

+1
On vacation

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_2_X IBs unless changes or unless it breaks tests.

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_2_X IBs unless changes or unless it breaks tests.

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_7_2_X IBs unless changes (tests are also fine).

ktf added a commit that referenced this pull request Jul 17, 2014
@ktf ktf merged commit 3bee217 into cms-sw:CMSSW_7_2_X Jul 17, 2014
@cmsbuild
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants