[cfe-dev] XRay Trace of Clang, Loadable through Chrome Trace Viewer

Dean Michael Berris via cfe-dev cfe-dev at lists.llvm.org
Tue Dec 5 07:49:08 PST 2017


Hi cfe-dev@ and llvm-dev@,

I've attached a Chrome trace-viewer readable trace of a clang built with XRay instrumentation (additional build/link flags="-fxray-instrument -fxray-instruction-threshold=75") with the latest "top-of-trunk" version of clang with the recent updates to the XRay runtime supporting record filtering.

To load the attached file, go to 'chrome://tracing' in your Chrome/Chromium browser and load the .gz file directly. Pressing '?' should give a help dialog.

As a snapshot of what it looks like for reference:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2017-12-06 at 02.38.30.png
Type: image/png
Size: 662861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171206/69e9da9d/attachment.png>
-------------- next part --------------


This is an invocation of clang compiling some random C++ file in the clang distribution.

If there's interest, I'd be happy to draft a more in-depth walk-through of how to generate this, maybe in some more share-friendly medium. Perhaps something for the LLVM blog?

For the impatient, you can generate a similar visualisation of your XRay traces with the latest `llvm-xray` tool that comes with the LLVM sources. To generate the above, all I had to do was the following:

$LLVM_BUILD_DIR/bin/llvm-xray convert -symbolize -instr_map=./bin/clang -output-format=trace_event xray-log.clang-6.0.XXXXXX | gzip > clang-6.0-default-real.txt.gz

Instructions at http://llvm.org/docs/XRayExample.html also apply to llc.

I hope this kind of instrumentation would be helpful in further improving Clang and the LLVM toolchain to see where latency in the execution of these tools are coming from.

Thanks for reading, and I hope this helps!

-- Dean

PS. Thanks go to Keith Wyss who implemented the conversion tool that generates the chrome trace viewer readable output!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-6.0-default-real.txt.gz
Type: application/x-gzip
Size: 643448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171206/69e9da9d/attachment.bin>


More information about the cfe-dev mailing list