[llvm-dev] Enable STATISTIC all the time again?

James Courtier-Dutton via llvm-dev llvm-dev at lists.llvm.org
Sun Jun 4 02:09:42 PDT 2017


On 31 May 2017 23:15, "Joerg Sonnenberger via llvm-dev" <
llvm-dev at lists.llvm.org> wrote:

On Wed, May 31, 2017 at 10:44:01AM -0700, Tim Northover via llvm-dev wrote:
> On 31 May 2017 at 08:17, Daniel Berlin via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > If your concern is the atomic increments, then is there a reason to not
have
> > it do the counting as a runtime option instead of a compile time one?
>
> Or increment into TLS variables and sum those at the end. Looking at a
> statistic before the end of execution is dodgy territory anyway, but I
> can't think of a case where it would be saner if other threads are
> poking at it simultaneously.

Access to TLS variables can easily be more expensive than any atomics...


Hi,

Isn't stats essentially a fire and forget type of data flow.
You are saying "increase this counter" but you don't actually care what the
value is at the time of the update.
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?

Lockless stats collection would be fast.

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.

Kind regards

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170604/c3657dbd/attachment.html>


More information about the llvm-dev mailing list