trc_reg Subroutine

Purpose

Returns register values.

Library

libtrace.a

Syntax

#include <sys/libtrace.h>

int trc_reg(handle, regid, ret)
trc_log_handle_t handle;
int regid;
uint64_t *ret;

Description

The trc_reg subroutine is used to retrieve machine-programmable register values from either a processed or raw trace entry. It returns a -1 if the specified item was not traced.

trc_reg is only valid for a 64-bit kernel trace.

Parameters

Item Description
handle Contains the handle returned from a successful trc_open.
regid One of the following reserved register identifiers found in libtrace.h:
TRC_PURR_ID
The PURR register.
TRC_SPURR_ID
The SPURR register.
TRC_MCR0_ID, TRC_MCR1_ID, TRC_MCRA_ID
The MCR registers, 0, 1, and A.
TRC_PMCn_ID
PMC register n, where n is a value from 1 to 8
ret Points to an unsigned 64-bit integer to hold the return data. If the PURR is returned, it is returned in the same units as the elapsed time (that is, ticks for a raw trace and nanoseconds for a processed trace).

Return Values

The trc_reg subroutine returns 0 on success; otherwise, it returns the errno value.

Error Codes

Item Description
EINVAL The specified register ID is invalid.
TRCE_EOF The specified register ID is valid but was not traced.
Note: TRCE_EOF is the libtrace error for EOF or not found.

Related Information

The trace daemon and trcrptcommand.