[PATCH] [Profile] compiler-rt support for setting profile output from command line

Teresa Johnson tejohnson at google.com
Tue Apr 28 07:54:23 PDT 2015


This change is the first of 3 patches to add support for specifying
the profile output from the command line via -fprofile-instr-generate=<path>,
where the specified output path/file will be overridden by the
LLVM_PROFILE_FILE environment variable.

Several changes are made to the runtime to support this:
1) Add a new interface __llvm_profile_set_filename_env_override that will
set the profile output filename, but allows the LLVM_PROFILE_FILE to override.
This is the interface used by the new option.
2) Refactor the pid-expansion done for LLVM_PROFILE_FILE into a separate
routine that can be shared by the various filename setting routines
(so that the filename from the option can also use the "%p" syntax).
3) Move the truncation into setFilename, and only truncate if there is a
new filename specified (to maintain support for appending to the same
profile file in the case of multiple shared objects built with profiling).
4) Move the handling for a NULL filename passed to __llvm_profile_setfilename*
into the new setFilenamePossiblyWithPid routine. The handling for a null
LLVM_PROFILE_FILE (which should not reset) is done by caller
setFilenameFromEnvironment.

http://reviews.llvm.org/D9323

Files:
  lib/profile/InstrProfiling.h
  lib/profile/InstrProfilingFile.c
  test/profile/instrprof-set-filename-env-override.c

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9323.24550.patch
Type: text/x-patch
Size: 4668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150428/73949342/attachment.bin>


More information about the llvm-commits mailing list