<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 21, 2014 at 9:55 PM, Bob Wilson <span dir="ltr"><<a href="mailto:bob.wilson@apple.com" target="_blank">bob.wilson@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div class=""><div>
On Feb 21, 2014, at 2:35 AM, Kostya Serebryany <<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>> wrote:</div><br></div><blockquote type="cite"><div dir="ltr"><div class="">AsanCov emits file_name.PID so that you can run multiple processes with coverage (each spawning multiple subprocesses) and <div>
they will not fight over the same file. An env. var. does not give us that. </div>
<div><br></div></div><div>—kcc </div></div></blockquote><div><br></div>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.</div>
<div><br></div><div>Can you think of a simple way to provide both options? I really don’t want to make this more complicated than necessary.</div></div></blockquote><div><br></div>We may want to follow the path chosen by valgrind for --log-file=</div>
<div class="gmail_quote">See <a href="http://valgrind.org/docs/manual/manual-core.html">http://valgrind.org/docs/manual/manual-core.html</a> where --log-file= is described. </div><div class="gmail_quote">In short, they allow %p in the file name, and %p will be replaced with PID. </div>
<div class="gmail_quote"><br></div><div class="gmail_quote">Sanitizers (when used with log_path option) always dump output to name.PID. </div><div class="gmail_quote">W/o PID (or other unique ID) you essentially can not log from a multi-process program.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">--kcc </div><div class="gmail_quote"><br></div><div class="gmail_quote"><br><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><div class="h5"><div><br><blockquote type="cite"><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 20, 2014 at 11:52 PM, Bob Wilson <span dir="ltr"><<a href="mailto:bob.wilson@apple.com" target="_blank">bob.wilson@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: bwilson<br>
Date: Thu Feb 20 13:52:32 2014<br>
New Revision: 201808<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=201808&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=201808&view=rev</a><br>
Log:<br>
Add an environment variable to override the default profile output file.<br>
<br>
Also rename the default output file from "pgo-data" to "default.profdata".<br>
The ".profdata" suffix is consistent with the name of the new llvm-profdata<br>
tool.<br>
<br>
Modified:<br>
    compiler-rt/trunk/lib/profile/PGOProfiling.c<br>
<br>
Modified: compiler-rt/trunk/lib/profile/PGOProfiling.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/PGOProfiling.c?rev=201808&r1=201807&r2=201808&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/PGOProfiling.c?rev=201808&r1=201807&r2=201808&view=diff</a><br>


==============================================================================<br>
--- compiler-rt/trunk/lib/profile/PGOProfiling.c (original)<br>
+++ compiler-rt/trunk/lib/profile/PGOProfiling.c Thu Feb 20 13:52:32 2014<br>
@@ -56,7 +56,10 @@ void llvm_pgo_register_writeout_function<br>
 }<br>
<br>
 void llvm_pgo_writeout_files() {<br>
-  OutputFile = fopen("pgo-data", "w");<br>
+  const char *OutputName = getenv("LLVM_PROFILE_FILE");<br>
+  if (OutputName == NULL || OutputName[0] == '\0')<br>
+    OutputName = "default.profdata";<br>
+  OutputFile = fopen(OutputName, "w");<br>
   if (!OutputFile) return;<br>
<br>
   while (writeout_fn_head) {<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</blockquote></div><br></div></div></div></blockquote></div><br></div></div>