<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 3, 2016, at 9:34 PM, Xinliang David Li via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><br class="Apple-interchange-newline"><br class=""><div class="gmail_quote">On Fri, Jun 3, 2016 at 9:32 PM, Matthias Braun<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:matze@braunis.de" target="_blank" class="">matze@braunis.de</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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;">MatzeB added a comment.<br class=""><span class=""><br class="">In<span class="Apple-converted-space"> </span><a href="http://reviews.llvm.org/D20993#449116" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D20993#449116</a>, @vsk wrote:<br class=""><br class="">> In<span class="Apple-converted-space"> </span><a href="http://reviews.llvm.org/D20993#449092" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D20993#449092</a>, @MatzeB wrote:<br class="">><br class="">> > This adds a bigger bunch of code to lit, I wonder if it is necessary:<br class="">> ><br class="">> > - I assume the necessity for the logic inside lit is just the fact that the profile data overwrites each other after running a command. Is setting LLVM_PROFILE_FILE with a '%p' placeholder not enough to avoid this?<br class="">><br class="">><br class="">> Using PID substitution gets close to solving the problem of having overwritten profiles, but not all the way. On 32-bit systems PID wraparound would pose a real problem. In this patch I include the hash of the test command to minimize loss of profiles.<br class=""><br class=""><br class=""></span>This is a really annoying problem to have... Maybe we should find a solution within the profile infrastructure itself (can we add another flag that adds a unique suffix to the filename if it already exists?) so not every user of the profiling infrastructure has to jump through the same hoops (I've done a similar dance in the test-suite profile support).<br class=""><span class=""><br class="">><br class=""><br class="">><br class=""><br class="">> > The final profile data merging can always be done outside of llvm-lit afterwards.<br class=""><br class="">><br class=""><br class="">><br class=""><br class="">> On a practical level, I don't think this is possible. Raw profiles are too large. Turning off the cleanup step and running check-llvm produces over half a terrabyte of data. There are a few ways to address this without touching lit:<br class=""><br class="">><br class=""><br class="">> 1. Reduce the size of raw profiles. This would make the compiler runtime larger and more complex.<br class=""><br class="">> 2. Run a monitor process that does the merging/cleanup. I don't think that approach has any advantages compared to modifying lit.<br class=""><br class="">><br class=""><br class="">>   Alternatively, we could do in-place raw profile merging in the compiler runtime. I don't think that's preferable because we'd have to introduce a lot of complexity to compiler-rt (e.g portable mandatory file locking).<br class=""><br class=""><br class=""></span>Ah, so that seems harder to solve without an external driver merging the profile data. I'm still not a big fan of injecting this stuff into the core of lit, but we may have no other choice today.<br class=""></blockquote><div class=""><br class=""></div><div class="">This is handled by the compiler-rt -- it should be totally transparent to the user.</div></div></div></div></div></blockquote><div><br class=""></div></div>That would indeed be a big usability improvement. Does it also free you from running an extra tool afterwards to convert from .profraw to .profdata format?<div class=""><br class=""></div><div class="">- Matthias</div></body></html>