summaryrefslogtreecommitdiff
path: root/rts/posix/GetTime.c
Commit message (Collapse)AuthorAgeFilesLines
* Make `PosixSource.h` installed and under `rts/`John Ericson2021-08-091-1/+1
| | | | | | is used outside of the rts so we do this rather than just fish it out of the repo in ad-hoc way, in order to make packages in this repo more self-contained.
* rts/posix/GetTime.c: Use Solaris-specific gethrvtime(3) on OpenSolaris ↵PHO2021-05-061-0/+10
| | | | | | derivatives The constant CLOCK_THREAD_CPUTIME_ID is defined in a system header but it isn't acutally usable. clock_gettime(2) always returns EINVAL.
* rts: Use proper relaxe operations in getCurrentThreadCPUTimewip/tsan/miscGHC GitLab CI2020-10-241-2/+4
| | | | | Here we are doing lazy initialization; it's okay if we do the check more than once, hence relaxed operation is fine.
* rts: Drop field initializer on thread_basic_info_data_tBen Gamari2020-09-191-1/+1
| | | | | This struct has a number of fields and we only care that the value is initialized with zeros. This eliminates the warnings noted in #17905.
* Fix build warning; add more informative information to the linker; fix ↵Moritz Angermann2020-04-221-1/+0
| | | | linker for empty sections
* rts: Prefer darwin-specific getCurrentThreadCPUTimeBen Gamari2020-03-111-15/+25
| | | | | | | macOS Catalina now supports a non-POSIX-compliant version of clock_gettime which cannot use the clock_gettime codepath. Fixes #17906.
* rts: Add getCurrentThreadCPUTime helperBen Gamari2020-03-051-21/+56
|
* Prefer #if defined to #ifdefBen Gamari2017-04-281-2/+2
| | | | Our new CPP linter enforces this.
* Enable new warning for fragile/incorrect CPP #if usageErik de Castro Lopo2017-04-281-1/+1
| | | | | | | | | | | | | | | | The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. Test Plan: Validate on Linux and Windows Reviewers: austin, angerman, simonmar, bgamari, Phyx Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3278
* Revert "Enable new warning for fragile/incorrect CPP #if usage"Ben Gamari2017-04-051-1/+1
| | | | | | | | This is causing too much platform dependent breakage at the moment. We will need a more rigorous testing strategy before this can be merged again. This reverts commit 7e340c2bbf4a56959bd1e95cdd1cfdb2b7e537c2.
* Enable new warning for fragile/incorrect CPP #if usageErik de Castro Lopo2017-04-051-1/+1
| | | | | | | | | | | | | | | | The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. Test Plan: Validate on Linux and Windows Reviewers: austin, angerman, simonmar, bgamari, Phyx Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3278
* Fix GetTime.c on Darwin with clock_gettimeMisty De Meo2016-07-051-2/+2
| | | | | | | | | On Darwin versions with clock_gettime, #ifdefs will prevent the mach-specific time functions from being used in most places, and the mach time headers won't be included; however, this section was guarded incorrectly and would still try to use them. Fixes #12195.
* rts: Replace `nat` with `uint32_t`Erik de Castro Lopo2016-05-051-1/+1
| | | | | | | | | | | | The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. Test Plan: Validated on Linux, OS X and Windows Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20 Differential Revision: https://phabricator.haskell.org/D2166
* Scrap IRIX supportHerbert Valerio Riedel2016-03-281-3/+3
| | | | | | | | | | | | | | | | Long time ago, IRIX was way ahead of its time in the last century with its SMP capabilities of scaling up to 1024 processors and other features such as XFS or OpenGL that originated in IRIX and live on to this day in other operating systems. However, IRIX's last software update was in 2006 and support ended around 2013 according to [1], so it's considered an extinct platform by now. So this commit message is effectively an obituary for GHC's IRIX support. R.I.P. IRIX [1]: https://en.wikipedia.org/wiki/IRIX
* rts: drop unused getThreadCPUTimeSergei Trofimovich2016-02-071-30/+0
| | | | | | | | | | | | | | | | Use of this helper function was removed in: commit 3c9fc104337a142fe4f375d30d7a6b81d55a70c1 Author: Brian Brooks <brooks.brian@gmail.com> Date: Thu Jul 10 02:55:33 2014 -0500 Avoid unnecessary clock_gettime() syscalls in GC stats. Noticed by uselex.rb: getThreadCPUTime: [R]: exported from: ./rts/dist/build/posix/GetTime.p_o Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* rts: Kill PAPI supportBen Gamari2015-11-181-24/+5
| | | | | | | | | | | | | | | This hasn't been used for a very long time and will soon be superceded by perf_events support. Test Plan: validate Reviewers: austin, simonmar Reviewed By: austin, simonmar Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D1493
* Revert "rts: add Emacs 'Local Variables' to every .c file"Simon Marlow2014-09-291-8/+0
| | | | This reverts commit 39b5c1cbd8950755de400933cecca7b8deb4ffcd.
* rts: add Emacs 'Local Variables' to every .c fileAustin Seipp2014-07-281-0/+8
| | | | | | | | This will hopefully help ensure some basic consistency in the forward by overriding buffer variables. In particular, it sets the wrap length, the offset to 4, and turns off tabs. Signed-off-by: Austin Seipp <austin@well-typed.com>
* rts: delint/detab/dewhitespace GetTime.cAustin Seipp2014-07-281-19/+26
| | | | Signed-off-by: Austin Seipp <austin@well-typed.com>
* Test return value of clock_gettime() for errors.Simon Marlow2014-04-041-3/+13
| | | | | I don't want to fall back to gettimeofday(), because that might have a different absolute value.
* More OS X build fixesIan Lynagh2012-09-141-1/+1
|
* Fix problems with getMonotonicNSec on OS XIan Lynagh2012-05-261-3/+5
| | | | | | | | | We were incorrectly multiplying by 1e9, which (a) meant we were getting values that were far too large, and (b) meant that when we casted from double to StgWord64 the result was 0, as the value was out of range. We now do all the work as StgWord64.
* Move getMonotonicUSec from base to the RTS.Paolo Capriotti2012-05-081-12/+24
|
* Use monotonic time function for darwin (#5865)Paolo Capriotti2012-04-161-0/+11
|
* Use monotonic clock in Select.c (#5865)Paolo Capriotti2012-04-161-12/+9
|
* add a missing error checkSimon Marlow2011-12-131-0/+3
|
* Time handling overhaulSimon Marlow2011-11-251-21/+17
| | | | | | | | | | | | | | | | | | | | | Terminology cleanup: the type "Ticks" has been renamed "Time", which is an StgWord64 in units of TIME_RESOLUTION (currently nanoseconds). The terminology "tick" is now used consistently to mean the interval between timer signals. The ticker now always ticks in realtime (actually CLOCK_MONOTONIC if we have it). Before it used CPU time in the non-threaded RTS and realtime in the threaded RTS, but I've discovered that the CPU timer has terrible resolution (at least on Linux) and isn't much use for profiling. So now we always use realtime. This should also fix The default tick interval is now 10ms, except when profiling where we drop it to 1ms. This gives more accurate profiles without affecting runtime too much (<1%). Lots of cleanups - the resolution of Time is now in one place only (Rts.h) rather than having calculations that depend on the resolution scattered all over the RTS. I hope I found them all.
* Add rts time util getUnixEpochTimeDuncan Coutts2011-10-261-0/+16
| | | | | | The other existing time utilities give us time elapsed since process or thread start. This is for wall clock time, using the common Unix epoch interpretation.
* Fix getThreadCPUTime()Simon Marlow2010-09-131-10/+19
| | | | | | ever since the patch "Check with sysconf _POSIX_THREAD_CPUTIME", it has been returning incorrect results, because the sysconf variable to check should have been _SC_THREAD_CPUTIME, not _POSIX_THREAD_CPUTIME.
* Use clock_gettime (if available) to measure the process CPU timeSimon Marlow2010-09-131-4/+26
| | | | | This is much more accurate than getrusage, which was giving misleading results when trying to time very quick operations like a minor GC.
* Partial support for Haiku (#3727)Simon Marlow2009-12-211-1/+1
|
* Add a BeConservative setting to the make systemIan Lynagh2007-09-101-1/+1
| | | | If it is set, we don't try to use clock_gettime
* Check with sysconf _POSIX_THREAD_CPUTIME is available before we try to use it.Ian Lynagh2007-01-161-9/+11
| | | | | Calling clock_gettime(CLOCK_THREAD_CPUTIME_ID,_) regardless was causing a segfault (trac #1030).
* Addition of PAPI to RTSmrchebas@gmail.com2006-11-081-1/+20
| | | | | | | This patch still requires the addition of the USE_PAPI define to compile with PAPI. Also, programs must be compiled and linked with the appropriate library flags for papi.
* Handle clock_gettime failingIan Lynagh2006-09-271-6/+8
|
* Fix ~2000 second profiling time wrapping bugIan Lynagh2006-09-111-3/+3
|
* add sysErrorBelch() for reporting system call errorsSimon Marlow2006-08-301-1/+1
|
* Reorganisation of the source treeSimon Marlow2006-04-071-0/+141
Most of the other users of the fptools build system have migrated to Cabal, and with the move to darcs we can now flatten the source tree without losing history, so here goes. The main change is that the ghc/ subdir is gone, and most of what it contained is now at the top level. The build system now makes no pretense at being multi-project, it is just the GHC build system. No doubt this will break many things, and there will be a period of instability while we fix the dependencies. A straightforward build should work, but I haven't yet fixed binary/source distributions. Changes to the Building Guide will follow, too.