Collecting Result Data from the Command Line
You can use the
command to perform analysis and collect data as a background or automated task, which is particularly useful when the estimated collection time is lengthy, or when you want analysis and report generation to be part of your regularly scheduled processes.
Intel Inspector
inspxe-cl
This documentation uses the terms
analysis
and data collection
as synonyms for the same process. When you initiate analysis, there are
collectors
that perform analysis based on your specified
analysis type
or
knob
values. The collected analysis data is packaged into a result.
The result is not directly viewable, but can be opened in the GUI or used to generate one or more kinds of reports. Some additional analysis occurs when reports are generated, so report generation may require source files in addition to the result.
Getting Started with Analysis on the Command Line
Here are the basic steps you would follow the first time you inspect your application for memory and threading issues.
- Set up your command line environment. See the following Process Example section for details.
- Invoke thecommand with theinspxe-clcollectaction, specifying one of the lower-level memory error analysis types to inspect your application for memory issues.
- Next, use thecollectaction with one of the threading error analysis types to inspect your application for threading issues.
- After each analysis, you can read the Summary report, and then open your result for viewing in the GUI, or use thereportaction to generate a report from the analysis result.
- Collections that use lower-level analysis types take less time to complete than collections that use higher-level analysis types, and provide more of an overview, which are two reasons why you generally want to begin testing with the lowest-level analysis types.
- To duplicate an analysis performed in theIntel InspectorGUI: Use theCommand Linebutton on theAnalysis Typewindow panes to copy the exact command to the clipboard.
How the Collection Process Works
There are two actions that you can use to initiate analysis and data collection:
collect
and
collect-with
. These actions are very similar, as both perform the same basic collection process. The
collect
action provides a variety of predefined analysis types from which to select. If none of these predefined analysis types meet your specific needs, you can use the
collect-with
action and specify your own knob options.
By default, the collection process:
- Performs the specified type of analysis.
- Collects data and writes it to a result file in a result directory.
- Finalizes the result and generates a summary of all detected problems, writes the Summary tostdoutand also saves it to an XML file in the result directory.
- Creates a log for troubleshooting purposes, and saves it in the result directory.
- Returns an exit code.
How to Perform Analysis on the Command Line
Here is a general example of how to perform analysis using the
command tool.
inspxe-cl
- You can open a terminal and use the following commend to run the script that establishesIntel Inspectorenvironment settings:source <install-dir>/inspxe-vars.shForIntel® oneAPI HPC ToolkitorIntel® oneAPI IoT Toolkitinstallations, the script is namedrather than inspxe-vars.env\varsAdd thebin64(orbin32) directory (located in the installation directory) to your PATH environment variable.
- To inspect themyAppapplication for memory leak problems, use thecollectaction with themi1(Detect Leaks) analysis type, and specify the search directory where all the source, binary and symbol files are stored.-collect mi1 -search-dir all=inspxe-cl/myProject-- myAppBy default, the result is written to a result directory under the default current working directory. Assuming this is the first result directory, it will be namedr000mi1. A Summary is sent tostdout, and saved in the result directory asinspxe-cl.xml.If you do not supply an absolute pathname for the application, system path environment settings are used to locate it.
- Next, inspect themyAppapplication for deadlock and data races, using thecollectaction with theti2(Detect Deadlocks and Data Races) analysis type, and specify the same search directories that you used for the memory analysis.inspxe-cl-collect ti2 -search-dir all=/myProject-- myAppBy default, the result is written to a result directory under the current working directory. Assuming this is the first result directory, it will be namedr000ti2. The summary is sent tostdout, and saved in ther000ti2result directory asinspxe-cl.xml.
Next Steps
- Review the Summary of detected problems in each of theinspxe-cl.xmlfiles.
- If one of the summaries contains anything other than 0 new problems, you can enterinspxe-guito launch the result in the standalone GUI so you can view details and have easy access to your code editor and other tools. You can also use thereportaction to generate a report.