[commit: ghc] master: [RTS] Make -po work (b6b56dd)

git at git.haskell.org git at git.haskell.org
Thu Sep 14 13:08:08 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b6b56dd1b6adc9051593955eecaef85c9d6e96b8/ghc

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

commit b6b56dd1b6adc9051593955eecaef85c9d6e96b8
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


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

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

diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index ec21ef1..4194aa0 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -185,11 +185,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
 
 #if defined(PROFILING)
     RtsFlags.ProfFlags.includeTSOs        = false;
@@ -1143,6 +1144,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