xctrace(1) | General Commands Manual | xctrace(1) |
xctrace
— Record,
import, export and symbolicate Instruments .trace files.
xctrace |
[command [options]] |
xctrace |
help [command] |
xctrace |
record [--output
path] [--append-run ]
[--template path |
name] [--device
name | UDID]
[--time-limit time
[ms|s|m|h]] [--all-processes |
--attach pid |
name | --launch
command [arguments]]
[--target-stdin - |
file] [--target-stdout
- | file]
[--env VAR=value]
[--package file]
[--no-prompt ]
[--notify-tracing-started
name]
|
xctrace |
import [--input
file] [--output
path] [--template
path | name]
[--package file] |
xctrace |
export [--input
file] [--output
path] [--toc |
--xpath expression] |
xctrace |
remodel [--input
file] [--output
path] [--package
file] |
xctrace |
symbolicate [--input
file] [--output
path] [--dsym
file] |
xctrace |
list [devices |
templates | instruments] |
xctrace
is used to record new
Instruments.app .trace files using the specified recording template. It also
allows for converting supported converting files of supported input types
into .trace files and exporting data from .trace files to parseable formats
like xml.
Available commands and their options:
help
record
xctrace
. Recording can target all
processes, attach to an existing process or launch a new one.
--output
path--append-run
is specified. In
this case the provided template will be ignored and the template in
the existing trace will be used. If the passed path is a directory, a
uniquely named file will be created in it. If the path contains the
extension .trace, a new trace will be created with that name at the
specified path or working directory.--append-run
--template
path | namexctrace
list
templates.
--instrument
namexctrace
list
instruments.
--device
name | UDIDsimulator
is included, devices of simulator
types will be preferred. To get list of available devices, run
xctrace
list
devices.
--time-limit
time [ms|s|m|h]--window
duration [ms|s|m]--all-processes
--attach
pid | name--launch
--
command
[arguments]xctrace
command invocation.--package
file--target-stdin
- | filexctrace
to be passed into the standard input
of a target process.--target-stdout
- | filexctrace
.--env
VAR=value--no-prompt
--notify-tracing-started
nameimport
xctrace
export
command.
--input
file--output
path--template
path | namexctrace
list
templates.
--instrument
namexctrace
list instruments.
--package
fileexport
xctrace
. Recording can target all
processes, attach to an existing process or launch a new one.
--input
file--output
pathxctrace
standard output.--toc
--xpath
expression--har
remodel
symbolicate
--input
file--output
path--dsym
pathlist
devices
list
templates
xctrace
.
These include Instruments.app bundled templates, templates from installed
Instruments Packages and custom templates installed into Application
Support directory for Instruments.app.list
instruments
--quiet
Instruments.app may be used to perform trace recordings in a
graphical environment and may also be used to open trace documents created
by xctrace
.
Import a logarchive file to the trace file with a unique name using a MyCustomTemplate template:
% xctrace import --input
system_logs.logarchive --template 'MyCustomTemplate'
Import a ktrace file into a new document created from the template with name MyCustomTemplate and adding the instrument from /tmp/PackageToLoad.instrdst and save the resulting document as output.trace:
% xctrace import --input
trace001.ktrace --template 'MyCustomTemplate' --package
'/tmp/PackageToLoad.instrdst' --output output.trace
Export a table of contents (toc) of the input.trace file to standard output:
% xctrace export --input input.trace
--toc
Export recorded data from a table with my-table-schema schema in the first run of the input.trace file to standard output:
% xctrace export --input input.trace
--xpath
'/trace-toc/run[@number="1"]/data/table[@schema="my-table-schema"]'
Export UUID, binary path, load address and architecture for each binary image contained in the first run of the input.trace and save as output.xml:
% xctrace export --input input.trace
--output output.xml --xpath
'/trace-toc/run[@number="1"]/processes'
Export UUID, binary path, load address and architecture for each binary image used by the process named my-process-name in the first run of the input.trace file to standard output:
% xctrace export --input input.trace
--xpath
'/trace-toc/run[@number="1"]/processes/process[@name="my-process-name"]'
Start recording all processes on the local Mac device using the Time Profiler template and automatically stop the recording after 5s:
% xctrace record --all-processes
--template 'Time Profiler' --time-limit 5s
Start a new recording by attaching to the process with name Trailblazer on the connected device Chad's iPhone using the template Time Profiler:
% xctrace record --template 'Time
Profiler' --device-name 'Chad's iPhone' --attach 'Trailblazer'
Start Metal System Trace template recording on a simulator device named iPhone SE Simulator, capturing all existing processes:
% xctrace record --template 'Metal
System Trace' --device-name 'iPhone SE Simulator' --all-processes
Start Time Profiler template recording on a local Mac device, launching and profiling binary at /tmp/tool path with arg1 arg2 arguments, output of the binary gets redirected to the standard output:
% xctrace record --template 'Time
Profiler' --target-stdout - --launch -- /tmp/tool arg1 arg2
Symbolicate the input.trace file using debug information from a SomeLibrary.dSYM file:
% xctrace symbolicate --input
input.trace --dsym SomeLibrary.dSYM
Symbolicate the input.trace file by trying automatically locate debug information:
% xctrace symbolicate --input
input.trace
January 3, 2023 | macOS |