From 7d7aafbe93eda5c9fc0b20066e5e9caf22d7e1e4 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Mon, 21 Dec 2020 09:15:45 +0000 Subject: Remove the -xt heap profiling option It should be left to tooling to perform the filtering to remove these specific closure types from the profile if desired. Fixes #16795 --- docs/users_guide/9.2.1-notes.rst | 5 ++++- docs/users_guide/profiling.rst | 17 ----------------- includes/rts/Flags.h | 1 - libraries/base/GHC/RTS/Flags.hsc | 3 --- rts/ProfHeap.c | 22 ---------------------- rts/RtsFlags.c | 9 +++------ testsuite/tests/rts/T9839_06.hs | 4 ---- testsuite/tests/rts/T9839_06.stderr | 1 - testsuite/tests/rts/all.T | 5 ----- 9 files changed, 7 insertions(+), 60 deletions(-) delete mode 100755 testsuite/tests/rts/T9839_06.hs delete mode 100644 testsuite/tests/rts/T9839_06.stderr diff --git a/docs/users_guide/9.2.1-notes.rst b/docs/users_guide/9.2.1-notes.rst index 06134387f3..9812279849 100644 --- a/docs/users_guide/9.2.1-notes.rst +++ b/docs/users_guide/9.2.1-notes.rst @@ -114,10 +114,13 @@ Runtime system Moreover, we now correctly account for the size of the array, meaning that space lost to fragmentation is no longer counted as live data. - - The :rts-flag:`-h` flag has been deprecated, use either :rts-flag:`-hc` or :rts-flag:`-hT` explicitly, as appropriate. +- The ``-xt`` RTS flag has been removed. Now STACK and TSO closures are always + included in heap profiles. Tooling can choose to filter out these closure types + if necessary. + ``ghc-prim`` library ~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst index 2463654837..1eddcb7160 100644 --- a/docs/users_guide/profiling.rst +++ b/docs/users_guide/profiling.rst @@ -886,20 +886,6 @@ 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:: -xt - - Include the memory occupied by threads in a heap profile. Each - thread takes up a small area for its thread 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 :rts-flag:`-xt` is a good way to see - how much stack space the program is using. - - Memory occupied by threads and their stacks is labelled as “TSO” and - “STACK” respectively when displaying the profile by closure - description or type description. - .. rts-flag:: -L ⟨num⟩ Sets the maximum length of a cost-centre stack name in a heap @@ -1049,9 +1035,6 @@ reasons for this: ⟨factor⟩` option. Also add the size of the allocation area (see :rts-flag:`-A ⟨size⟩`). -- The stack isn't counted in the heap profile by default. See the - RTS :rts-flag:`-xt` option. - - The program text itself, the C stack, any non-heap data (e.g. data allocated by foreign libraries, and data allocated by the RTS), and ``mmap()``\'d memory are not counted in the heap profile. diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h index 35b45b0940..36ea11426c 100644 --- a/includes/rts/Flags.h +++ b/includes/rts/Flags.h @@ -144,7 +144,6 @@ typedef struct _PROFILING_FLAGS { Time heapProfileInterval; /* time between samples */ uint32_t heapProfileIntervalTicks; /* ticks between samples (derived) */ - bool includeTSOs; bool showCCSOnException; diff --git a/libraries/base/GHC/RTS/Flags.hsc b/libraries/base/GHC/RTS/Flags.hsc index b23ae34165..2130ee1aaa 100644 --- a/libraries/base/GHC/RTS/Flags.hsc +++ b/libraries/base/GHC/RTS/Flags.hsc @@ -288,7 +288,6 @@ data ProfFlags = ProfFlags { doHeapProfile :: DoHeapProfile , heapProfileInterval :: RtsTime -- ^ time between samples , heapProfileIntervalTicks :: Word -- ^ ticks between samples (derived) - , includeTSOs :: Bool , showCCSOnException :: Bool , maxRetainerSetSize :: Word , ccsLength :: Word @@ -584,8 +583,6 @@ getProfFlags = do ProfFlags <$> (toEnum <$> #{peek PROFILING_FLAGS, doHeapProfile} ptr) <*> #{peek PROFILING_FLAGS, heapProfileInterval} ptr <*> #{peek PROFILING_FLAGS, heapProfileIntervalTicks} ptr - <*> (toBool <$> - (#{peek PROFILING_FLAGS, includeTSOs} ptr :: IO CBool)) <*> (toBool <$> (#{peek PROFILING_FLAGS, showCCSOnException} ptr :: IO CBool)) <*> #{peek PROFILING_FLAGS, maxRetainerSetSize} ptr diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 0bd8423b4c..f880f5f406 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -1179,35 +1179,13 @@ heapCensusBlock(Census *census, bdescr *bd) case TSO: prim = true; -#if defined(PROFILING) - if (RtsFlags.ProfFlags.includeTSOs) { - size = sizeofW(StgTSO); - break; - } else { - // Skip this TSO and move on to the next object - p += sizeofW(StgTSO); - continue; - } -#else size = sizeofW(StgTSO); break; -#endif case STACK: prim = true; -#if defined(PROFILING) - if (RtsFlags.ProfFlags.includeTSOs) { - size = stack_sizeW((StgStack*)p); - break; - } else { - // Skip this TSO and move on to the next object - p += stack_sizeW((StgStack*)p); - continue; - } -#else size = stack_sizeW((StgStack*)p); break; -#endif case TREC_CHUNK: prim = true; diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 380ccc3afc..f592f246db 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -214,7 +214,6 @@ void initRtsFlagsDefaults(void) RtsFlags.ProfFlags.heapProfileInterval = USToTime(100000); // 100ms #if defined(PROFILING) - RtsFlags.ProfFlags.includeTSOs = false; RtsFlags.ProfFlags.showCCSOnException = false; RtsFlags.ProfFlags.maxRetainerSetSize = 8; RtsFlags.ProfFlags.ccsLength = 25; @@ -1686,11 +1685,9 @@ error = true; case 't': /* Include memory used by TSOs in a heap profile */ OPTION_SAFE; - PROFILING_BUILD_ONLY( - RtsFlags.ProfFlags.includeTSOs = true; - ); - unchecked_arg_start++; - goto check_rest; + errorBelch("The -xt option has been removed (#16795)"); + error = true; + break; /* * The option prefix '-xx' is reserved for future diff --git a/testsuite/tests/rts/T9839_06.hs b/testsuite/tests/rts/T9839_06.hs deleted file mode 100755 index d82a4bd93b..0000000000 --- a/testsuite/tests/rts/T9839_06.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Main where - -main :: IO () -main = return () diff --git a/testsuite/tests/rts/T9839_06.stderr b/testsuite/tests/rts/T9839_06.stderr deleted file mode 100644 index 016eed0376..0000000000 --- a/testsuite/tests/rts/T9839_06.stderr +++ /dev/null @@ -1 +0,0 @@ -T9839_06: flag -x given an argument when none was expected: -xtx diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index 4d30601e08..a5a57b6a8c 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -309,11 +309,6 @@ test('T9839_05', grep_stderr('given an argument when none was expected')], compile_and_run, ['']) -test('T9839_06', - [only_ways(prof_ways), extra_run_opts('+RTS -xtx'), no_check_hp, - grep_stderr('given an argument when none was expected')], - compile_and_run, ['']) - # ignore_stderr as RTS reports slightly different error messages # in 'epoll' and 'select' backends on reading from EBADF # mingw32 skip as UNIX pipe and close(fd) is used to exercise the problem -- cgit v1.2.1