GTPin
Public Member Functions
gtpin::GtProfileTrace Class Reference

Class that represents a trace - sequence of data records chronologically collected and stored in the profile buffer. More...

#include <gt_profile_trace.h>

Public Member Functions

 GtProfileTrace ()
 Default constructor.
 GtProfileTrace (uint32_t maxTraceSize, uint32_t maxRecordSize, uint32_t maxThreads=0x1000, uint32_t alignment=64)
 Constructor.
bool Allocate (IGtProfileBufferAllocator &allocator)
 Reserve space required to store the trace in the profile buffer.
uint32_t Size (const IGtProfileBuffer &profileBuffer) const
 Get Size of the trace collected in the profile buffer.
bool IsTruncated (const IGtProfileBuffer &profileBuffer) const
 Return true, if the trace collected in the specified profile buffer has been trimmed to avoid buffer overflow.
bool Read (const IGtProfileBuffer &profileBuffer, void *data, uint32_t offset, uint32_t size) const
 Read data from the trace located in the specified profile buffer.
bool Write (IGtProfileBuffer &profileBuffer, const void *data, uint32_t offset, uint32_t size) const
 Write data into the trace located in the specified profile buffer.
bool Initialize (IGtProfileBuffer &profileBuffer, bool zeroInitRecords=true) const
 Initialize the trace header in the specified profile buffer and, optionally, zero-initialize the memory area allocated for trace records.
void ComputeNewRecordOffset (const IGtGenCoder &coder, IGtGenProcedure &proc, uint32_t recordSize, const GtReg &offsetReg, uint32_t offsetInRecord=0) const
 Generate code that allocates space for the new record in the trace, and computes offset/address within the record.
void ComputeNewRecordAddress (const IGtGenCoder &coder, IGtGenProcedure &proc, uint32_t recordSize, const GtReg &addrReg, uint32_t offsetInRecord=0) const
uint32_t MaxTraceSize () const
 Return maximum size of the trace, in bytes.
uint32_t MaxRecordSize () const
 Return maximum size of the trace record, in bytes.
bool IsAllocated () const
 Return true if this trace has been allocated.

Detailed Description

Class that represents a trace - sequence of data records chronologically collected and stored in the profile buffer.

Availability:

Constructor & Destructor Documentation

gtpin::GtProfileTrace::GtProfileTrace ( uint32_t  maxTraceSize,
uint32_t  maxRecordSize,
uint32_t  maxThreads = 0x1000,
uint32_t  alignment = 64 
) [inline]

Constructor.

Parameters:
[in]maxTraceSizeMaximum size of the trace, in bytes
[in]maxRecordSizeMaximum size of the trace record, in bytes. The record size is variable, not exceeding maxRecordSize bytes
[in]maxThreadsMaximum number of threads concurrently accessing the trace
[in]alignmentAlignment of the trace in the profile buffer; must be power of two

Member Function Documentation

bool gtpin::GtProfileTrace::Allocate ( IGtProfileBufferAllocator allocator) [inline]

Reserve space required to store the trace in the profile buffer.

Parameters:
[in]allocatorAllocator to be used to reserve space
Returns:
true - success, false - failure
Precondition:
!IsAllocated()
void gtpin::GtProfileTrace::ComputeNewRecordAddress ( const IGtGenCoder coder,
IGtGenProcedure proc,
uint32_t  recordSize,
const GtReg addrReg,
uint32_t  offsetInRecord = 0 
) const [inline]

Generate code that allocates space for the new record in the trace, and computes offset/address within the record.

The offset is relative to the profile buffer base. If new record can not be allocated due to the trace capacity limitations, the generated procedure sets f0.0:uw bits on. Otherwise, these bit are cleared off.

Parameters:
[in]coderGEN code generator
[in]procProcedure, the generated code is appended to
[in]recordSizeSize of the new record, in bytes
[in]offsetRegRegister that receives the calculated offset within the profile buffer
[in]addrRegRegister that receives the calculated address
[in]offsetInRecordOffset within the record
Precondition:
IsAllocated() && (recordSize <= MaxRecordSize())
void gtpin::GtProfileTrace::ComputeNewRecordOffset ( const IGtGenCoder coder,
IGtGenProcedure proc,
uint32_t  recordSize,
const GtReg offsetReg,
uint32_t  offsetInRecord = 0 
) const [inline]

Generate code that allocates space for the new record in the trace, and computes offset/address within the record.

The offset is relative to the profile buffer base. If new record can not be allocated due to the trace capacity limitations, the generated procedure sets f0.0:uw bits on. Otherwise, these bit are cleared off.

Parameters:
[in]coderGEN code generator
[in]procProcedure, the generated code is appended to
[in]recordSizeSize of the new record, in bytes
[in]offsetRegRegister that receives the calculated offset within the profile buffer
[in]addrRegRegister that receives the calculated address
[in]offsetInRecordOffset within the record
Precondition:
IsAllocated() && (recordSize <= MaxRecordSize())
bool gtpin::GtProfileTrace::Initialize ( IGtProfileBuffer profileBuffer,
bool  zeroInitRecords = true 
) const [inline]

Initialize the trace header in the specified profile buffer and, optionally, zero-initialize the memory area allocated for trace records.

Parameters:
[in]profileBufferProfile buffer in which this trace is allocated
[in]zeroInitRecordstrue - zero-initialize the memory area allocated for trace records false - leave trace records uninitialized
Returns:
true - success, false - failure
Precondition:
IsAllocated()
bool gtpin::GtProfileTrace::Read ( const IGtProfileBuffer profileBuffer,
void *  data,
uint32_t  offset,
uint32_t  size 
) const [inline]

Read data from the trace located in the specified profile buffer.

Parameters:
[in]profileBufferProfile buffer in which this trace is allocated
[in]dataPointer to an array of bytes that receives data from the trace. There are should be at least 'size' bytes in this array
[in]offsetOffset within the trace of the first byte to read from
[in]sizeNumber of bytes to read from the trace into 'data' array
Returns:
true - success, false - failure
Precondition:
IsAllocated() && (offset + size <= MaxTraceSize())
uint32_t gtpin::GtProfileTrace::Size ( const IGtProfileBuffer profileBuffer) const [inline]

Get Size of the trace collected in the profile buffer.

Precondition:
IsAllocated()
Returns:
Actual size of the trace collected in the specified profile buffer
bool gtpin::GtProfileTrace::Write ( IGtProfileBuffer profileBuffer,
const void *  data,
uint32_t  offset,
uint32_t  size 
) const [inline]

Write data into the trace located in the specified profile buffer.

Parameters:
[in]profileBufferProfile buffer in which this trace is allocated
[in]dataPointer to an array of bytes that holds data to be written. There are should be at least 'size' bytes in this array
[in]offsetOffset within the trace of the first byte to write into
[in]sizeNumber of bytes to write from 'data' array into the trace
Returns:
true - success, false - failure
Precondition:
IsAllocated() && (offset + size <= MaxTraceSize())
 All Data Structures Functions Variables Typedefs Enumerations Enumerator


  Copyright (C) 2013-2025 Intel Corporation
SPDX-License-Identifier: MIT