Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/50de6034343abc93a7b01daccff34121042c0e7c >--------------------------------------------------------------- commit 50de6034343abc93a7b01daccff34121042c0e7c Author: Simon Marlow <[email protected]> Date: Mon Nov 28 16:48:43 2011 +0000 Make profiling work with multiple capabilities (+RTS -N) This means that both time and heap profiling work for parallel programs. Main internal changes: - CCCS is no longer a global variable; it is now another pseudo-register in the StgRegTable struct. Thus every Capability has its own CCCS. - There is a new built-in CCS called "IDLE", which records ticks for Capabilities in the idle state. If you profile a single-threaded program with +RTS -N2, you'll see about 50% of time in "IDLE". - There is appropriate locking in rts/Profiling.c to protect the shared cost-centre-stack data structures. This patch does enough to get it working, I have cut one big corner: the cost-centre-stack data structure is still shared amongst all Capabilities, which means that multiple Capabilities will race when updating the "allocations" and "entries" fields of a CCS. Not only does this give unpredictable results, but it runs very slowly due to cache line bouncing. It is strongly recommended that you use -fno-prof-count-entries to disable the "entries" count when profiling parallel programs. (I shall add a note to this effect to the docs). compiler/cmm/CmmExpr.hs | 6 ++- compiler/cmm/CmmLex.x | 5 +- compiler/cmm/CmmParse.y | 5 +- compiler/cmm/PprCmmExpr.hs | 1 + compiler/codeGen/CgCase.lhs | 2 +- compiler/codeGen/CgClosure.lhs | 7 +- compiler/codeGen/CgForeignCall.hs | 4 +- compiler/codeGen/CgProf.hs | 22 +++--- compiler/codeGen/CgUtils.hs | 6 ++- compiler/codeGen/StgCmmForeign.hs | 4 +- compiler/codeGen/StgCmmProf.hs | 15 ++-- compiler/codeGen/StgCmmUtils.hs | 8 ++- includes/Cmm.h | 2 +- includes/RtsAPI.h | 9 +++ includes/mkDerivedConstants.c | 1 + includes/rts/prof/CCS.h | 7 +- includes/stg/MiscClosures.h | 1 - includes/stg/Regs.h | 1 + rts/Apply.cmm | 2 +- rts/AutoApply.h | 12 ++-- rts/Capability.c | 21 +++++- rts/Exception.cmm | 4 +- rts/Interpreter.c | 4 +- rts/PrimOps.cmm | 40 ++++++------ rts/Profiling.c | 134 +++++++++++++++++++++++++------------ rts/Proftimer.c | 6 ++- rts/RetainerProfile.h | 3 + rts/RtsFlags.c | 6 -- rts/Schedule.c | 4 +- rts/StgMiscClosures.cmm | 2 +- rts/StgStdThunks.cmm | 4 +- rts/sm/GC.c | 18 +++-- rts/sm/Storage.c | 4 +- utils/genapply/GenApply.hs | 2 +- 34 files changed, 231 insertions(+), 141 deletions(-) Diff suppressed because of size. To see it, use: git show 50de6034343abc93a7b01daccff34121042c0e7c _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
