<div dir="auto"><br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On 31 May 2017 23:15, "Joerg Sonnenberger via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On Wed, May 31, 2017 at 10:44:01AM -0700, Tim Northover via llvm-dev wrote:<br>
> On 31 May 2017 at 08:17, Daniel Berlin via llvm-dev<br>
> <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
> > If your concern is the atomic increments, then is there a reason to not have<br>
> > it do the counting as a runtime option instead of a compile time one?<br>
><br>
> Or increment into TLS variables and sum those at the end. Looking at a<br>
> statistic before the end of execution is dodgy territory anyway, but I<br>
> can't think of a case where it would be saner if other threads are<br>
> poking at it simultaneously.<br>
<br>
</div>Access to TLS variables can easily be more expensive than any atomics...<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Hi,</div><div dir="auto"><br></div><div dir="auto">Isn't stats essentially a fire and forget type of data flow.</div><div dir="auto">You are saying "increase this counter" but you don't actually care what the value is at the time of the update.</div><div dir="auto">Why can't you have thread local stats, thus not requiring any locking, and then add all the thread local stats up at the end, once the threads have finished?</div><div dir="auto"><br></div><div dir="auto">Lockless stats collection would be fast.</div><div dir="auto"><br></div><div dir="auto">If you happened to need to collect stats during the run, pausing of threads is needed. I.e. like you have when sitting on a breakpoint.</div><div dir="auto"><br></div><div dir="auto">Kind regards</div><div dir="auto"><br></div><div dir="auto">James</div><div dir="auto"><br></div><div dir="auto"><br></div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br></blockquote></div></div></div>