|
Packit |
b1f7ae |
% PT_QRY_TIME(3)
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
! Copyright (c) 2015-2017, Intel Corporation
|
|
Packit |
b1f7ae |
!
|
|
Packit |
b1f7ae |
! Redistribution and use in source and binary forms, with or without
|
|
Packit |
b1f7ae |
! modification, are permitted provided that the following conditions are met:
|
|
Packit |
b1f7ae |
!
|
|
Packit |
b1f7ae |
! * Redistributions of source code must retain the above copyright notice,
|
|
Packit |
b1f7ae |
! this list of conditions and the following disclaimer.
|
|
Packit |
b1f7ae |
! * Redistributions in binary form must reproduce the above copyright notice,
|
|
Packit |
b1f7ae |
! this list of conditions and the following disclaimer in the documentation
|
|
Packit |
b1f7ae |
! and/or other materials provided with the distribution.
|
|
Packit |
b1f7ae |
! * Neither the name of Intel Corporation nor the names of its contributors
|
|
Packit |
b1f7ae |
! may be used to endorse or promote products derived from this software
|
|
Packit |
b1f7ae |
! without specific prior written permission.
|
|
Packit |
b1f7ae |
!
|
|
Packit |
b1f7ae |
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit |
b1f7ae |
! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
b1f7ae |
! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
Packit |
b1f7ae |
! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
Packit |
b1f7ae |
! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
Packit |
b1f7ae |
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
Packit |
b1f7ae |
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
Packit |
b1f7ae |
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
Packit |
b1f7ae |
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
Packit |
b1f7ae |
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
Packit |
b1f7ae |
! POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
b1f7ae |
!-->
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# NAME
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
pt_qry_time, pt_qry_core_bus_ratio, pt_insn_time, pt_insn_core_bus_ratio,
|
|
Packit |
b1f7ae |
pt_blk_time, pt_blk_core_bus_ratio - query an Intel(R) Processor Trace decoder
|
|
Packit |
b1f7ae |
for timing information
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# SYNOPSIS
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
| **\#include `<intel-pt.h>`**
|
|
Packit |
b1f7ae |
|
|
|
Packit |
b1f7ae |
| **int pt_qry_time(struct pt_query_decoder \**decoder*, uint64_t \**time*,**
|
|
Packit |
b1f7ae |
| **uint32_t \**lost_mtc*, uint32_t \**lost_cyc*);**
|
|
Packit |
b1f7ae |
| **int pt_qry_core_bus_ratio(struct pt_query_decoder \**decoder*,**
|
|
Packit |
b1f7ae |
| **uint32_t \**cbr*);**
|
|
Packit |
b1f7ae |
|
|
|
Packit |
b1f7ae |
| **int pt_insn_time(struct pt_insn_decoder \**decoder*, uint64_t \**time*,**
|
|
Packit |
b1f7ae |
| **uint32_t \**lost_mtc*, uint32_t \**lost_cyc*);**
|
|
Packit |
b1f7ae |
| **int pt_insn_core_bus_ratio(struct pt_insn_decoder \**decoder*,**
|
|
Packit |
b1f7ae |
| **uint32_t \**cbr*);**
|
|
Packit |
b1f7ae |
|
|
|
Packit |
b1f7ae |
| **int pt_blk_time(struct pt_block_decoder \**decoder*, uint64_t \**time*,**
|
|
Packit |
b1f7ae |
| **uint32_t \**lost_mtc*, uint32_t \**lost_cyc*);**
|
|
Packit |
b1f7ae |
| **int pt_blk_core_bus_ratio(struct pt_block_decoder \**decoder*,**
|
|
Packit |
b1f7ae |
| **uint32_t \**cbr*);**
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
Link with *-lipt*.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# DESCRIPTION
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
**pt_qry_time**(), **pt_insn_time**(), and **pt_blk_time**() provide the current
|
|
Packit |
b1f7ae |
estimated timestamp count (TSC) value in the unsigned integer variable pointed
|
|
Packit |
b1f7ae |
to by the *time* argument. The returned value corresponds to what an **rdtsc**
|
|
Packit |
b1f7ae |
instruction would have returned.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
At configurable intervals, Intel PT contains the full, accurate TSC value.
|
|
Packit |
b1f7ae |
Between those intervals, the timestamp count is estimated using a collection of
|
|
Packit |
b1f7ae |
lower-bandwidth packets, the Mini Time Counter (MTC) packet and the Cycle Count
|
|
Packit |
b1f7ae |
Packet (CYC). Depending on the Intel PT configuration, timing can be very
|
|
Packit |
b1f7ae |
precise at the cost of increased bandwidth or less precise but requiring lower
|
|
Packit |
b1f7ae |
bandwidth.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
The decoder needs to be calibrated in order to translate Cycle Counter ticks
|
|
Packit |
b1f7ae |
into Core Crystal Clock ticks. Without calibration, CYC packets need to be
|
|
Packit |
b1f7ae |
dropped. The decoder calibrates itself using MTC, CYC, and CBR packets.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
To interpret MTC and CYC packets, the decoder needs additional information
|
|
Packit |
b1f7ae |
provided in respective fields in the *pt_config* structure. Lacking this
|
|
Packit |
b1f7ae |
information, MTC packets may need to be dropped. This will impact the precision
|
|
Packit |
b1f7ae |
of the estimated timestamp count by losing periodic updates and it will impact
|
|
Packit |
b1f7ae |
calibration, which may result in reduced precision for cycle-accurate timing.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
The number of dropped MTC and CYC packets gives a rough idea about the quality
|
|
Packit |
b1f7ae |
of the estimated timestamp count. The value of dropped MTC and CYC packets is
|
|
Packit |
b1f7ae |
given in the unsigned integer variables pointed to by the *lost_mtc* and
|
|
Packit |
b1f7ae |
*lost_cyc* arguments respectively. If one or both of the arguments is NULL, no
|
|
Packit |
b1f7ae |
information on lost packets is provided for the respective packet type.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
**pt_qry_core_bus_ratio**(), **pt_insn_core_bus_ratio**(), and
|
|
Packit |
b1f7ae |
**pt_blk_core_bus_ratio**() give the last known core:bus ratio as provided by
|
|
Packit |
b1f7ae |
the Core Bus Ratio (CBR) Intel PT packet.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# RETURN VALUE
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
All functions return zero on success or a negative *pt_error_code* enumeration
|
|
Packit |
b1f7ae |
constant in case of an error.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# ERRORS
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
pte_invalid
|
|
Packit |
b1f7ae |
: The *decoder* or *time* (**pt_qry_time**(), **pt_insn_time**(), and
|
|
Packit |
b1f7ae |
**pt_blk_time**()) or *cbr* (**pt_qry_core_bus_ratio**(),
|
|
Packit |
b1f7ae |
**pt_insn_core_bus_ratio**(), and **pt_blk_core_bus_ratio**()) argument is
|
|
Packit |
b1f7ae |
NULL.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
pte_no_time
|
|
Packit |
b1f7ae |
: There has not been a TSC packet to provide the full, accurate Time Stamp
|
|
Packit |
b1f7ae |
Count. There may have been MTC or CYC packets, so the provided *time* may
|
|
Packit |
b1f7ae |
be non-zero. It is zero if there has not been any timing packet yet.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
Depending on the Intel PT configuration, TSC packets may not have been
|
|
Packit |
b1f7ae |
enabled. In this case, the *time* value provides the relative time based on
|
|
Packit |
b1f7ae |
other timing packets.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
pte_no_cbr
|
|
Packit |
b1f7ae |
: There has not been a CBR packet to provide the core:bus ratio. The *cbr*
|
|
Packit |
b1f7ae |
value is undefined in this case.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# NOTES
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
All decoders read ahead. The estimated timestamp count and core:bus ratios
|
|
Packit |
b1f7ae |
correspond to their current decode position, which may be ahead of the trace
|
|
Packit |
b1f7ae |
position that matches the last event, instruction, or block.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
The query decoder also provides an estimated timestamp count in the *pt_event*
|
|
Packit |
b1f7ae |
structure.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# SEE ALSO
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
**pt_qry_alloc_decoder**(3), **pt_qry_free_decoder**(3),
|
|
Packit |
b1f7ae |
**pt_qry_cond_branch**(3), **pt_qry_indirect_branch**(3), **pt_qry_event**(3),
|
|
Packit |
b1f7ae |
**pt_insn_alloc_decoder**(3), **pt_insn_free_decoder**(3), **pt_insn_next**(3),
|
|
Packit |
b1f7ae |
**pt_blk_alloc_decoder**(3), **pt_blk_free_decoder**(3), **pt_blk_next**(3)
|