Is it possible to analyze exactly how long a process takes to execute so that 'CPU Overload' can be avoided in xPC Target 4.0 (R2008b)?

1 view (last 30 days)
I am using the raw ethernet blocks in xPC Target. Since I must run the Ethernet Receive block slower than the Network Buffer Management block, I am processing larger chunks of data from ethernet buffers. Since processing of the ethernet packets isn't occurring at the base rate of the model, TET isn't an indicator of how much processing can be done before getting into overload conditions. Hence I want to know how to determine the number of packets that can be safely processed without risking overloading the CPU and to display how much time the process actually takes. Is there some standard way of doing this?
One way is to calculate the exact time using clock statements from time.h into the S-function used for the application. However, in this ethernet application editing the S-functions would be too complicated.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 2 Oct 2009
It is possible to obtain the exact timing using the Time Stamp Counter and Time Stamp Delta blocks of xPC Target 4.0 (R2008b). An example model is attached. The Time Stamp Counter block reads the CPU time stamp counter, which increments on the CPU frequency. In the example, to ensure that block 'Time Stamp Counter 1' executes before the Ethernet Rx block, we assign a very small number to its block priority (under Block Properties when right clicking on the block). Since the output of Ethernet receive is fed into the input port of block 'Time Stamp Counter 2', this runs after the Ethernet Rx block. The Time Stamp Delta block calculates the time duration between t1 and t2. 'Gain 2' is used to convert the time difference into seconds, because the output of Time Stamp Delta is in tick (1/frequency).

More Answers (0)

Categories

Find more on Multicore Processor Targets in Help Center and File Exchange

Products


Release

R2008b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!