Skip to content

Commit 85a5668

Browse files
KaigeFudbkinder
authored andcommitted
tools: acrntrace: Updata README.rst
-Add acrntrace_format.py usage to README.rst -Add acrntrace usage to README.rst -Add acrnanalyze.py to README.rst Signed-off-by: Kaige Fu <kaige.fu@intel.com> Reviewed-by: Yan, Like <like.yan@intel.com> Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com> Acked-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
1 parent fa98b57 commit 85a5668

File tree

1 file changed

+76
-4
lines changed

1 file changed

+76
-4
lines changed

tools/acrntrace/README.rst

Lines changed: 76 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,71 @@ A ``scripts`` directory includes scripts to analyze the trace data.
1212
Usage
1313
*****
1414

15+
The ``acrntrace`` tool runs on the Service OS (SOS) to capture trace data and
16+
output to trace file under ``/tmp/acrntrace`` with raw (binary) data format.
17+
18+
Options:
19+
20+
-h print this message
21+
-t period specify polling interval in milliseconds [1-999]
22+
-c clear the buffered old data
23+
24+
The ``acrntrace_format.py`` is a offline tool for parsing trace data (as output
25+
by acrntrace) to human-readable formats based on given format.
26+
27+
Here's an explanation of the tool's parameters:
28+
29+
.. code-block:: none
30+
31+
acrntrace_format.py [options] [formats] [trace_data]
32+
33+
Options:
34+
35+
-h print this message
36+
37+
*formats* file specifies the rules to reformat the *trace_data* collected by
38+
``acrntrace`` into a human-readable text form. The rules in this file are of
39+
the form::
40+
41+
event_id text_format_string
42+
43+
The text_format_string may include format specifiers, such as
44+
``%(cpu)d``, ``%(tsc)d``, ``%(event)d``, ``%(1)d``, and ``%(2)d``.
45+
The 'd' format specifier outputs in decimal, alternatively 'x' will
46+
output in hexadecimal and 'o' will output in octal.
47+
48+
These respectively correspond to the CPU number (cpu), timestamp
49+
counter (tsc), event ID (event) and the data logged in the trace file.
50+
There can be only one such rule for each type of event.
51+
52+
An example *formats_file* is available in the acrn_hypervisor repo in
53+
``hypervisor/tools/acrntrace/scripts/formats``.
54+
55+
The ``acrnalyze.py`` is a offline tool to analyze trace data (as output by
56+
acrntrace) based on given analyser, such as ``vm_exit`` or ``irq``.
57+
58+
Options:
59+
60+
-h print this message
61+
-i, --ifile=string input file name
62+
-o, --ofile=string output filename
63+
-f, --frequency=unsigned_int TSC frequency in MHz
64+
--vm_exit generate a vm_exit report
65+
--irq generate an IRQ-related report
66+
67+
.. note:: We depend on TSC frequency to do time-based analysis. Please configure
68+
the right TSC frequency that acrn runs on. TSC frequency can be obtained
69+
from the ACRN console log (calibrate_tsc, tsc_hz=xxx) when the hypervisor boots.
70+
71+
The tool does not take into account CPU frequency variation that can
72+
occur during normal operation (aka CPU throttling) on the processor which
73+
doesn't support for invariant TSC. The results may therefore not be
74+
completely accurate in that regard.
75+
76+
Here's a typical use of ``acrntrace`` to capture trace data from the SOS,
77+
converting the binary data to human-readable form, copying the processed trace
78+
data to your linux system, and running the analysis tool.
79+
1580
1. On the SOS, clear buffers before starting a trace, with:
1681

1782
.. code-block:: none
@@ -33,6 +98,15 @@ Usage
3398
3499
q <enter>
35100
101+
#. Convert trace data to human-readable format, with:
102+
103+
.. code-block:: none
104+
105+
# acrntrace_format.py formats trace_data
106+
107+
Trace data will be converted to human-readable format based on given format
108+
and printed to stdout.
109+
36110
#. Analysis of the collected data is done on a Linux PC, so you'll need
37111
to copy the collected trace data to your Linux system (using ``scp`` is
38112
recommended):
@@ -45,15 +119,13 @@ Usage
45119
Replace username and hostname with appropriate values.
46120

47121
#. On the Linux system, run the provided Python3 script to analyze the
48-
``vm_exits`` (currently only vm_exit analysis is supported):
122+
``vm_exits``, ``irq``:
49123

50124
.. code-block:: none
51125
52126
# acrnalyze.py -i /home/xxxx/trace_data/20171115-101605/0 \
53-
-o /home/xxxx/trace_data/20171115-101605/cpu0 --vm_exit
127+
-o /home/xxxx/trace_data/20171115-101605/cpu0 --vm_exit --irq
54128
55-
- A preprocess makes some changes to the datafile for processing but
56-
a copy of the original data file is saved with suffix ``.orig``.
57129
- Analysis report is written to stdout, or to a CSV file if
58130
a filename is specified using ``-o filename``.
59131
- The scripts require Python3.

0 commit comments

Comments
 (0)