diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2020-12-07 13:19:28 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-03 08:12:29 -0500 |
commit | d89deeba47ce04a5198a71fa4cbc203fe2c90794 (patch) | |
tree | 8f879bbb0774ce686e1688cc638ef22179babf51 /includes | |
parent | d8dc0f96237fe6fe7081c04727c7c2573477e5cb (diff) | |
download | haskell-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 'includes')
-rw-r--r-- | includes/Rts.h | 1 | ||||
-rw-r--r-- | includes/rts/Flags.h | 1 | ||||
-rw-r--r-- | includes/rts/prof/Heap.h | 24 |
3 files changed, 26 insertions, 0 deletions
diff --git a/includes/Rts.h b/includes/Rts.h index e093a4bcde..50a3f665de 100644 --- a/includes/Rts.h +++ b/includes/Rts.h @@ -194,6 +194,7 @@ void _assertFail(const char *filename, unsigned int linenum) /* Profiling information */ #include "rts/prof/CCS.h" +#include "rts/prof/Heap.h" #include "rts/prof/LDV.h" /* Parallel information */ diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h index 735605b2ba..204ec525ac 100644 --- a/includes/rts/Flags.h +++ b/includes/rts/Flags.h @@ -144,6 +144,7 @@ typedef struct _PROFILING_FLAGS { Time heapProfileInterval; /* time between samples */ uint32_t heapProfileIntervalTicks; /* ticks between samples (derived) */ + bool startHeapProfileAtStartup; /* true if we start profiling from program startup */ bool showCCSOnException; diff --git a/includes/rts/prof/Heap.h b/includes/rts/prof/Heap.h new file mode 100644 index 0000000000..90700c809b --- /dev/null +++ b/includes/rts/prof/Heap.h @@ -0,0 +1,24 @@ +/* ----------------------------------------------------------------------------- + * + * (c) The University of Glasgow, 2009 + * + * Heap Census Profiling + * + * Do not #include this file directly: #include "Rts.h" instead. + * + * To understand the structure of the RTS headers, see the wiki: + * https://gitlab.haskell.org/ghc/ghc/wikis/commentary/source-tree/includes + * + * ---------------------------------------------------------------------------*/ + +#pragma once + +/* ----------------------------------------------------------------------------- + * Fine-grained control over heap census profiling which can be called from + * Haskell to restrict the profile to portion(s) of the execution. + * See the module GHC.Profiling. + * ---------------------------------------------------------------------------*/ + +void requestHeapCensus ( void ); +void startHeapProfTimer ( void ); +void stopHeapProfTimer ( void ); |