diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-08-12 14:07:34 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-21 01:13:26 -0500 |
commit | 53ad67eacacde8fde452f1a323d5886183375182 (patch) | |
tree | 8ebf2d25bc3eeff839f05ad578133a51cd7fddf8 /docs | |
parent | 56804e33a05729f5a5340d3680ae2849e30a9e86 (diff) | |
download | haskell-53ad67eacacde8fde452f1a323d5886183375182.tar.gz |
Introduce -fprof-callers flag
This introducing a new compiler flag to provide a convenient way to
introduce profiler cost-centers on all occurrences of the named
identifier.
Closes #18566.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/9.2.1-notes.rst | 4 | ||||
-rw-r--r-- | docs/users_guide/profiling.rst | 32 |
2 files changed, 36 insertions, 0 deletions
diff --git a/docs/users_guide/9.2.1-notes.rst b/docs/users_guide/9.2.1-notes.rst index 442143e966..da0461f982 100644 --- a/docs/users_guide/9.2.1-notes.rst +++ b/docs/users_guide/9.2.1-notes.rst @@ -40,6 +40,10 @@ Compiler - GHCi's ``:kind!`` command now expands through type synonyms in addition to type families. See :ghci-cmd:`:kind`. +- GHC now supports a flag, :ghc-flag:`-fprof-callers=⟨name⟩`, for requesting + that the compiler automatically insert cost-centres on all call-sites of + the named function. + ``ghc-prim`` library ~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst index 77e00bbbe4..0b075429b5 100644 --- a/docs/users_guide/profiling.rst +++ b/docs/users_guide/profiling.rst @@ -358,6 +358,38 @@ Automatically placing cost-centres GHC has a number of flags for automatically inserting cost-centres into the compiled program. +.. ghc-flag:: -fprof-callers=⟨name⟩ + :shortdesc: Auto-add ``SCC``\\ s to all call-sites of the named function. + :type: dynamic + :category: + + Automatically enclose all occurrences of the named function in an ``SCC``. + Note that these cost-centres are added late in compilation (after + simplification) and consequently the names may be slightly different than + they appear in the source program (e.g. a call to ``f`` may inlined with + its wrapper, resulting in an occurrence of its worker, ``$wf``). + + In addition to plain module-qualified names (e.g. ``Data.List.map``), + ⟨name⟩ also accepts a small globbing language using ``*`` as a wildcard + symbol: + + .. code-block:: none + + pattern := <module> '.' <identifier> + module := '*' + | <Haskell module name> + identifier := <ident_char> + ident + + For instance, the following are all valid patterns: + + * ``Data.List.map`` + * ``*.map`` + * ``*.parse*`` + * ``*.<\\*>`` + + The ``*`` character can be used literally by escaping (e.g. ``\\*``). + .. ghc-flag:: -fprof-auto :shortdesc: Auto-add ``SCC``\\ s to all bindings not marked INLINE :type: dynamic |