Table of Contents
Performance Meter
Measures the amount of data travelling down a signal wire per second.
Library
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
qc_open_library('quarc_library/Advanced/Timing')Description
The Performance Meter block measures the amount of data that traverses a signal in the diagram every second. It can measure both the instantaneous data rate and an average data rate in units of bytes per second, elements per second or samples per second, where a "sample" constitutes the entire signal. For example, a signal carrying a three element vector of doubles every millisecond would have the following instantaneous data rates:
Quantity |
Value |
---|---|
Bytes per second |
3 * sizeof(double) / 0.001 = 24000 |
Elements per second |
3 / 0.001 = 3000 |
Samples per second |
1 / 0.001 = 1000 |
The Performance Meter block can account for being placed in a conditional subsystem, such as an Enabled Subsystem, Triggered Subsystem or Function-Call Subsystem. It can also be placed in an asynchronous thread. When the Performance Meter block is part of an asynchronous thread it measures time independently using a high resolution timebase. When it is not part of an asynchronous thread, which is the typical situation, then it uses the time from the model.
Input Ports
signal
The signal whose performance is being measured.
Output Ports
signal
A copy of the input signal. Having the signal "pass through" the block makes it possible to just drop the block on any signal wire and have Simulink automatically insert it into the wire.
bps
The number of bytes per second. This quantity is the number of elements per second multiplied by the size of each element in bytes. For bus objects, this output is affected by the Use packed size for bus objects parameter. Refer to that parameter for details. This port is only present if the Show bytes per second option is checked.
eps
The number of elements per second. This quantity is N times the number of samples per second, where N is the number of elements in the input vector. This port is only present if the Show elements per second option is checked.
sps
The number of samples per second, where a sample constitutes the entire input signal i.e. one sample is processed each time the block runs. This port is only present if the Show samples per second option is checked.
avg bps
The average number of bytes per second. This quantity is the number of elements per second multiplied by the size of each element in bytes. The average is computed over the entire run of the model and depends upon absolute time. For bus objects, this output is affected by the Use packed size for bus objects parameter. Refer to that parameter for details. This port is only present if the Show average bytes per second option is checked.
avg eps
The average number of elements per second. This quantity is N times the number of samples per second, where N is the number of elements in the input vector. The average is computed over the entire run of the model and depends upon absolute time. This port is only present if the Show average elements per second option is checked.
avg sps
The average number of samples per second, where a sample constitutes the entire input signal i.e. one sample is processed each time the block runs. The average is computed over the entire run of the model and depends upon absolute time. This port is only present if the Show average samples per second option is checked.
Data Type Support
This block supports all data types, including bus objects, complex signals and multidimensional signals.
Parameters and Dialog Box
Show bytes per second
Check this option to output the number of bytes per second at the bps port. If this parameter is unchecked then the number of bytes per second will not be output from the block.
Show elements per second
Check this option to output the number of elements per second at the eps port. If this parameter is unchecked then the number of elements per second will not be output from the block.
Show samples per second
Check this option to output the number of samples per second at the sps port. If this parameter is unchecked then the number of samples per second will not be output from the block.
Show average bytes per second
Check this option to output the average number of bytes per second at the avg bps port. If this parameter is unchecked then the average number of bytes per second will not be output from the block.
Show average elements per second
Check this option to output the average number of elements per second at the avg eps port. If this parameter is unchecked then the average number of elements per second will not be output from the block.
Show average samples per second
Check this option to output the average number of samples per second at the avg sps port. If this parameter is unchecked then the average number of samples per second will not be output from the block.
Use packed size for bus objects
Bus objects are similar to structures in C, and may actually produce structures in the generated code. The size of a structure depends on whether the structure is packed or not. For example, consider a bus object comprised of one 8-bit integer and three doubles. As a C structure it might look like:
struct bus_object { char x; /* this field is only one byte */ double y[3]; /* each double is eight bytes */ };
At first glance, one might assume that this structure occupies 1 + 3*8 = 25
bytes. However, the C compiler
will typically pad the structure with seven additional bytes in order to align the double vector on a 64-bit boundary
i.e. it will reserve 8 bytes for the character field 'x' instead of one byte. The reason it does so is for efficiency -
processors have much more efficient memory access if quantities are aligned on a natural boundary because unaligned accesses
generally require more than one memory access or sometimes even more than one instruction.
In this example, the structure actually occupies 8 + 3*8 = 32 bytes. Hence, the number of bytes per second will be 32 / 0.001 = 32000, not the expected 25000 bytes per second.
However, when bus objects are transmitted using the Quanser Stream blocks, these padding bytes are not transmitted. QUARC packs the structure to a byte boundary to reduce the bandwidth requirements on the communication channel. Hence, it is often useful to know the number of bytes per second of the bus object if all padding is removed i.e the structure members are "packed" to the nearest byte. Checking the Use packed size for bus objects option causes the Performance Meter block to use the packed size of bus objects rather than the normal unpacked size when computing the bytes per second or average bytes per second statistics.
Targets
Target Name |
Compatible* |
Model Referencing |
Comments |
---|---|---|---|
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
Last fully supported in QUARC 2018. |
|
Rapid Simulation (RSIM) Target |
Yes |
Yes |
|
S-Function Target |
No |
N/A |
Old technology. Use model referencing instead. |
Normal simulation |
Yes |
Yes |
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.