root/rts/Ticker.h

Revision 6b1098511aaabd2c9503ee7be6da1944466f9cb4, 0.5 KB (checked in by Simon Marlow <marlowsd@…>, 6 months ago)

Time handling overhaul

Terminology cleanup: the type "Ticks" has been renamed "Time", which
is an StgWord?64 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.

  • Property mode set to 100644
Line 
1/* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team 2005
4 *
5 * Interface to the OS-specific implementation of a regular time signal.
6 *
7 * ---------------------------------------------------------------------------*/
8
9#ifndef TICKER_H
10#define TICKER_H
11
12#include "BeginPrivate.h"
13
14typedef void (*TickProc)(int);
15
16void initTicker  (Time interval, TickProc handle_tick);
17void startTicker (void);
18void stopTicker  (void);
19void exitTicker  (rtsBool wait);
20
21#include "EndPrivate.h"
22
23#endif /* TICKER_H */
Note: See TracBrowser for help on using the browser.