summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qelapsedtimer_unix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move QElapsedTimer to src/corelib/kernelThiago Macieira2016-07-021-251/+0
| | | | | | | | | | | | It's really a kernel functionality, as it implements really low-level functionality and it's used by the event dispatcher. It was in tools/ only because QTime is. QDeadlineTimer is also coming to kernel/. Change-Id: Ifea6e497f11a461db432ffff14491c6d9b839eb0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-05-191-3/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp src/network/access/qnetworkaccessmanager.cpp src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h src/widgets/widgets/qlineedit_p.cpp src/widgets/widgets/qlineedit_p.h src/winmain/winmain.pro tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp tools/configure/configureapp.cpp Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a
| * Compile fix: remove _POSIX_C_SOURCE usageRalf Nolden2016-05-171-3/+0
| | | | | | | | | | | | | | | | | | | | | | Remove _POSIX_C_SOURCE usage as the reason why it was added is not clear anymore and it causes compile errors on BSD systems if not circumvented by adding further defines to re-enable function calls hidden by the _POSIX_C_SOURCE define. (__BSD_VISIBLE on FreeBSD/OpenBSD and _NETBSD_SOURCE on NetBSD) Change-Id: Ic6b49ddcd6c481b0f2acd598cea5470604e00507 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Don't bother asking if Linux supports a monotonic clock: it doesThiago Macieira2016-04-301-1/+5
| | | | | | | | | | | | Change-Id: Id5480807d25e49e78b79ffff144a0e61bd001dff Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | | | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-12-291-16/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/kernel/qplatformsystemtrayicon.cpp src/gui/kernel/qplatformsystemtrayicon.h src/plugins/platforms/xcb/xcb-plugin.pro Change-Id: I00355d3908b678af8a61c38f9e814a63df808c79
| * QNX: Revert the change to give higher precision timers.Roger Maclean2014-12-241-16/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous change (SHA 82c2118c) to provide better than 1ms accuracy for timers on QNX is not safe. According to the docs, ClockCycles is not guaranteed to return consistent information if called from different CPUs. While this can be addressed by locking the thread to a single CPU, you wouldn't want to do that here. On some systems (e.g. BB10) the behavior is extremely bad since ClockCycles only has 32 bits of precision. This results in overflows in the calculations making short timers run very slowly (16ms timers were around 1s). Also ClockCycles wraps in under three minutes causing even more problems. I've talked to the kernel developers and there is currently nothing that will give you better than 1ms accuracy. An individual program could use ClockCycles to calculate more accurate times if they want. It's not clear to me what benefit one would get with increased accuracy. Unless I've missed something, these times are only used to calculate timeouts for calls such as select. These timeouts will themselves have the same resolution as clock_gettime provides so the increased accuracy would appear to be for naught. Change-Id: Ia38b154ca41949becbd0b8558a9ff4ddd5e01a43 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bernd Weimer <bweimer@blackberry.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-241-2/+17
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice.cpp src/plugins/bearer/linux_common/qofonoservice_linux.cpp src/plugins/bearer/linux_common/qofonoservice_linux_p.h src/plugins/platforms/android/qandroidplatformtheme.cpp src/tools/bootstrap/bootstrap.pro src/widgets/styles/qmacstyle_mac.mm Change-Id: Ia02aab6c4598ce74e9c30bb4666d5e2ef000f99b
| * Improve QElapsedTimer resolution on QNXMatt Fischer2014-11-071-2/+17
| | | | | | | | | | | | | | | | | | | | | | The standard POSIX clock functions are present on QNX, but only return timing information with millisecond accuracy. To get accuracy beyond that, platform-specific functions must be used. Change-Id: I54a0550f1865dbea3c60a86ecd8ad99df3fe42b4 Reviewed-by: Frank Osterfeld <frank.osterfeld@kdab.com> Reviewed-by: Bernd Weimer <bweimer@blackberry.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* | QElapsedTimer/Unix: Improve accuracy for millisecond valuesJonathan Liu2014-11-041-10/+4
|/ | | | | | Task-number: QTBUG-42365 Change-Id: Iee390bc0014e32b3bc5ef144ea9e1c677ab66278 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Switch to struct timespec everywhere instead of timevalThiago Macieira2013-01-281-3/+3
| | | | | | | | | | | | This avoids an extra division by 1000 when getting the current time. This can't overflow, under normal circumstances, even on 32-bit: when adding two values less than 1 billion, the result is less than 2 billion, which is less than 2^31. Change-Id: I6f8e1aadfe2fcf6ac8da584eab4c1e61aee51cbb Reviewed-by: David Faure (KDE) <faure@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2013-01-231-1/+1
|\ | | | | | | refs/staging/dev
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Use stub function gettimeofday for VxWorksPasi Petäjäjärvi2013-01-231-0/+4
|/ | | | | | | | Vxworks does not have gettimeofday function, use function implementation from qfunctions_vxworks.h/cpp instead. Change-Id: Iad2a71c8484ba00dd9406706b1c136297260de4b Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Fix some typosSergio Ahumada2012-12-211-1/+1
| | | | | Change-Id: I4e8d9bd8ea66ec810e4f1fbfd8ddbf25c4b3d980 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
* QElapsedTimer: Instead of two ints, store only the clock typeThiago Macieira2012-10-101-46/+82
| | | | | | | | | | | | | | | | | | 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: Olivier Goffart <ogoffart@woboq.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Use nanosleep instead of pthread_cond_timedwait for thread sleepingThiago Macieira2012-08-251-0/+14
| | | | | | | | | | | | | | | There's a comment saying nanosleep's availability is questionable, but the information of what systems don't have that is now lost in time. It's quite likely that they were older, Unix systems we no longer support anyway. nanosleep comes from POSIX.1b-1993, which is merged into POSIX.1-2001, so chances are that it's supported almost everywhere where Qt runs (except for Windows anyway). Change-Id: I4fd18f8715c43a42429000f3b3d2c3b7343f94b4 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Fix declaration of qt_gettime for Q_DECL_NOTHROWThiago Macieira2012-08-131-0/+2
| | | | | | | | Since the #include wasn't present in the qelapsedtimer_{mac,unix}.cpp files, we did not notice that the declaration missed the macro. Change-Id: I3e4f23b28e127d41b12690cf306f47986be53d89 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Make QElapsedTimer always store nanoseconds in t2Thiago Macieira2012-08-131-18/+15
| | | | | | | | | | | | | Up until now, the value stored in t2 depended on whether we had found a monotonic clock or not. Fix that by always storing nanoseconds: we avoid extra calculations and accessing a global variable all the time. The impact is contained to the actual getting of the time. And we mitigate by using clock_gettime to get the realtime clock instead of gettimeofday, if that's available. Change-Id: Iceef2d050fd9472f1a66e11e7ded79fe5163a132 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Use Q_LIKELY instead of doing an #ifdef for GCCThiago Macieira2012-08-101-7/+2
| | | | | | | | This code predated the Q_LIKELY macro. Now that we have it, use the official macro. Change-Id: I0e43609f8d6827f8fef7b928655a965cba579b8d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Mark QElapsedTimer functions as Q_DECL_NOTHROWThiago Macieira2012-08-091-11/+11
| | | | | | | | | | | | | | | | | | All functions in QElapsedTimer are marked Q_DECL_NOTHROW. This code is often introduced in many places to deal with timeouts and doesn't need exception handlers. In particular, it's used in QMutex locking. In addition, mark QDateTime::currentMSecsSinceEpoch as nothrow, as it can't throw exceptions either and it is needed by the generic QElapsedTimer. Q{Date,Time}::current{Date,Time} operate on local time and run into at least one cancellation point, which we must consider throwing. And returning a QDateTime allocates memory. Change-Id: Id776c5ec831fc06d7419a9ff5442d9b35cff1a22 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+209
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12