RTPerfMonitor Sample
This sample monitors RTSS CPU usage by measuring the time spent in RTSS context on each processor. It tracks context switch timestamps and calculates CPU usage statistics such as minimum, maximum, and average usage times, as well as the frequency of context switches. Optionally, it displays a histogram of CPU usage latency distribution over the monitoring period. This tool helps analyze the real-time CPU load and responsiveness under RTSS.
The sample supports SMP (multiple RTSS CPUs) and adapts to the platform's processor count and clock timer period.
Source Files
| File | Description |
|---|---|
Monitor.c
|
The project source file used to monitor RTSS CPU usage. |
Building the Sample
Build the sample using an RTSS configuration: RTSSDebug or RTSSRelease.
Running the Sample
Run the sample using RtssRun. See Usage below.
Usage
RtssRun RtPerfMonitor.rtss [/?] [/h] seconds_to_monitor seconds_to_flush
/h
Displays a histogram with summary output.
/?
Shows help information.
seconds_to_monitor
The duration, in seconds, to monitor CPU usage (default: 15).
seconds_to_flush
The interval, in seconds, between output flushes (default: 5).
If no parameters are provided, the program runs as:
rtssrun rtperfmonitor.rtss /h 15 5
Expected Results
- Accurate periodic summaries of RTSS CPU usage per-processor, printed at the flush interval. Summaries include the following:
- Sample period
- Total RTSS usage time
- CPU usage rate percentage
- Context switch counts
- Min/avg/max CPU usage durations
- If histogram mode (/h) is enabled, a detailed latency histogram is printed showing distribution of CPU usage times in microseconds buckets.
- Initial program startup shows information on processor clock cycles per second.
Unexpected Results
The program cannot be run, which typically occurs when another Monitor instance is active.
APIs Referenced
|
RTAPI |
Windows-Supported |
|---|---|