Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Description

OSStatTaskCPUUsageInit() determines the maximum value that a 32-bit counter can reach when no other task is executing. This function must be called when only one task is created in the application and when multitasking has started. This function must be called from the first and only task created by the application. Anchor10039351003935 Arguments Anchor10039361003936

Files

os.h/os_stat.c

Prototype

Code Block
void  OSStatTaskCPUUsageInit (OS_ERR  *p_err)

Arguments

p_err Anchor10039371003937

is a pointer to a variable used to hold an error code:

...

classWebWorks_Indent_1

...

OS_ERR_NONE

Counter maximum value obtained.

OS_ERR_OS_NOT_

...

classWebWorks_Indent_2

...

rowspan16

...

RUNNING

If OS_CFG_INVALID_OS_CALLS_CHK_EN is set to DEF_ENABLED in os_cfg.h: if µC/OS-III is not running yet.

Returned Value

None

Required Configuration

OS_CFG_TASK_STAT_EN must be enabled in os_cfg.h. Refer to µC-OS-III Configuration Manual.

Callers

Application.

Notes/Warnings

None

Example Usage

 == DEF_ENABLED
              OSStatTaskCPUUsageInit(&err); /* Compute CPU capacity with no task running
*/ #endif :
 */
          #endif
              :  
              OSTaskCreate(_);              /* Create the other tasks
*/
                    */
              OSTaskCreate(_);
: while

              :
              while (DEF_ON)
{ : : } }tr
 {
                  :
                  :
              }
          }
Code Block
titleOSStatTaskCPUUsageInit() usage example
          void FirstAndOnlyTask (void *p_arg)
          {
              OS_ERR  err;
              :
              :
          #if OS_CFG_TASK_STAT_EN
> 0
Anchor
10039511003951
Anchor
10039521003952
Anchor
10039531003953
Anchor
10039541003954
Anchor
10039551003955
Anchor
10039561003956
Anchor
10039571003957
Anchor
10039581003958
Anchor
10039591003959
Anchor
10039601003960
Anchor
10039611003961
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)