Getting CPU Load on a per task basis

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

In a real-time DSP/BIOS-based application, it is sometimes desirable to have an estimate of how the CPU load is spread among the various TSKs in the system. This article describes a utility module, THRLOAD, that can be used to obtain such an estimate. This module is provided with source code and can be downloaded as part of the RF modules from www-a.ti.com/downloads/sds_support/applications_packages/rf_modules/index.htm.


Contents

Introduction

THRLOAD has the ability to report execution time on a per task basis, along with the duration of the time period over which the data was collected. The user can then use the resulting numbers to compute the CPU load on a per task basis in their application.

THRLOAD usage requirements

The module

When using the module, the user needs to


Configuration

Configuration of the behavior of the module is done by statically assigning creating and assigning to a global variable called THRLOAD_CONFIG. Here are the specific fields:


Limitations

1. The per-task execution times are approximations!

The quality of the approximation depends on load of HWI and SWI and the frequency of TSK switches.

2. The THRLOAD_update function must be called often enough in order for the high-resolution timer not to wrap (this is because it internally uses CLK_gethtime() to obtain timestamps). Otherwise the numbers reported may be erroneous. For example, for a 32-bit high-resolution timer, the THRLOAD_update function must be called at least once for every 2^32 timer ticks.


Example usage at run-time

Included with the module are several examples illustrating different usage of the THRLOAD module. In particular, there is a 'top' example that reports shows how per-task load can be reported periodically. Here is a flowchart that summarizes what happens in this example:

THRLOAD Slide1.jpg

THRLOAD Slide2.jpg
THRLOAD Slide3.jpg


E2e.jpg For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Getting CPU Load on a per task basis here.
Hyperlink blue.png Links
ARM Microcontroller MCU ARM Processor Digital Media Processor Digital Signal Processing Microcontroller MCU Multi Core Processor
Ultra Low Power DSP 8 bit Microcontroller MCU 16 bit Microcontroller MCU 32 bit Microcontroller MCU

Leave a Comment
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox