[commit: ghc] ghc-8.2: [RTS] Make -po work (18d66fe)

git at git.haskell.org git at git.haskell.org
Tue Oct 3 14:48:46 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/18d66feb0620512adefc00e0aee5578f3058c23c/ghc

>---------------------------------------------------------------

commit 18d66feb0620512adefc00e0aee5578f3058c23c
Author: Bartosz Nitka <niteria at gmail.com>
Date:   Thu Sep 14 02:50:05 2017 -0700

    [RTS] Make -po work
    
    db2a667655506c43dd3c8260d29031bde55f1bee added `-po` option, but
    the part that parses it was missing.
    
    Test Plan:
    On a simple file:
    ```
    ./inplace/bin/ghc-stage2 A.hs -prof -main-is A; ./A +RTS -P -potest
    ```
    produced test.prof file and didn't produce A.prof file.
    
    ```
    ./A +RTS -P
    ```
    produced A.prof file
    
    Reviewers: simonmar, bgamari, austin, erikd
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3946
    
    (cherry picked from commit b6b56dd1b6adc9051593955eecaef85c9d6e96b8)


>---------------------------------------------------------------

18d66feb0620512adefc00e0aee5578f3058c23c
 rts/RtsFlags.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index 0a12ba3..c2de960 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -183,11 +183,12 @@ void initRtsFlagsDefaults(void)
     RtsFlags.DebugFlags.compact         = false;
 
 #if defined(PROFILING)
-    RtsFlags.CcFlags.doCostCentres      = 0;
+    RtsFlags.CcFlags.doCostCentres      = COST_CENTRES_NONE;
+    RtsFlags.CcFlags.outputFileNameStem = NULL;
 #endif /* PROFILING */
 
     RtsFlags.ProfFlags.doHeapProfile      = false;
-    RtsFlags.ProfFlags. heapProfileInterval = USToTime(100000); // 100ms
+    RtsFlags.ProfFlags.heapProfileInterval = USToTime(100000); // 100ms
 
 #ifdef PROFILING
     RtsFlags.ProfFlags.includeTSOs        = false;
@@ -1072,6 +1073,14 @@ error = true;
                   case 'j':
                       RtsFlags.CcFlags.doCostCentres = COST_CENTRES_JSON;
                       break;
+                  case 'o':
+                      if (rts_argv[arg][3] == '\0') {
+                        errorBelch("flag -po expects an argument");
+                        error = true;
+                        break;
+                      }
+                      RtsFlags.CcFlags.outputFileNameStem = rts_argv[arg]+3;
+                      break;
                   case '\0':
                       if (rts_argv[arg][1] == 'P') {
                           RtsFlags.CcFlags.doCostCentres = COST_CENTRES_VERBOSE;



More information about the ghc-commits mailing list