[PATCH] D22593: [Profile] document %h and %m
David Li via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 20 14:10:42 PDT 2016
davidxl created this revision.
davidxl added reviewers: vsk, silvas.
davidxl added a subscriber: cfe-commits.
Added documentation for %h and %m specifiers. %<n>m specifier which specifies the number of copies is not documented yet (treated as internal for now)
https://reviews.llvm.org/D22593
Files:
docs/UsersManual.rst
Index: docs/UsersManual.rst
===================================================================
--- docs/UsersManual.rst
+++ docs/UsersManual.rst
@@ -1470,16 +1470,45 @@
2. Run the instrumented executable with inputs that reflect the typical usage.
By default, the profile data will be written to a ``default.profraw`` file
- in the current directory. You can override that default by setting the
- ``LLVM_PROFILE_FILE`` environment variable to specify an alternate file.
+ in the current directory. You can override that default by using option
+ ``-fprofile-instr-generate=`` or by setting the ``LLVM_PROFILE_FILE``
+ environment variable to specify an alternate file. If non-default file name
+ is specified by both the environment variable and the command line option,
+ the environment variable takes precedence. The file name pattern specified
+ can include different modifiers: ``%p``, ``%h``, and ``%m``.
+
Any instance of ``%p`` in that file name will be replaced by the process
ID, so that you can easily distinguish the profile output from multiple
runs.
.. code-block:: console
$ LLVM_PROFILE_FILE="code-%p.profraw" ./code
+ The modifier ``%h`` can be used in scenarios where the same instrumented
+ binary is run in multiple different host machines dumping profile data
+ to a shared network based storage. The ``%h`` specifier will be substituted
+ with the hostname so that profiles collected from different hosts do not
+ clobber each other.
+
+ While the use of ``%p`` specifier can reduce the likelihood for the profiles
+ dumped from different processes to clobber each other, such clobbering can still
+ happen because of the ``pid`` re-use by the OS. Aother side-effect of using
+ ``%p`` is that the storage requirement for raw profile data files is greatly
+ increased. To avoid issues like this, the ``%m`` specifier can used in the profile
+ name. When this specifier is used, the profiler runtime will substitute ``%m``
+ with a unique integer identifier associated with the instrumented binary. Multiple
+ profiles dumped from different processes (running on the same or different hosts)
+ will be automatically merged by the profiler runtime during the dumping. If
+ the program links in multiple instrumented shared libraries, each library will
+ dump the profile data into its own profile data file (with its unique integer
+ id embedded in the profile name).
+
+ .. code-block:: console
+
+ $ LLVM_PROFILE_FILE="code-%m.profraw" ./code
+
+
3. Combine profiles from multiple runs and convert the "raw" profile format to
the input expected by clang. Use the ``merge`` command of the
``llvm-profdata`` tool to do this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22593.64758.patch
Type: text/x-patch
Size: 2749 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160720/7596f910/attachment.bin>
More information about the cfe-commits
mailing list