X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fprofiling.xml;h=01c7576b63ea41772a3f24754a1101e7b76446a3;hb=e5c3b478b3cd1707cf122833822f44b2ac09b8e9;hp=fe835afc9b2bfd75e25b9de4cd8adce4565f8019;hpb=7be227dcf505a16b1b63a9fe3cbea87127b70b52;p=ghc-hetmet.git diff --git a/docs/users_guide/profiling.xml b/docs/users_guide/profiling.xml index fe835af..01c7576 100644 --- a/docs/users_guide/profiling.xml +++ b/docs/users_guide/profiling.xml @@ -8,7 +8,7 @@ Glasgow Haskell comes with a time and space profiling system. Its purpose is to help you improve your understanding of your program's execution behaviour, so you can improve it. - + Any comments, suggestions and/or improvements you have are welcome. Recommended “profiling tricks” would be especially cool! @@ -39,18 +39,18 @@ RTS option - + Examine the generated profiling information, using one of GHC's profiling tools. The tool to use will depend on the kind of profiling information generated. - + - + Cost centres and cost-centre stacks - + GHC's profiling system assigns costs to cost centres. A cost is simply the time or space required to evaluate an expression. Cost centres are @@ -385,7 +385,7 @@ x = nfib 25 - + There are a few other profiling-related compilation options. Use them in addition to . These do not have to be used consistently @@ -406,7 +406,7 @@ x = nfib 25 it manually. - + : @@ -509,7 +509,7 @@ x = nfib 25 - + @@ -541,7 +541,7 @@ x = nfib 25 file, prog.ps. The hp2ps utility is described in detail in - . + . Display the heap profile using a postscript viewer such @@ -612,7 +612,7 @@ x = nfib 25 represent an approximation to the actual type. - + @@ -644,7 +644,7 @@ x = nfib 25 to display a profile by type but only for data produced by a certain module, or a profile by retainer for a certain type of data. Restrictions are specified as follows: - + @@ -702,7 +702,7 @@ x = nfib 25 types. - + cc,... @@ -776,7 +776,7 @@ x = nfib 25 state in addition to the space allocated for its stack (stacks normally start small and then grow as necessary). - + This includes the main thread, so using is a good way to see how much stack space the program is using. @@ -802,7 +802,7 @@ x = nfib 25 - + Retainer Profiling @@ -843,7 +843,7 @@ x = nfib 25 set MANY. The maximum set size defaults to 8 and can be altered with the RTS option: - + size @@ -883,7 +883,7 @@ x = nfib 25 prog +RTS -hr -hcB - + This trick isn't foolproof, because there might be other B closures in the heap which aren't the retainers we are interested in, but we've found this to be a useful technique @@ -1004,9 +1004,9 @@ x = nfib 25 heap profiles postscript, from heap profiles - + Usage: - + hp2ps [flags] [<file>[.hp]] @@ -1030,7 +1030,7 @@ hp2ps [flags] [<file>[.hp]] The flags are: - + @@ -1136,7 +1136,7 @@ hp2ps [flags] [<file>[.hp]] Use a small box for the title. - + @@ -1157,14 +1157,14 @@ hp2ps [flags] [<file>[.hp]] Generate colour output. - + Ignore marks. - + @@ -1177,7 +1177,7 @@ hp2ps [flags] [<file>[.hp]] Manipulating the hp file -(Notes kindly offered by Jan-Willhem Maessen.) +(Notes kindly offered by Jan-Willem Maessen.) The FOO.hp file produced when you ask for the @@ -1256,7 +1256,7 @@ profile of your program as it runs. Simply generate an incremental heap profile as described in the previous section. Run gv on your profile: - gv -watch -seascape FOO.ps + gv -watch -seascape FOO.ps If you forget the -watch flag you can still select "Watch file" from the "State" menu. Now each time you generate a new @@ -1292,7 +1292,7 @@ to re-read its input file: head -`fgrep -n END_SAMPLE FOO.hp | tail -1 | cut -d : -f 1` FOO.hp \ | hp2ps > FOO.ps kill -HUP $gvpsnum - done + done @@ -1335,7 +1335,7 @@ to re-read its input file: a yellow background indicates a part of the program that was never evaluated; a green background indicates an always-True expression and a red background indicates an always-False one. - + A small example: Reciprocation @@ -1381,10 +1381,10 @@ main = do -$ ghc -fhpc Recip.hs --make +$ ghc -fhpc Recip.hs --make - HPC index (.mix) files are placed placed in .hpc subdirectory. These can be considered like - the .hi files for HPC. + HPC index (.mix) files are placed in .hpc subdirectory. These can be considered like + the .hi files for HPC. $ ./Recip @@ -1396,8 +1396,8 @@ $ ./Recip $ hpc report Recip 80% expressions used (81/101) 12% boolean coverage (1/8) - 14% guards (1/7), 3 always True, - 1 always False, + 14% guards (1/7), 3 always True, + 1 always False, 2 unevaluated 0% 'if' conditions (0/1), 1 always False 100% qualifiers (0/0) @@ -1415,11 +1415,11 @@ writing Recip.hs.html hpc_index.html, hpc_index_alt.html, hpc_index_exp.html, hpc_index_fun.html. - + Options for instrumenting code for coverage - Turning on code coverage is easy, use the -fhpc flag. + Turning on code coverage is easy, use the -fhpc flag. Instrumented and non-instrumented can be freely mixed. When compiling the Main module GHC automatically detects when there is an hpc compiled file, and adds the correct initialization code. @@ -1431,9 +1431,9 @@ writing Recip.hs.html The hpc toolkit uses a cvs/svn/darcs-like interface, where a - single binary contains many function units. + single binary contains many function units. -$ hpc +$ hpc Usage: hpc COMMAND ... Commands: @@ -1456,9 +1456,9 @@ Others: In general, these options act on .tix file after an instrumented binary has generated it, which hpc acting as a conduit between the raw .tix file, and the more detailed reports - produced. + produced. - + The hpc tool assumes you are in the top-level directory of the location where you built your application, and the .tix @@ -1467,7 +1467,7 @@ Others: --srcdir multiple times to analyse programs compiled from difference locations, as is typical for packages. - + We now explain in more details the major modes of hpc. @@ -1477,8 +1477,8 @@ Others: all modules and packages are considered in generating report, unless include or exclude are used. The report is a summary unless the --per-module flag is used. The --xml-output option - allows for tools to use hpc to glean coverage. - + allows for tools to use hpc to glean coverage. + $ hpc help report Usage: hpc report [OPTION] .. <TIX_FILE> [<MODULE> [<MODULE> ..]] @@ -1518,8 +1518,8 @@ Options: hpc sum - hpc sum adds together any number of .tix files into a single - .tix file. hpc sum does not change the original .tix file; it generates a new .tix file. + hpc sum adds together any number of .tix files into a single + .tix file. hpc sum does not change the original .tix file; it generates a new .tix file. $ hpc help sum @@ -1535,10 +1535,10 @@ Options: hpc combine - hpc combine is the swiss army knife of hpc. It can be + hpc combine is the swiss army knife of hpc. It can be used to take the difference between .tix files, to subtract one .tix file from another, or to add two .tix files. hpc combine does not - change the original .tix file; it generates a new .tix file. + change the original .tix file; it generates a new .tix file. $ hpc help combine @@ -1557,11 +1557,11 @@ Options: hpc map hpc map inverts or zeros a .tix file. hpc map does not - change the original .tix file; it generates a new .tix file. + change the original .tix file; it generates a new .tix file. $ hpc help map -Usage: hpc map [OPTION] .. <TIX_FILE> +Usage: hpc map [OPTION] .. <TIX_FILE> Map a function over a single .tix file Options: @@ -1591,7 +1591,7 @@ Options: --hpcdir=DIR sub-directory that contains .mix files default .hpc [rarely used] --output=FILE output FILE -% hpc help draft +% hpc help draft Usage: hpc draft [OPTION] .. <TIX_FILE> Options: @@ -1660,7 +1660,7 @@ Options: for at link-time). This links in the debug version of the RTS, which includes the code for aggregating and reporting the results of ticky-ticky - profilng. + profiling. @@ -1678,7 +1678,7 @@ Options: the invocation foo +RTS -rfoo.ticky. - + foo +RTS -rfoo.ticky @@ -1784,7 +1784,6 @@ Total bytes copied during GC: 190096