1. 04 Jun, 2009 1 commit
  2. 02 Jun, 2009 1 commit
  3. 23 Apr, 2009 1 commit
  4. 17 Mar, 2009 1 commit
    • Simon Marlow's avatar
      Add fast event logging · 8b18faef
      Simon Marlow authored
      Generate binary log files from the RTS containing a log of runtime
      events with timestamps.  The log file can be visualised in various
      ways, for investigating runtime behaviour and debugging performance
      problems.  See for example the forthcoming ThreadScope viewer.
      
      New GHC option:
      
        -eventlog   (link-time option) Enables event logging.
      
        +RTS -l     (runtime option) Generates <prog>.eventlog with
                    the binary event information.
      
      This replaces some of the tracing machinery we already had in the RTS:
      e.g. +RTS -vg  for GC tracing (we should do this using the new event
      logging instead).
      
      Event logging has almost no runtime cost when it isn't enabled, though
      in the future we might add more fine-grained events and this might
      change; hence having a link-time option and compiling a separate
      version of the RTS for event logging.  There's a small runtime cost
      for enabling event-logging, for most programs it shouldn't make much
      difference.
      
      (Todo: docs)
      8b18faef
  5. 19 Feb, 2009 1 commit
    • Simon Marlow's avatar
      Rewrite of signal-handling (ghc patch; see also base and unix patches) · 7ed3f755
      Simon Marlow authored
      The API is the same (for now).  The new implementation has the
      capability to define signal handlers that have access to the siginfo
      of the signal (#592), but this functionality is not exposed in this
      patch.
      
      #2451 is the ticket for the new API.
      
      The main purpose of bringing this in now is to fix race conditions in
      the old signal handling code (#2858).  Later we can enable the new
      API in the HEAD.
      
      Implementation differences:
      
       - More of the signal-handling is moved into Haskell.  We store the
         table of signal handlers in an MVar, rather than having a table of
         StablePtrs in the RTS.
      
       - In the threaded RTS, the siginfo of the signal is passed down the
         pipe to the IO manager thread, which manages the business of
         starting up new signal handler threads.  In the non-threaded RTS,
         the siginfo of caught signals is stored in the RTS, and the
         scheduler starts new signal handler threads.
      7ed3f755
  6. 10 Dec, 2008 1 commit
  7. 01 Oct, 2008 1 commit
  8. 02 Sep, 2008 1 commit
  9. 09 Jul, 2008 1 commit
    • Simon Marlow's avatar
      FIX part of #2301, and #1619 · addff19a
      Simon Marlow authored
      2301: Control-C now causes the new exception (AsyncException
      UserInterrupt) to be raised in the main thread.  The signal handler
      is set up by GHC.TopHandler.runMainIO, and can be overriden in the
      usual way by installing a new signal handler.  The advantage is that
      now all programs will get a chance to clean up on ^C.
      
      When UserInterrupt is caught by the topmost handler, we now exit the
      program via kill(getpid(),SIGINT), which tells the parent process that
      we exited as a result of ^C, so the parent can take appropriate action
      (it might want to exit too, for example).
      
      One subtlety is that we have to use a weak reference to the ThreadId
      for the main thread, so that the signal handler doesn't prevent the
      main thread from being subject to deadlock detection.
      
      1619: we now ignore SIGPIPE by default.  Although POSIX says that a
      SIGPIPE should terminate the process by default, I wonder if this
      decision was made because many C applications failed to check the exit
      code from write().  In Haskell a failed write due to a closed pipe
      will generate an exception anyway, so the main difference is that we
      now get a useful error message instead of silent program termination.
      See #1619 for more discussion.
      addff19a
  10. 16 Apr, 2008 1 commit
  11. 20 Nov, 2007 1 commit
    • simonmar@microsoft.com's avatar
      improvements to PAPI support · 8db56c86
      simonmar@microsoft.com authored
      - major (multithreaded) GC is measured separately from minor GC
      - events to measure can now be specified on the command line, e.g
           prog +RTS -a+PAPI_TOT_CYC
      8db56c86
  12. 31 Oct, 2007 1 commit
  13. 29 May, 2008 1 commit
  14. 12 May, 2008 1 commit
  15. 28 Feb, 2008 1 commit
    • Simon Marlow's avatar
      Enable -prof -threaded (#886) · 50c4d039
      Simon Marlow authored
      It turns out that -prof -threaded works (modulo some small changes),
      because all the data structures used in profiling are only accessed by
      one thread at a time, at long as we don't use +RTS -N2 or higher.  So
      this patch enables the use of -prof -threaded, but an error is given
      if you ask for more than one CPU with +RTS -N.
      50c4d039
  16. 20 Nov, 2007 1 commit
    • Simon Marlow's avatar
      Move file locking into the RTS, fixing #629, #1109 · 1d026619
      Simon Marlow authored
      File locking (of the Haskell 98 variety) was previously done using a
      static table with linear search, which had two problems: the array had
      a fixed size and was sometimes too small (#1109), and performance of
      lockFile/unlockFile was suboptimal due to the linear search.
      Also the algorithm failed to count readers as required by Haskell 98
      (#629).
      
      Now it's done using a hash table (provided by the RTS).  Furthermore I
      avoided the extra fstat() for every open file by passing the dev_t and
      ino_t into lockFile.  This and the improvements to the locking
      algorithm result in a healthy 20% or so performance increase for
      opening/closing files (see openFile008 test).
      1d026619
  17. 03 Sep, 2007 1 commit
    • Simon Marlow's avatar
      FIX #1623: disable the timer signal when the system is idle (threaded RTS only) · 8d71be7c
      Simon Marlow authored
      Having a timer signal go off regularly is bad for power consumption,
      and generally bad practice anyway (it means the app cannot be
      completely swapped out, for example).  Fortunately the threaded RTS
      already had a way to detect when the system was idle, so that it can
      trigger a GC and thereby find deadlocks.  After performing the GC, we
      now turn off timer signals, and re-enable them again just before
      running any Haskell code.
      8d71be7c
  18. 24 Aug, 2007 1 commit
  19. 17 Aug, 2007 1 commit
  20. 25 Jul, 2007 1 commit
    • Simon Marlow's avatar
      FIX #1177, partially at least. · eb5791fe
      Simon Marlow authored
      Now we don't wait for outstanding IO requests when shutting down at
      program exit time, but we still wait when shutting down a DLL (via
      hs_exit()).  There ought to be a better way to do this, but
      terminating the threads forcibly is not a good idea (it never is: the
      thread might be holding a mutex when it dies, for example).
      
      I plan to add some docs to the user guide to describe how to shut
      down a DLL properly.
      eb5791fe
  21. 24 Jul, 2007 1 commit
    • Simon Marlow's avatar
      hs_exit()/shutdownHaskell(): wait for outstanding foreign calls to complete before returning · 681aad99
      Simon Marlow authored
      This is pertinent to #1177.  When shutting down a DLL, we need to be
      sure that there are no OS threads that can return to the code that we
      are about to unload, and previously the threaded RTS was unsafe in
      this respect.
      
      When exiting a standalone program we don't have to be quite so
      paranoid: all the code will disappear at the same time as any running
      threads.  Happily exiting a program happens via a different path:
      shutdownHaskellAndExit().  If we're about to exit(), then there's no
      need to wait for foreign calls to complete.
      681aad99
  22. 17 Jul, 2007 1 commit
  23. 01 Jun, 2007 1 commit
  24. 08 May, 2007 1 commit
  25. 27 Apr, 2007 1 commit
    • Simon Marlow's avatar
      Basic heap profile support without -prof · cbeb99ef
      Simon Marlow authored
      Now that constructor info tables contain the name of the constructor,
      we can generate useful heap profiles without requiring the whole
      program and libraries to be compiled with -prof.  So now, "+RTS -hT"
      generates a heap profile for any program, dividing the profile by
      constructor.  It wouldn't be hard to add support for grouping
      constructors by module, or to restrict the profile to certain
      constructors/modules/packages.
      
      This means that for the first time we can get heap profiles for GHCi,
      which was previously impossible because the byte-code
      interpreter and linker don't work with -prof.
      cbeb99ef
  26. 22 Mar, 2007 1 commit
  27. 07 Feb, 2007 1 commit
    • chevalier@alum.wellesley.edu's avatar
      Lightweight ticky-ticky profiling · 5ddee764
      chevalier@alum.wellesley.edu authored
      The following changes restore ticky-ticky profiling to functionality
      from its formerly bit-rotted state. Sort of. (It got bit-rotted as part
      of the switch to the C-- back-end.)
      
      The way that ticky-ticky is supposed to work is documented in Section 5.7
      of the GHC manual (though the manual doesn't mention that it hasn't worked
      since sometime around 6.0, alas). Changes from this are as follows (which
      I'll document on the wiki):
      
      * In the past, you had to build all of the libraries with way=t in order to
      use ticky-ticky, because it entailed a different closure layout. No longer.
      You still need to do make way=t in rts/ in order to build the ticky RTS,
      but you should now be able to mix ticky and non-ticky modules.
      
      * Some of the counters that worked in the past aren't implemented yet.
      I was originally just trying to get entry counts to work, so those should
      be correct. The list of counters was never documented in the first place,
      so I hope it's not too much of a disaster that some don't appear anymore.
      Someday, someone (perhaps me) should document all the counters and what 
      they do. For now, all of the counters are either accurate (or at least as
      accurate as they always were), zero, or missing from the ticky profiling
      report altogether.
      
      This hasn't been particularly well-tested, but these changes shouldn't
      affect anything except when compiling with -fticky-ticky (famous last
      words...)
      
      Implementation details:
      
      I got rid of StgTicky.h, which in the past had the macros and declarations 
      for all of the ticky counters. Now, those macros are defined in Cmm.h.
      StgTicky.h was still there for inclusion in C code. Now, any remaining C
      code simply cannot call the ticky macros -- or rather, they do call those
      macros, but from the perspective of C code, they're defined as no-ops. 
      (This shouldn't be too big a problem.)
      
      I added a new file TickyCounter.h that has all the declarations for ticky
      counters, as well as dummy macros for use in C code. Someday, these 
      declarations should really be automatically generated, since they need
      to be kept consistent with the macros defined in Cmm.h.
      
      Other changes include getting rid of the header that was getting added to
      closures before, and getting rid of various code having to do with eager
      blackholing and permanent indirections (the changes under compiler/ 
      and rts/Updates.*).
      5ddee764
  28. 15 Dec, 2006 2 commits
  29. 11 Dec, 2006 2 commits
    • Ian Lynagh's avatar
      Add freeScheduler/freeTaskManager and call it later than exitScheduler · cf6b495d
      Ian Lynagh authored
      We were freeing the tasks in exitScheduler (stopTaskManager) before
      exitStorage (stat_exit), but the latter needs to walk down the list
      printing stats. Resulted in segfaults with commands like
          ghc -v0 -e main q.hs -H32m -H32m +RTS -Sstderr
      (where q.hs is trivial), but very sensitive to exact commandline and
      libc version or something.
      cf6b495d
    • Ian Lynagh's avatar
      When debugging, have the allocator help us a bit · d5265047
      Ian Lynagh authored
      We now check for freeing memory that isn't allocated, and overwrite memory
      we are about to free with 0xaa.
      It might be nice to also have a flag to control whether the memory
      actually gets free'd.
      d5265047
  30. 01 Dec, 2006 2 commits
    • Simon Marlow's avatar
      Add support for the IO manager thread on Windows · 80a766fd
      Simon Marlow authored
      Fixes #637.
      The implications of this change are:
        - threadDelay on Windows no longer creates a new OS thread each time,
          instead it communicates with the IO manager thread in the same way as
          on Unix.
        - deadlock detection now works the same way on Windows as on Unix; that
          is the timer interrupt wakes up the IO manager thread, which causes
          the scheduler to check for deadlock.
        - Console events now get sent to the IO manager thread, in the same way as
          signals do on Unix.  This means that console events should behave more
          reliably with -threaded on Windows.
      
      All this applies only with -threaded.  Without -threaded, the old
      ConsoleEvent code is still used.
      
      After some testing, this could be pushed to the 6.6 branch.
      80a766fd
    • Simon Marlow's avatar
      Remove the Windows Async IO Manager completely in THREADED_RTS mode · de6c8e52
      Simon Marlow authored
      It isn't used here anyway, just making sure the code doesn't get compiled in.
      de6c8e52
  31. 20 Nov, 2006 1 commit
  32. 08 Nov, 2006 1 commit
    • mrchebas@gmail.com's avatar
      Addition of PAPI to RTS · fe07f054
      mrchebas@gmail.com authored
      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.
      fe07f054
  33. 15 Nov, 2006 1 commit
  34. 10 Nov, 2006 1 commit
  35. 24 Oct, 2006 2 commits
    • andy@galois.com's avatar
      Haskell Program Coverage · d5934bbb
      andy@galois.com authored
      This large checkin is the new ghc version of Haskell
      Program Coverage, an expression-level coverage tool for Haskell.
      
      Parts:
      
       - Hpc.[ch] - small runtime support for Hpc; reading/writing *.tix files.
       - Coverage.lhs - Annotates the HsSyn with coverage tickboxes.
        - New Note's in Core,
            - TickBox      -- ticked on entry to sub-expression
            - BinaryTickBox  -- ticked on exit to sub-expression, depending
      	       	     -- on the boolean result.
      
        - New Stg level TickBox (no BinaryTickBoxes, though) 
      
      You can run the coverage tool with -fhpc at compile time. 
      Main must be compiled with -fhpc. 
      				      
      d5934bbb
    • Simon Marlow's avatar
      Split GC.c, and move storage manager into sm/ directory · ab0e778c
      Simon Marlow authored
      In preparation for parallel GC, split up the monolithic GC.c file into
      smaller parts.  Also in this patch (and difficult to separate,
      unfortunatley):
        
        - Don't include Stable.h in Rts.h, instead just include it where
          necessary.
        
        - consistently use STATIC_INLINE in source files, and INLINE_HEADER
          in header files.  STATIC_INLINE is now turned off when DEBUG is on,
          to make debugging easier.
        
        - The GC no longer takes the get_roots function as an argument.
          We weren't making use of this generalisation.
      ab0e778c
  36. 05 Sep, 2006 1 commit
    • Ian Lynagh's avatar
      new RTS flag: -V to modify the resolution of the RTS timer · 93db1991
      Ian Lynagh authored
      Fixed version of an old patch by Simon Marlow. His description read:
       Also, now an arbitrarily short context switch interval may now be
       specified, as we increase the RTS ticker's resolution to match the
       requested context switch interval.  This also applies to +RTS -i (heap
       profiling) and +RTS -I (the idle GC timer).  +RTS -V is actually only
       required for increasing the resolution of the profile timer.
      93db1991