[PATCH] D118550: [Support][nfc] Add RAII helper for cleaning up time profiler in thread

Russell Gallop via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 31 06:03:43 PST 2022


russell.gallop added a comment.

In D118550#3283693 <https://reviews.llvm.org/D118550#3283693>, @int3 wrote:

> Yeah, I think that's probably a good idea. It took me a while to figure out that initializing the profiler on a per-thread basis was required; it was not at all obvious why my profiler events had started disappearing while I was parallelizing `lld`. Having it done automatically would've saved me some headache.

Yes, it might help anyone working to further parallelise lld (as long as the scopes are there).

> Another advantage would be that we could actually initialize the profiler once per thread, instead of once per task.

That's a good point.

> One drawback I guess is that there isn't a good way to specify the ProcName for these threads any more. But perhaps the ProcName was never really that relevant, and the spawned threads could just initialize it with the empty string?

ProcName was originally intended to be clang/lld etc. at the top level, so I'm not sure it's very useful in the way it's used in threads at the moment. This could be empty, or (e.g.) "Thread 1" etc.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118550/new/

https://reviews.llvm.org/D118550



More information about the llvm-commits mailing list