[PATCH] D71059: [LLD][ELF] Add time-trace to ELF LLD (1/2)

Russell Gallop via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 05:17:03 PST 2019


russell.gallop created this revision.
russell.gallop added reviewers: ruiu, pcc, anton-afanasyev.
Herald added subscribers: dexonsmith, hiraditya, mehdi_amini.
Herald added a project: LLVM.

Following on from RFC here: https://reviews.llvm.org/D69043

This patch extends the TimeProfiler to support multiple threads (for ThinLTO) by making TimeTraceProfilerInstance thread local. timeTraceProfilerFinishThread() moves the thread local instance to a global vector of instances and timeTraceProfilerWrite() writes recorded trace data from all instances. This reduces locking over the initial implementation presented in the RFC and is much quicker even on relatively modest 6 core machine.

In the generated trace, threads are identified based on their thread ids. Totals are reported with artificial thread ids higher than the real ones.

Replaced raw pointer for TimeTraceProfilerInstance with unique_ptr so the compiler enforces the move from thread local to global.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71059

Files:
  llvm/include/llvm/Support/TimeProfiler.h
  llvm/lib/Support/TimeProfiler.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71059.232314.patch
Type: text/x-patch
Size: 7908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191205/64181202/attachment.bin>


More information about the llvm-commits mailing list