# TRACE-CMD-ATTACH(1) Manual Page

## NAME

trace-cmd-attach - attach a guest trace.dat file to a host trace.dat file

## SYNOPSIS

trace-cmd attach [OPTIONS] host-trace-file guest-trace-file guest-pid [guest-pid …]

## DESCRIPTION

The trace-cmd(1) attach is used to take a trace.dat file created on a guest and attach it to a trace.dat file that was created on the host. In most cases, trace-cmd-agent(1) can be used to automate this, but if for some reason, the agent isn’t appropriate, it may be required to start trace-cmd recording on the guest with trace-cmd-record(1). If the host recording is activated at the same time, one can use trace-cmd attach(1) to connect the guest and host files as if they were created by the trace-cmd agent.

host-trace-file

  The trace.dat file created by the host. Must have kvm_exit and kvm_entry events, and use the "tsc2nsec" clock.

guest-trace-file

  The trace.dat file created by the guest. Must use the "x86-tsc" clock. For now, this is only supported on x86, it may support other achitectures later.

guest-pid

  The process ID of the host thread that represents the guests threads. Each process ID that represents all of the guest vCPUs should be listed. Note, you can add more than just the threads that represent the guest vCPUs, as the tool will search the host-trace-file for kvm_exit and kvm_entry events to match these PIDs with the vCPUs that they represent.

## OPTIONS

-c cpus

  Specify a the number of CPUS the guest has.

-s timeshift

  A comma separated list of the format offset,scale,frac,timestamp These values map to what are given in /sys/kernel/kvm/<pid>/vcpu/*

      *offset*: Is the offset of the guest. "tsc-offest" in the directory. Note
                that the value listed here is the negative of what is listed in
                the directory.

      *scale*:  The scaling factor. "tsc-scaling-ratio"

      *frac*:   The fraction bits. "tsc-scaling-ratio-frac-bits"

      *timestamp*: The timestamp to start using the above. In some cases, the
                values may change over time. By adding a timestamp, it will
                take effect after the timestamp has been hit. Normally
                this would be zero.

      Currently, only one timeshift is given per CPU. One *-s* option should be
      given for each CPU. If there are less options than CPUs, then the last option
      given will be used for the rest of the CPUs. If only one option is given, then
      the values for that option will be used for all CPUs.

## EXAMPLES

Enable all events for tracing:

## SEE ALSO

trace-cmd(1), trace-cmd-report(1), trace-cmd-start(1), trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1), trace-cmd-split(1), trace-cmd-list(1), trace-cmd-listen(1), trace-cmd-profile(1)

## AUTHOR

Written by Steven Rostedt (Google) <rostedt@goodmis.org>

## RESOURCES

https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/

## COPYING

Copyright (C) 2010 Red Hat, Inc. Free use of this software is granted under the terms of the GNU Public License (GPL).