[PATCH] D31566: [Support] Make printAllJSONValues public, for custom output.

Graydon Hoare via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 3 10:16:34 PDT 2017


graydon added a comment.

In https://reviews.llvm.org/D31566#716865, @MatzeB wrote:

> We could go ahead and make this function public for now.
>
> However I don't expect this API to be stable. Long term we really should move away from a global list of timers accessed by TimerGroup. In fact I am planning changes to the statistics system right now. Are you prepared to loose the function again in a few weeks?


I guess. We use it in swift, so I'd prefer you not just break swift's usage! But if you're modifying it in a way that's still usable by outside clients, we can probably adapt. What do you have planned?

> Also the fact that you need to call this function seems suspicious to me. Could you elaborate a bit why PrintStatisticsJSON() wasn't enough for your use case?

Because PrintStatisticsJSON() prints an opening- and close-brace, meaning it cannot be used as part of another printing function (at least not without introducing a superfluous level of JSON-object-nesting).

The root problem is that LLVM statistics are enabled/disabled at compile time, by a #define that I'm not really comfortable switching globally (they wind up being used pervasively in clang and llvm, and they cost a global lock + mfence every time they're incremented). So while I can rely on the _timer_ facility always being present, the statistics facility is present or absent depending on whether I'm using an asserts build. Thus for any counters that I want to "always measure", even in release builds (independent of asserts) I need to count them independently and place their output in the place where LLVM would normally put its statistics output.


https://reviews.llvm.org/D31566





More information about the llvm-commits mailing list