Changes between Version 13 and Version 14 of Commentary/Profiling


Ignore:
Timestamp:
Feb 28, 2013 11:13:59 PM (14 months ago)
Author:
ezyang
Comment:

start adding docs for profiling

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Profiling

    v13 v14  
    11= Profiling = 
    22 
    3 GHC includes at least two types of profiling: cost-centre profiling and ticky-ticky profiling.  
     3GHC includes two types of profiling: cost-centre profiling and ticky-ticky profiling. Additionally, HPC code coverage is not "technically" profiling, but it uses a lot of the same mechanisms as cost-centre profiling (you can read more about it at [wiki:Commentary/Hpc]). 
    44 
    55Cost-centre profiling operates at something close to the source level, and ticky-ticky profiling operates at something much closer to the machine level. This means that the two types of profiling are useful for different tasks. Ticky-ticky profiling is mainly meant for compiler implementors, and cost-centre profiling for mortals. However, because cost-centre profiling operates at a high level, it can be difficult (if not impossible) to use it to profile optimized code. Personally, I (Kirsten) have had a lot of success using cost-centre profiling to find problems that were due to my own bad algorithms, but less success once I was fairly sure that I wasn't doing anything obviously stupid and was trying to figure out why my code didn't get optimized as well as it could have been. 
     
    99== Cost-centre profiling == 
    1010 
    11 (add more details) 
     11Cost-center profiling in GHC, e.g. of SCCs, consists of the following components: 
    1212 
    13 == Ticky-ticky profiling ==  
     13 * Data-structures for representing cost-centres in [[GhcFile(compiler/profiling/CostCentre.lhs)]]. 
     14 * Front-end support in [[GhcFile(compiler/deSugar/DsExpr.lhs)]], for converting {{{SCC}}} pragma into the {{{Tick}}} constructor in Core. 
     15 * Modifications to optimization behavior in [[GhcFile(compiler/coreSyn/CoreUtils.lhs)]] and [[GhcFile(compiler/coreSyn/CorePrep.lhs)]] 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 [wiki:Commentary/Hpc]); otherwise the only relevant optimization is avoiding floating expressions out of SCCs. 
     16 * The {{{StgSCC}}} constructor in STG, and code generation for it [[]] 
     17 * A pass over STG in [[GhcFile(compiler/profiling/SCCfinal.lhs)]] to collect cost centres so that they can be statically declared by [[GhcFile(compiler/profiling/ProfInit.hs)]], and add extra SCCs in the case of {{{-auto-all}}; see also [[GhcFile(compiler/profiling/NOTES)]] 
     18 * Code-generation for setting labels found in [[GhcFile(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). 
     19 * Runtime support for initializing and manipulating the actual runtime {{CostCentre}} structs which store information, in [[GhcFile(rts/Profiling.c)]]; headers are located in [[GhcFile(includes/rts/prof/CCS.h)]] 
    1420 
    15 Ticky-ticky should now be working in the HEAD, though not in any so-far-released version. 
    16  
    17 TODO: update the GHC manual section on this. 
     21== Ticky-ticky profiling == 
    1822 
    1923=== Using ticky-ticky profiling ===