Commit 66324e30 authored by Thiago Macieira's avatar Thiago Macieira Committed by The Qt Project
Browse files

QElapsedTimer: Instead of two ints, store only the clock type


We don't need two ints if we can do it with one. We need to store only
the clock type to be used, which is either CLOCK_MONOTONIC or
CLOCK_REALTIME. In addition, we need an invalid value to indicate that
the test hasn't been done yet.

This also gets rid of an atomic that wasn't QBasicAtomicInt.

Disassembly of the compiled code indicates this is the most optimal
solution:
 - one single variable load
 - one test-and-branch to verify that a test is needed
 - straight call to clock_gettime afterwards

Change-Id: I49788e45b50b6b7fcb7ba4e9332e5352a4428933
Reviewed-by: default avatarOlivier Goffart <ogoffart@woboq.com>
parent 4ec79a15
No related merge requests found
Showing with 82 additions and 46 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment