Florian Ragwitz pushed to branch wip/rafl/hpc-readtix at Glasgow Haskell Compiler / GHC

Commits:

6 changed files:

Changes:

  • changelog.d/hpc-readTix
    1
    +section: compiler
    
    2
    +synopsis: Accumulating coverage data over multiple runs is no longer the default
    
    3
    +issues: #27956
    
    4
    +mrs: !16826
    
    5
    +description:
    
    6
    +  Programs compiled using :ghc-flag:`-fhpc` will, when executed, no longer read
    
    7
    +  an existing ``.tix`` file for the program and add coverage data to it by
    
    8
    +  default. Instead, the new default is to overwrite an existing ``.tix`` file
    
    9
    +  with only the coverage data from the latest run.
    
    10
    +
    
    11
    +  :rts-flag:`--read-tix-file=\<yes|no\>` can be used to control this behaviour
    
    12
    +  as before. This release merely changes the default from
    
    13
    +  ``--read-tix-file=yes`` to ``--read-tix-file=no``.
    
    14
    +
    
    15
    +  Additionally, the deprecation warning introduced in GHC 9.12 to warn about
    
    16
    +  this change of default behaviour in the future has been removed.

  • docs/users_guide/profiling.rst
    ... ... @@ -1522,11 +1522,11 @@ after the program is run.
    1522 1522
     
    
    1523 1523
     Running the program generates a file with the ``.tix`` suffix, in this
    
    1524 1524
     case :file:`Recip.tix`, which contains the coverage data for this run of the
    
    1525
    -program. The program may be run multiple times (e.g. with different test
    
    1526
    -data), and the coverage data from the separate runs is accumulated in
    
    1527
    -the ``.tix`` file. This behaviour can be controlled with the :rts-flag:`--read-tix-file=\<yes|no\>`
    
    1528
    -You can control where the ``.tix`` file is generated using the
    
    1529
    -environment variable :envvar:`HPCTIXFILE`.
    
    1525
    +program. Running the program multiple times (e.g. with different test data)
    
    1526
    +will overwrite this file with coverage data from the latest run. To accumulate
    
    1527
    +coverage data from multiple runs in the ``.tix`` file,
    
    1528
    +:rts-flag:`--read-tix-file=\<yes|no\>` can be used. You can control where the
    
    1529
    +``.tix`` file is generated using the environment variable :envvar:`HPCTIXFILE`.
    
    1530 1530
     
    
    1531 1531
     .. envvar:: HPCTIXFILE
    
    1532 1532
     
    

  • docs/users_guide/runtime_control.rst
    ... ... @@ -1388,7 +1388,7 @@ and can be controlled by the following flags.
    1388 1388
     
    
    1389 1389
     .. rts-flag:: --read-tix-file=<yes|no>
    
    1390 1390
     
    
    1391
    -    :default: enabled
    
    1391
    +    :default: disabled
    
    1392 1392
         :since: 9.12
    
    1393 1393
     
    
    1394 1394
         The RTS can be instructed to read a ``<program>.tix`` file during the startup
    
    ... ... @@ -1397,10 +1397,6 @@ and can be controlled by the following flags.
    1397 1397
         This option is useful for aggregating coverage information over multiple runs
    
    1398 1398
         of an executable.
    
    1399 1399
     
    
    1400
    -    The default for this flag is currently ``--read-tix-file=yes`` but will change
    
    1401
    -    to ``-read-tix-file=no`` in a future version of GHC according to the accepted
    
    1402
    -    `GHC Proposal 612 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0612-fhpc-accumulation.md>`__.
    
    1403
    -
    
    1404 1400
     .. rts-flag:: --write-tix-file=<yes|no>
    
    1405 1401
     
    
    1406 1402
         :default: enabled
    

  • rts/Hpc.c
    ... ... @@ -236,14 +236,7 @@ startupHpc(void)
    236 236
         sprintf(tixFilename, "%s.tix", prog_name);
    
    237 237
       }
    
    238 238
     
    
    239
    -  if ((RtsFlags.HpcFlags.readTixFile == HPC_YES_IMPLICIT) && init_open(__rts_fopen(tixFilename,"r"))) {
    
    240
    -    fprintf(stderr,"Deprecation warning:\n"
    
    241
    -                   "I am reading in the existing tix file, and will add hpc info from this run to the existing data in that file.\n"
    
    242
    -                   "GHC 9.14 will cease looking for an existing tix file by default.\n"
    
    243
    -                   "If you positively want to add hpc info to the current tix file, use the RTS option --read-tix-file=yes.\n"
    
    244
    -                   "More information can be found in the accepted GHC proposal 612.\n");
    
    245
    -    readTix();
    
    246
    -  } else if ((RtsFlags.HpcFlags.readTixFile == HPC_YES_EXPLICIT) && init_open(__rts_fopen(tixFilename,"r"))) {
    
    239
    +  if (RtsFlags.HpcFlags.readTixFile && init_open(__rts_fopen(tixFilename,"r"))) {
    
    247 240
         readTix();
    
    248 241
       }
    
    249 242
     }
    

  • rts/RtsFlags.c
    ... ... @@ -305,7 +305,7 @@ void initRtsFlagsDefaults(void)
    305 305
         RtsFlags.TickyFlags.showTickyStats   = false;
    
    306 306
         RtsFlags.TickyFlags.tickyFile        = NULL;
    
    307 307
     #endif
    
    308
    -    RtsFlags.HpcFlags.readTixFile        = HPC_YES_IMPLICIT;
    
    308
    +    RtsFlags.HpcFlags.readTixFile        = false;
    
    309 309
         RtsFlags.HpcFlags.writeTixFile       = true;
    
    310 310
     }
    
    311 311
     
    
    ... ... @@ -1100,12 +1100,12 @@ error = true;
    1100 1100
                       else if (strequal("read-tix-file=yes",
    
    1101 1101
                                   &rts_argv[arg][2])) {
    
    1102 1102
                            OPTION_UNSAFE;
    
    1103
    -                       RtsFlags.HpcFlags.readTixFile = HPC_YES_EXPLICIT;
    
    1103
    +                       RtsFlags.HpcFlags.readTixFile = true;
    
    1104 1104
                       }
    
    1105 1105
                       else if (strequal("read-tix-file=no",
    
    1106 1106
                                   &rts_argv[arg][2])) {
    
    1107 1107
                            OPTION_UNSAFE;
    
    1108
    -                       RtsFlags.HpcFlags.readTixFile = HPC_NO_EXPLICIT;
    
    1108
    +                       RtsFlags.HpcFlags.readTixFile = false;
    
    1109 1109
                       }
    
    1110 1110
                       else if (strequal("write-tix-file=yes",
    
    1111 1111
                                   &rts_argv[arg][2])) {
    

  • rts/include/rts/Flags.h
    ... ... @@ -317,25 +317,11 @@ typedef struct _PAR_FLAGS {
    317 317
       bool           setAffinity;    /* force thread affinity with CPUs */
    
    318 318
     } PAR_FLAGS;
    
    319 319
     
    
    320
    -/* Corresponds to the RTS flag `--read-tix-file=<yes|no>`.
    
    321
    - * The accepted GHC proposal 612 introduced a one-release warning period
    
    322
    - * during which we emit a warning if we read a .tix file and the flag
    
    323
    - * isn't explicitly set. In order to distinguish between whether the flag
    
    324
    - * was explicitly set or defaulted we need to use a tri-state variable.
    
    325
    - */
    
    326
    -typedef enum _HPC_READ_FILE {
    
    327
    -    HPC_NO_EXPLICIT = 0,  /* The user has specified --read-tix-file=no */
    
    328
    -    HPC_YES_IMPLICIT = 1, /* The user hasn't specified an option and we emit
    
    329
    -                           * a warning when we read a tix file.
    
    330
    -                           */
    
    331
    -    HPC_YES_EXPLICIT = 2  /* The user has specified --read-tix-file=yes */
    
    332
    -  } HPC_READ_FILE;
    
    333
    -
    
    334 320
     /* See Note [Synchronization of flags and base APIs] */
    
    335 321
     typedef struct _HPC_FLAGS {
    
    336 322
       bool           writeTixFile;   /* Whether the RTS should write a tix
    
    337 323
                                         file at the end of execution */
    
    338
    -  HPC_READ_FILE  readTixFile;    /* Whether the RTS should read a tix
    
    324
    +  bool           readTixFile;    /* Whether the RTS should read a tix
    
    339 325
                                         file at the beginning of execution */
    
    340 326
     } HPC_FLAGS;
    
    341 327