... | ... | @@ -17,9 +17,9 @@ Cost-center profiling in GHC, e.g. of SCCs, consists of the following components |
|
|
- Data-structures for representing cost-centres in [compiler/profiling/CostCentre.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/profiling/CostCentre.hs).
|
|
|
- Front-end support in [compiler/deSugar/DsExpr.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/deSugar/DsExpr.hs), for converting `SCC` pragma into the `Tick` constructor in Core.
|
|
|
- Modifications to optimization behavior in [compiler/coreSyn/CoreUtils.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/coreSyn/CoreUtils.hs) and [compiler/coreSyn/CorePrep.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/coreSyn/CorePrep.hs) to prevent optimizations which would result in misleading profile information. Most of this is to handle the fact that SCCs also count entries (tickishCounts, also applies to [Commentary/Hpc](commentary/hpc)); otherwise the only relevant optimization is avoiding floating expressions out of SCCs. Note that the simplifier also has "ticks" (so it can decide when to stop optimizing); these are not the same thing at all.
|
|
|
- The `StgSCC` constructor in STG, and code generation for it [compiler/codeGen/StgCmmProf.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/codeGen/StgCmmProf.hs)
|
|
|
- The `StgSCC` constructor in STG, and code generation for it [compiler/GHC/StgToCmm/Prof.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/GHC/StgToCmm/Prof.hs)
|
|
|
- A pass over STG in [compiler/profiling/SCCfinal.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/profiling/SCCfinal.hs) to collect cost centres so that they can be statically declared by [compiler/profiling/ProfInit.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/profiling/ProfInit.hs), and add extra SCCs in the case of `-fprof-auto`; see also [compiler/profiling/NOTES](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/profiling/NOTES)
|
|
|
- Code-generation for setting labels found in [compiler/codeGen/StgCmmProf.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/codeGen/StgCmmProf.hs), in particular saving and restoring CC labels and well as counting ticks; note that cost-centres even get their own constructor in C-- as CC_Labels (cost-centre labels).
|
|
|
- Code-generation for setting labels found in [compiler/GHC/StgToCmm/Prof.hs](https://gitlab.haskell.org/ghc/ghc/blob/master/compiler/GHC/StgToCmm/Prof.hs), in particular saving and restoring CC labels and well as counting ticks; note that cost-centres even get their own constructor in C-- as CC_Labels (cost-centre labels).
|
|
|
- Runtime support for initializing and manipulating the actual runtime `CostCentre` structs which store information, in [rts/Profiling.c](https://gitlab.haskell.org/ghc/ghc/blob/master/rts/Profiling.c); headers are located in [includes/rts/prof/CCS.h](https://gitlab.haskell.org/ghc/ghc/blob/master/includes/rts/prof/CCS.h)
|
|
|
|
|
|
## Ticky-ticky profiling
|
... | ... | |