summaryrefslogtreecommitdiff
path: root/docs/users_guide
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2020-12-07 13:19:28 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-03 08:12:29 -0500
commitd89deeba47ce04a5198a71fa4cbc203fe2c90794 (patch)
tree8f879bbb0774ce686e1688cc638ef22179babf51 /docs/users_guide
parentd8dc0f96237fe6fe7081c04727c7c2573477e5cb (diff)
downloadhaskell-d89deeba47ce04a5198a71fa4cbc203fe2c90794.tar.gz
Profiling: Allow heap profiling to be controlled dynamically.
This patch exposes three new functions in `GHC.Profiling` which allow heap profiling to be enabled and disabled dynamically. 1. startHeapProfTimer - Starts heap profiling with the given RTS options 2. stopHeapProfTimer - Stops heap profiling 3. requestHeapCensus - Perform a heap census on the next context switch, regardless of whether the timer is enabled or not.
Diffstat (limited to 'docs/users_guide')
-rw-r--r--docs/users_guide/9.2.1-notes.rst6
-rw-r--r--docs/users_guide/profiling.rst10
2 files changed, 15 insertions, 1 deletions
diff --git a/docs/users_guide/9.2.1-notes.rst b/docs/users_guide/9.2.1-notes.rst
index 918f8ebae8..2630ae91fe 100644
--- a/docs/users_guide/9.2.1-notes.rst
+++ b/docs/users_guide/9.2.1-notes.rst
@@ -93,6 +93,12 @@ Compiler
that the compiler automatically insert cost-centres on all call-sites of
the named function.
+- The heap profiler can now be controlled from within a Haskell program using
+ functions in ``GHC.Profiling``. Profiling can be started and stopped or a heap
+ census requested at a specific point in the program.
+ There is a new RTS flag :rts-flag:`--no-automatic-heap-samples` which can be
+ used to stop heap profiling starting when a program starts.
+
GHCi
~~~~
diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst
index 1eddcb7160..6eb5008146 100644
--- a/docs/users_guide/profiling.rst
+++ b/docs/users_guide/profiling.rst
@@ -459,7 +459,7 @@ compiled program.
:type: dynamic
Deprecated alias for :ghc-flag:`-fprof-auto-exported`
-
+
.. ghc-flag:: -caf-all
:shortdesc: *(deprecated)* Alias for :ghc-flag:`-fprof-cafs`
:type: dynamic
@@ -886,6 +886,14 @@ There are three more options which relate to heap profiling:
profiles are always sampled with the frequency of the RTS clock. See
:ref:`prof-time-options` for changing that.
+.. rts-flag:: --no-automatic-heap-samples
+
+ :since: 9.2.1
+
+ Don't start heap profiling from the start of program execution. If this
+ option is enabled, it's expected that the user will manually start heap
+ profiling or request specific samples using functions from ``GHC.Profiling``.
+
.. rts-flag:: -L ⟨num⟩
Sets the maximum length of a cost-centre stack name in a heap