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

Bob Wilson bob.wilson at apple.com
Fri Feb 21 10:01:17 PST 2014


On Feb 21, 2014, at 6:17 AM, Diego Novillo <dnovillo at google.com> wrote:

> On Thu, Feb 20, 2014 at 2: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");
> 
> I was never very fond of environment variables. They lead to all kinds
> of nasty and hidden side-effects. How about a flag?

How would that work? At the time we build the code, we may not even know where to write the output. E.g., when running on iOS we can only write inside the app’s sandbox directory. We also need to be able to change the output file for different runs, and a random unique identifier won’t be good enough because we need to know which output correlates with each run.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140221/f6bb6e8a/attachment.html>


More information about the llvm-commits mailing list