[compiler-rt] r201808 - Add an environment variable to override the default profile output file.

Bob Wilson bob.wilson at apple.com
Fri Feb 21 09:55:40 PST 2014


On Feb 21, 2014, at 2:35 AM, Kostya Serebryany <kcc at google.com> wrote:

> AsanCov emits file_name.PID so that you can run multiple processes with coverage (each spawning multiple subprocesses) and 
> they will not fight over the same file. An env. var. does not give us that. 
> 
> —kcc 

We discussed that possibility yesterday. It makes sense, but adding the PID or some other unique identifier just complicates things for our typical usage. It is easier for our build process to be able to set something to specify the file name. Otherwise, we don’t know what file will be written and have to open up a directory and search for it. That’s even more of a hassle when you’re running the code on a separate device with limited access to the file system.

Can you think of a simple way to provide both options? I really don’t want to make this more complicated than necessary.

> 
> 
> On Thu, Feb 20, 2014 at 11:52 PM, Bob Wilson <bob.wilson at apple.com> wrote:
> Author: bwilson
> Date: Thu Feb 20 13:52:32 2014
> New Revision: 201808
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=201808&view=rev
> Log:
> Add an environment variable to override the default profile output file.
> 
> Also rename the default output file from "pgo-data" to "default.profdata".
> The ".profdata" suffix is consistent with the name of the new llvm-profdata
> tool.
> 
> Modified:
>     compiler-rt/trunk/lib/profile/PGOProfiling.c
> 
> Modified: compiler-rt/trunk/lib/profile/PGOProfiling.c
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/PGOProfiling.c?rev=201808&r1=201807&r2=201808&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/profile/PGOProfiling.c (original)
> +++ compiler-rt/trunk/lib/profile/PGOProfiling.c Thu Feb 20 13:52:32 2014
> @@ -56,7 +56,10 @@ void llvm_pgo_register_writeout_function
>  }
> 
>  void llvm_pgo_writeout_files() {
> -  OutputFile = fopen("pgo-data", "w");
> +  const char *OutputName = getenv("LLVM_PROFILE_FILE");
> +  if (OutputName == NULL || OutputName[0] == '\0')
> +    OutputName = "default.profdata";
> +  OutputFile = fopen(OutputName, "w");
>    if (!OutputFile) return;
> 
>    while (writeout_fn_head) {
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140221/c90b79f2/attachment.html>


More information about the llvm-commits mailing list