summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-xray
Commit message (Collapse)AuthorAgeFilesLines
* Merging r342461:Tom Stellard2018-10-221-2/+5
| | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r342461 | devnexen | 2018-09-18 03:31:10 -0700 (Tue, 18 Sep 2018) | 10 lines [Xray] llvm-xray fix possible segfault top argument when superior to the instrumentated code list capacity can lead to a segfault. Reviewers: dberris Reviewed By: dberris Differential Revision: https://reviews.llvm.org/D52224 ------------------------------------------------------------------------ llvm-svn: 344918
* llvm-xray: Broken chrome trace event format outputDean Michael Berris2018-07-241-0/+3
| | | | | | | | | | | | | | | | Summary: Missing comma separator for EXIT and TAIL_EXIT RecordTypes emit invalid JSON output for Chrome Trace Event Format. Reviewers: dberris Reviewed By: dberris Subscribers: sammccall, kpw, llvm-commits Differential Revision: https://reviews.llvm.org/D49687 llvm-svn: 337795
* [XRay][compiler-rt] Add PID field to llvm-xray tool and add PID metadata ↵Dean Michael Berris2018-07-132-18/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | record entry in FDR mode Summary: llvm-xray changes: - account-mode - process-id {...} shows after thread-id - convert-mode - process {...} shows after thread - parses FDR and basic mode pid entries - Checks version number for FDR log parsing. Basic logging changes: - Update header version from 2 -> 3 FDR logging changes: - Update header version from 2 -> 3 - in writeBufferPreamble, there is an additional PID Metadata record (after thread id record and tsc record) Test cases changes: - fdr-mode.cc, fdr-single-thread.cc, fdr-thread-order.cc modified to catch process id output in the log. Reviewers: dberris Reviewed By: dberris Subscribers: hiraditya, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49153 llvm-svn: 336974
* Clean up some code in Program.Zachary Turner2018-06-082-6/+4
| | | | | | | | | | NFC here, this just raises some platform specific ifdef hackery out of a class and creates proper platform-independent typedefs for the relevant things. This allows these typedefs to be reused in other places without having to reinvent this preprocessor logic. llvm-svn: 334294
* Support: Simplify endian stream interface. NFCI.Peter Collingbourne2018-05-181-1/+1
| | | | | | | | | | | | Provide some free functions to reduce verbosity of endian-writing a single value, and replace the endianness template parameter with a field. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47032 llvm-svn: 332757
* Inline contents of LLVM_XRAY_TOOLS variable into its only use.Nico Weber2018-05-091-8/+4
| | | | | | | No behavior change. https://reviews.llvm.org/D46402 llvm-svn: 331830
* use LLVM's standard CMakeLists.txt layout for llvm-xrayNico Weber2018-05-031-3/+8
| | | | llvm-svn: 331455
* [XRay][tools] Rename llvm-xray filenames from .cc -> .cpp (NFC)Dean Michael Berris2018-05-0211-19/+19
| | | | | | | | | | | | | | | | Summary: This brings the filenames in accordance to the style guide and LLVM conventions for C++ filenames. As suggested by rnk@ in D46068. Reviewers: rnk Subscribers: mgorny, mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D46301 llvm-svn: 331321
* Don't list a source file twice.Nico Weber2018-04-251-1/+0
| | | | llvm-svn: 330845
* [tools] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-04-011-67/+67
| | | | | | | | | | | | | | | | | | | | | | Summary: r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort. Refer the comments section in D44363 for a list of all the required patches. Reviewers: JDevlieghere, zturner, echristo, dberris, friss Reviewed By: echristo Subscribers: gbedwell, llvm-commits Differential Revision: https://reviews.llvm.org/D45141 llvm-svn: 328943
* [XRay] cache symbolized function names for a repeatedly queried function IDMartin Pelikan2018-03-012-1/+9
| | | | | | | | | | | | | | | | | | | Summary: Processing 2 GB XRay traces with "llvm-xray convert -symbolize" needs to go over each trace record and symbolize the function name refered to by its ID. Currently this happens by asking the LLVM symbolizer code every single time. A simple cache can save around 30 minutes of processing of that trace. llvm-xray's resident memory usage increased negligibly with this cache. Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43896 llvm-svn: 326407
* [XRay] fix 99th percentile lookups by sorting the array correctlyMartin Pelikan2018-01-301-2/+5
| | | | | | | | | | | | | | Summary: It was a copy-paste typo, sorting only to the 90th percentile twice. Now, it only sorts the array prefix once, and extracts what we need. Reviewers: dberris, kpw, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42690 llvm-svn: 323800
* Remove redundant includes from tools.Michael Zolotukhin2017-12-134-15/+0
| | | | llvm-svn: 320631
* xray-record-yaml.h: Remove unused fileDavid Blaikie2017-11-211-102/+0
| | | | llvm-svn: 318715
* [XRay] Minimal tool to convert xray traces to Chrome's Trace Event Format.Keith Wyss2017-11-074-113/+375
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Minimal tool to convert xray traces to Chrome's Trace Event Format. Summary: Make use of Chrome Trace Event format's Duration events and stack frame dict to produce Json files that chrome://tracing can visualize from xray function call traces. Trace Event format is more robust and has several features like argument logging, function categorization, multi process traces, etc. that we can add as needed. Duration events cover an important base case. Part of this change is rearranging the code so that the TrieNode data structure can be used from multiple tools and can carry parameterized baggage on the nodes. I put the actual behavior changes in llvm-xray convert exclusively. Exploring the trace of instrumented llc was pretty nifty if overwhelming. I can envision this being very useful for analyzing contention scenarios or tuning parameters like batch sizes in a producer consumer queue. For more targeted traces likemthis, let's talk about how we want to approach trace pruning. Reviewers: dberris, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39362 llvm-svn: 317531
* Removing default case statement from covered switch.Keith Wyss2017-10-131-8/+0
| | | | | | | | | | | Previous patch did not count on the llvm command line parser to restrict the inputs, but it is safe to do so. Fix forward for patch with details: -- https://reviews.llvm.org/D38650 and -- https://llvm.org/svn/llvm-project/llvm/trunk@315635 91177308-0d34-0410-b5e6-96231b3b80d8 llvm-svn: 315644
* [XRay][tools] Updated stacks tool with flamegraph output.Keith Wyss2017-10-121-19/+217
| | | | | | | | | | | | | | | | | | | | | Summary: As the first step to allow analysis and visualization of xray collected data, allow using the llvm-xray stacks tool to emit a complete listing of stacks in the format consumable by a flamegraph tool. Possible follow up formats include chrome trace viewer format and sql load files. As a POC, I'm able to generate flamegraphs of an xray instrumented llc compiling hello world. Reviewers: dberris, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38650 llvm-svn: 315635
* [XRay] fix the -Werror build by handling all enum cases in switchesMartin Pelikan2017-09-272-1/+5
| | | | | | Followup to D32840. llvm-svn: 314270
* [XRay] convert FDR arg1 log entriesMartin Pelikan2017-09-273-3/+6
| | | | | | | | | | | | | | | | | | | | Summary: A new FDR metadata record will support logging a function call argument; appending multiple metadata records will represent a sequence of arguments meaning that "holes" are not representable by the buffer format. Each call argument is currently a 64-bit value (useful for "this" pointers and synchronization objects). If present, we put this argument to the function call "entry" record it belongs to, and alter its type to notify the user of its presence. Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32840 llvm-svn: 314269
* [XRay][tools] Support tail-call exits before we write them in the runtimeDean Michael Berris2017-09-184-3/+12
| | | | | | | | | | | | | | | | | Summary: This change adds support for explicit tail-exit records to be written by the XRay runtime. This lets us differentiate the tail exit records/events in the log, and allows us to treat those exit events especially in the future. For now we allow printing those out in YAML (and reading them in). Reviewers: kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37964 llvm-svn: 313514
* Don't call exit from cl::PrintHelpMessage.Rafael Espindola2017-09-071-0/+1
| | | | | | | | | Most callers were not expecting the exit(0) and trying to exit with a different value. This also adds back the call to cl::PrintHelpMessage in llvm-ar. llvm-svn: 312761
* [XRay][tools] Function call stack based analysis tooling for XRay tracesKeith Wyss2017-09-073-1/+636
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Second try after fixing a code san problem with iterator reference types. This change introduces a subcommand to the llvm-xray tool called "stacks" which allows for analysing XRay traces provided as inputs and accounting time to stacks instead of just individual functions. This gives us a more precise view of where in a program the latency is actually attributed. The tool uses a trie data structure to keep track of the caller-callee relationships as we process the XRay traces. In particular, we keep track of the function call stack as we enter functions. While we're doing this we're adding nodes in a trie and indicating a "calls" relatinship between the caller (current top of the stack) and the callee (the new top of the stack). When we push function ids onto the stack, we keep track of the timestamp (TSC) for the enter event. When exiting functions, we are able to account the duration by getting the difference between the timestamp of the exit event and the corresponding entry event in the stack. This works even if we somehow miss the exit events for intermediary functions (i.e. if the exit event is not cleanly associated with the enter event at the top of the stack). The output of the tool currently provides just the top N leaf functions that contribute the most latency, and the top N stacks that have the most frequency. In the future we can provide more sophisticated query mechanisms and potentially an export to database feature to make offline analysis of the stack traces possible with existing tools. Differential revision: D34863 llvm-svn: 312733
* Revert "[XRay][tools] Function call stack based analysis tooling for XRay ↵Keith Wyss2017-09-033-636/+1
| | | | | | | | | | traces" This reverts commit 204a65e0702847a1880336372ad7abd1df414b44. Double ref qualifier failed bots. llvm-svn: 312428
* [XRay][tools] Function call stack based analysis tooling for XRay tracesKeith Wyss2017-09-033-1/+636
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces a subcommand to the llvm-xray tool called "stacks" which allows for analysing XRay traces provided as inputs and accounting time to stacks instead of just individual functions. This gives us a more precise view of where in a program the latency is actually attributed. The tool uses a trie data structure to keep track of the caller-callee relationships as we process the XRay traces. In particular, we keep track of the function call stack as we enter functions. While we're doing this we're adding nodes in a trie and indicating a "calls" relatinship between the caller (current top of the stack) and the callee (the new top of the stack). When we push function ids onto the stack, we keep track of the timestamp (TSC) for the enter event. When exiting functions, we are able to account the duration by getting the difference between the timestamp of the exit event and the corresponding entry event in the stack. This works even if we somehow miss the exit events for intermediary functions (i.e. if the exit event is not cleanly associated with the enter event at the top of the stack). The output of the tool currently provides just the top N leaf functions that contribute the most latency, and the top N stacks that have the most frequency. In the future we can provide more sophisticated query mechanisms and potentially an export to database feature to make offline analysis of the stack traces possible with existing tools. llvm-svn: 312426
* [XRay][tools] Fix an accounting bug in llvm-xray accountDean Michael Berris2017-08-311-3/+31
| | | | | | | | | | | | | | | | | | Summary: Before this patch, llvm-xray account will assume that thread stacks will not be empty. Unfortunately there are cases where an instrumented function will see a call to `fork()` which will cause the child process to not see the start of the function, but only see the end of the function. The tooling cannot assume that threads will always have perfect stacks, and so we change it to support this reality. Reviewers: dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31870 llvm-svn: 312204
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-071-1/+1
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* [XRay][tools] Remove wayward semicolon (NFC)Dean Michael Berris2017-04-261-1/+1
| | | | | | Follow-up to D29320. llvm-svn: 301378
* [XRay][tools] Fixup definition for stat division.Dean Michael Berris2017-04-261-3/+3
| | | | | | | | Copy-pasta error. Follow-up to D29320. llvm-svn: 301376
* [XRay][tools] Fixup for pedantic and permissive errors/warningsDean Michael Berris2017-04-242-3/+3
| | | | | | | | Remove extraneous semicolons and fully qualify the Trace type. Follow-up to D29320. llvm-svn: 301161
* [XRay] A tool for Comparing xray function call graphsDean Michael Berris2017-04-247-132/+786
| | | | | | | | | | | | | | | | | | | | | | Summary: This is a tool for comparing the function graphs produced by the llvm-xray graph too. It takes the form of a new subcommand of the llvm-xray tool 'graph-diff'. This initial version of the patch is very rough, but it is close to feature complete. Depends on D29363 Reviewers: dblaikie, dberris Reviewed By: dberris Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D29320 llvm-svn: 301160
* [XRay][tools] Add option to llvm-xray extract to symbolize functionsDean Michael Berris2017-04-181-3/+20
| | | | | | | | | | | | | | Summary: This allows us to, if the symbol names are available in the binary, be able to provide the function name in the YAML output. Reviewers: dblaikie, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32153 llvm-svn: 300624
* [XRay][tools] Remove some assertions in llvm-xray graphDean Michael Berris2017-03-311-6/+1
| | | | | | | | | | | | | | | | | Summary: Assertions assuming that function calls may not have zero durations do not seem to hold in the wild. There are valid cases where the conversion of the tsc counters end up becoming zero-length durations. These assertions don't really hold and the algorithms don't need those to be true for them to work. Reviewers: dblaikie, echristo Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31519 llvm-svn: 299150
* [XRay][tools] Handle "no subcommand" case for llvm-xrayDean Michael Berris2017-03-291-1/+9
| | | | | | | | | | | | | | | | Summary: Currently the llvm-xray commandline tool fails to handle the case for when no subcommand is provided in a graceful manner. This fixes that to print the help message explaining the subcommands and the available options. Reviewers: pcc, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31409 llvm-svn: 298975
* [XRAY] A Color Choosing helper for XRay GraphDean Michael Berris2017-02-255-60/+292
| | | | | | | | | | | | | | | | | | | Summary: In Preparation for graph comparison, this patch breaks out the color choice code from xray-graph into a library and adds polynomials for the Sequential and Difference sets from ColorBrewer. Depends on D29005 Reviewers: dblaikie, chandlerc, dberris Reviewed By: dberris Subscribers: chandlerc, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D29363 llvm-svn: 296210
* [XRAY] [x86_64] Adding a Flight Data filetype reader to the llvm-xray Trace ↵Dean Michael Berris2017-02-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | implementation. Summary: The file type packs function trace data onto disk from potentially multiple threads that are aggregated and flushed during the course of an instrumented program's runtime. It is named FDR mode or Flight Data recorder as an analogy to plane blackboxes, which instrument a running system without access to IO. The writer code is defined in compiler-rt in xray_fdr_logging.h/cc Reviewers: rSerge, kcc, dberris Reviewed By: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29697 llvm-svn: 295397
* Disable wrapping llvm-xray YAML outputDimitry Andric2017-02-142-2/+2
| | | | | | | | | | | | | | | | | | | | | Summary: The YAML output produced by llvm-xray is supposed to be wrapped at the arbitrary default of 70 columns set by `yaml:Output`. Unfortunately, the wrapping is rather unpredictable, and can easily go past the set number of columns, depending on the execution environment. To make the YAML output environment-independent, disable wrapping instead. Reviewers: dberris Reviewed By: dberris Subscribers: fhahn, llvm-commits Differential Revision: https://reviews.llvm.org/D29962 llvm-svn: 295116
* [XRay] A graph Class for the llvm-xray graphDean Michael Berris2017-02-102-96/+104
| | | | | | | | | | | | | | | | | | | Summary: In preparation for graph comparison and filtering, this is a library for representing graphs in LLVM. This will enable easier encapsulation and reuse of graphs in llvm-xray. Depends on D28999, D28225 Reviewers: dblaikie, dberris Reviewed By: dberris Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D29005 llvm-svn: 294717
* Revert "[XRay] A graph Class for the llvm-xray graph"Dean Michael Berris2017-02-102-105/+96
| | | | | | Broke tests, reverting. llvm-svn: 294714
* [XRay] A graph Class for the llvm-xray graphDean Michael Berris2017-02-102-96/+105
| | | | | | | | | | | | | | | | | | | Summary: In preparation for graph comparison and filtering, this is a library for representing graphs in LLVM. This will enable easier encapsulation and reuse of graphs in llvm-xray. Depends on D28999, D28225 Reviewers: dblaikie, dberris Reviewed By: dberris Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D29005 llvm-svn: 294713
* [XRay] Use std::errc::invalid_argument instead of std::errc::bad_messageDean Michael Berris2017-02-011-1/+1
| | | | | | | | This change should appease the mingw32 builds. Follow-up to D29319. llvm-svn: 293725
* [XRay] Define the InstrumentationMap typeDean Michael Berris2017-02-016-448/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change implements the instrumentation map loading library which can understand both YAML-defined instrumentation maps, and ELF 64-bit object files that have the XRay instrumentation map section. We break it out into a library on its own to allow for other applications to deal with the XRay instrumentation map defined in XRay-instrumented binaries. This type provides both raw access to the logical representation of the instrumentation map entries as well as higher level functions for converting a function ID into a function address. At this point we only support ELF64 binaries and YAML-defined XRay instrumentation maps. Future changes should extend this to support 32-bit ELF binaries, as well as other binary formats (like MachO). As part of this change we also migrate all uses of the extraction logic that used to be defined in tools/llvm-xray/ to use this new type and interface for loading from files. We also remove the flag from the `llvm-xray` tool that required users to specify the type of the instrumentation map file being provided to instead make the library auto-detect the file type. Reviewers: dblaikie Subscribers: mgorny, varno, llvm-commits Differential Revision: https://reviews.llvm.org/D29319 llvm-svn: 293721
* Remove unused 'using' declaration. Found by clang-tidy: ↵Sylvestre Ledru2017-01-281-1/+0
| | | | | | misc-unused-using-decls NFC llvm-svn: 293382
* Implemented color coding and Vertex labels in XRay GraphDean Michael Berris2017-01-252-89/+345
| | | | | | | | | | | | | | | | | | Summary: A patch to enable the llvm-xray graph subcommand to color edges and vertices based on statistics and to annotate vertices with statistics. Depends on D27243 Reviewers: dblaikie, dberris Reviewed By: dberris Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D28225 llvm-svn: 293031
* Remove pid_t usage from llvm-xrayPavel Labath2017-01-171-1/+3
| | | | | | This type is not available on windows. llvm-svn: 292206
* Add missing header to see if that clears up the buildDavid Blaikie2017-01-161-0/+1
| | | | llvm-svn: 292166
* Attempt to fix the MSVC build by using llvm::errc instead of std::errcDavid Blaikie2017-01-161-4/+4
| | | | llvm-svn: 292163
* [XRay] Implement the `llvm-xray graph` subcommandDavid Blaikie2017-01-163-0/+495
| | | | | | | | | | | | Here we define the `graph` subcommand which generates a graph from the function call information and uses it to present the call information graphically with additional annotations. Reviewers: dblaikie, dberris Differential Revision: https://reviews.llvm.org/D27243 llvm-svn: 292156
* [llvm-xray] Fix android buildPavel Labath2017-01-161-1/+2
| | | | | | | | | std::to_string is not available in the android ndk. Using llvm::to_string instead. Committing as obvious. llvm-svn: 292143
* xray-account: Avoid std::errc::bad_message to appease mingw.NAKAMURA Takumi2017-01-131-1/+1
| | | | llvm-svn: 291863
* Avoid std::errc::protocol_* to appease mingwHans Wennborg2017-01-122-2/+2
| | | | | | Like r291636 and r285261. llvm-svn: 291786
OpenPOWER on IntegriCloud