Percepio Trace Recorder v4.8.0.hotfix1
Loading...
Searching...
No Matches
objectHandleStackType Struct Reference

Object handle stack struct. More...

#include <trcRecorder.h>

Data Fields

uint16_t indexOfNextAvailableHandle [TRACE_NCLASSES]
 
uint16_t lowestIndexOfClass [TRACE_NCLASSES]
 
uint16_t highestIndexOfClass [TRACE_NCLASSES]
 
uint16_t handleCountWaterMarksOfClass [TRACE_NCLASSES]
 
traceHandle objectHandles [TRACE_KERNEL_OBJECT_COUNT]
 

Detailed Description

Object handle stack struct.

This data-structure is used to provide a mechanism for 1-byte trace object handles. This way, only 1 byte is necessary instead of 4 bytes (a pointer) when storing a reference to an object. This allows for up to 255 objects of each object class active at any given moment. There can be more "historic" objects, that have been deleted - that number is only limited by the size of the symbol table.

Note that handle zero (0) is not used, it is a code for an invalid handle.

This data structure keeps track of the FREE handles, not the handles in use. This data structure contains one stack per object class. When a handle is allocated to an object, the next free handle is popped from the stack. When a handle is released (on object delete), it is pushed back on the stack. Note that there is no initialization code that pushed the free handles initially, that is not necessary due to the following optimization:

The stack of handles (objectHandles) is initially all zeros. Since zero is not a valid handle, that is a signal of additional handles needed. If a zero is received when popping a new handle, it is replaced by the index of the popped handle instead.

Field Documentation

◆ handleCountWaterMarksOfClass

uint16_t objectHandleStackType::handleCountWaterMarksOfClass[TRACE_NCLASSES]

The highest use count for this class (for statistics)

◆ highestIndexOfClass

uint16_t objectHandleStackType::highestIndexOfClass[TRACE_NCLASSES]

The highest index of this class (constant)

◆ indexOfNextAvailableHandle

uint16_t objectHandleStackType::indexOfNextAvailableHandle[TRACE_NCLASSES]

For each object class, the index of the next handle to allocate

◆ lowestIndexOfClass

uint16_t objectHandleStackType::lowestIndexOfClass[TRACE_NCLASSES]

The lowest index of this class (constant)

◆ objectHandles

traceHandle objectHandleStackType::objectHandles[TRACE_KERNEL_OBJECT_COUNT]

The free object handles - a set of stacks within this array


The documentation for this struct was generated from the following file: