![]() |
![]() |
Trace framework is a framework which binds producer and consumers via a contract memory (shared memory between producers and consumers)
In a multicore environment there would be data generated by a producer and would need to be consumed by multiple consumers. Example: UIA log information to be consumed by ARM and System Analyzer. The framework mentioned in this document is intended to provide a general framework for a system information source (producer) to provide data to multiple consumers in the system. This needs some kind of synchronization between consumers and producer providing the information data. The synchronization is done via the contract memory. Producer populates the Ring buffer and ring consumers consume the ring buffer and send the data to external actual consumers (like System Analyzer in CCS). Each core can have multiple consumer Instances and Producer Instances. Each Producer instance would be tied to a ring buffer and many consumer instances can consume data from a ring buffer. Every consumer needs to have its own channel to send the data out, which triggers the draining of the ring buffer
The ring producer produces the trace/log information in a ring buffer and notifies the consumers hooked to that ring when the ring buffers are ready. The producer fills up the information in the ring buffer sequentially, servicing the slowest possible consumer for that ring. So, a slowest consumer in the system can potentially make the fast consumers to drop messages. The producers and consumers handshake through a shared memory region called as “Contract Memory”.
The ring consumer reads the ring buffer from the producer and outputs it to the appropriate transport channel. The consumer updates the necessary control messages to the producer via the Contract.
Contract is a shared memory area between the producer and multiple consumers. Traceframework supports two contract versions.
The layout for the contract memory is as below. +-------+----------------------------------------------------------------------------------------------------------------+ | Line1 | Contract name (128 Bytes) | +-------+-----------------+--------------------+-------------------+-------------------+--------------+------------------+ | Line2 | Type (4 bytes) | Contract Version | Ring Buf Base | Num of Ring Bufs | Ring Buf Size| Padding | | | | (4 Bytes) | (4 bytes) | (4 Bytes) | (4 bytes) | (112Bytes) | +-------+-----------------+--------------------+-------------------+-------------------+--------------+------------------+ | Line3 | producer current| | | | index (4 bytes) | Padding (124 bytes) | +-------+-----------------+----------------------------------------------------------------------------------------------+ | Line4 | global last free| | | | index (4bytes) | Padding (124 bytes) | +-------+-----------------+----------------------------------------------------------------------------------------------+ | Line5 | Number of Consu | | | | -ers (4 bytes) | Padding (124 bytes) | +-------+-----------------+--------------------+-------------------+--------------------+--------------------------------+ | Line6 | Cons1MagicID | Cons1_last_free | Cons1_Notify Reg | Cons1 Notfy Method | Cons1 Local CallBk| Padding for| | | (4 bytes) | Buf Index (4 Bytes)| Mask (4 bytes) | (4 Bytes) | Function (4 Bytes)| 104 bytes | +-------+-----------------+--------------------+-------------------+--------------------+--------------------------------+ | Line7 | Cons2MagicID | Cons2_last_free | Cons2_Notify Reg | Cons2 Notfy Method | Cons2 Local CallBk| Padding for| | | (4 bytes) | Buf Index (4 Bytes)| Mask (4 bytes) | (4 Bytes) | Function (4 Bytes)| 104 bytes | +-------+-----------------+--------------------+-------------------+--------------------+--------------------------------+ | Line8 | Cons3MagicID | Cons3_last_free | Cons3_Notify Reg | Cons3 Notfy Method | Cons3 Local CallBk| Padding for| | | (4 bytes) | Buf Index (4 Bytes)| Mask (4 bytes) | (4 Bytes) | Function (4 Bytes)| 104 bytes | +-------+-----------------+--------------------+-------------------+--------------------+--------------------------------+ | Line9 | Cons4MagicID | Cons4_last_free | Cons4_Notify Reg | Cons4 Notfy Method | Cons4 Local CallBk| Padding for| | | (4 bytes) | Buf Index (4 Bytes)| Mask (4 bytes) | (4 Bytes) | Function (4 Bytes)| 104 bytes | +-------+-----------------+--------------------+-------------------+--------------------+--------------------------------+ | Line10| Out of Band data Information (128 Bytes) | +-------+----------------------------------------------------------------------------------------------------------------+ Contract Name Field Line 1 in the contract is reserved for the name of the contract. This filed is applicable only for Contract version 1. Few examples of the contract name are, 1. UIA_CONTRACT_CORE0, 2. UIA_CONTRACT_CORE1, 3. UIA_CONTRACT_CORE2, 4. UIA_CONTRACT_CORE3. Producer Information Fields Line 2 through line 9 information is used by the ring producer to fill up the ring buffers and to notify the attached consumers in the ring. The contract supports maximum of 4 consumers to be attached simultaneously to the ring. Consumer Information Fields Line 2 through to line 5 is used by every consumer to get the information about the current index in the ring buffer where the producer is filling up. Every consumer in the contract has its own dedicated Cache line information updated each time the ring buffer is consumed. The dedicated consumer information is read by other consumers on the contract which influences the producer’s head index to fill up the ring buffer. Limitations 1. The contract and ring buffers need to be aligned to cache boundary and to be placed under shared memory. 2. Producer ring needs to be created first before any consumers are instantiated for the ring. 3. Every Consumer instance needs to have dedicated unique transport channel. 4. Every producer for the ring needs to be notified for any new consumer in the contract.
Please follow the below steps to rebuild the libraries