[PATCH] D19295: [profile] Clang support for memory-mapping profile counters
Vedant Kumar via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 19 15:49:27 PDT 2016
vsk created this revision.
vsk added a reviewer: davidxl.
vsk added a subscriber: cfe-commits.
**Summary**
Using memory-mapped profile counters makes it possible to take snapshots of a running process's profiling information without changing the program. This is useful if the process exits abnormally, or if profiling data needs to be collected periodically.
Add the clang support required to create instrumented programs which memory-map their counters directly onto a raw profile.
**More details**
This patch teaches clang to page-align the __llvm_prf_counts section (just on Darwin, initially). Because clang only knows the host system's page size -- not the target system's -- this is a best-effort attempt. If the instrumented program detects that the counters section has the wrong alignment, it will disable the memory-mapped counters feature.
I can add support for other platforms and linkers in follow-up patches.
Depends on: http://reviews.llvm.org/D19293 (llvm)
http://reviews.llvm.org/D19295
Files:
include/clang/Driver/ToolChain.h
lib/Driver/ToolChain.cpp
lib/Driver/ToolChains.cpp
lib/Driver/ToolChains.h
lib/Driver/Tools.cpp
test/Driver/instrprof-ld.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19295.54285.patch
Type: text/x-patch
Size: 10576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160419/d8a28a3c/attachment.bin>
More information about the cfe-commits
mailing list