source: rtems/doc/new_chapters/cpuuse.t @ d82f3e81

4.104.114.84.95
Last change on this file since d82f3e81 was d82f3e81, checked in by Joel Sherrill <joel.sherrill@…>, on 11/19/98 at 16:05:05

New files

  • Property mode set to 100644
File size: 3.5 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@chapter CPU Usage Statistics
10
11@section Introduction
12
13The CPU usage statistics manager is an RTEMS support
14component that provides a convenient way to manipulate
15the CPU usage information associated with each task
16The routines provided by the CPU usage statistics manager are:
17
18@itemize @bullet
19@item @code{CPU_usage_Dump} - Report CPU Usage Statistics
20@item @code{CPU_usage_Reset} - Reset CPU Usage Statistics
21@end itemize
22
23@section Background
24
25@section Operations
26
27@section Report CPU Usage Statistics
28
29@subsection Reporting Period Statistics
30
31The application may dynamically report the CPU usage for every
32task in the system by calling the @code{CPU_usage_Dump} routine.
33This routine prints a table with the following information per task:
34
35@itemize @bullet
36@item task id
37@item task name
38@item number of clock ticks executed
39@item percentage of time consumed by this task
40@end itemize
41
42The following is an example of the report generated:
43
44@example
45@group
46CPU Usage by thread
47   ID        NAME        TICKS    PERCENT
480x04010001   IDLE           0     0.000
490x08010002   TA1         1203     0.748
500x08010003   TA2          203     0.126
510x08010004   TA3          202     0.126
52
53Ticks since last reset = 1600
54
55Total Units = 1608
56@end group
57@end example
58
59Notice that the "Total Units" is greater than the ticks per reset.
60This is an artifact of the way in which RTEMS keeps track of CPU
61usage.  When a task is context switched into the CPU, the number
62of clock ticks it has executed is incremented.  While the task
63is executing, this number is incremented on each clock tick. 
64Otherwise, if a task begins and completes execution between
65successive clock ticks, there would be no way to tell that it
66executed at all.
67
68Another thing to keep in mind when looking at idle time, is that
69many systems -- especially during debug -- have a task providing
70some type of debug interface.  It is usually fine to think of the
71total idle time as being the sum of the IDLE task and a debug
72task that will not be included in a production build of an application.
73
74@section Reset CPU Usage Statistics
75
76Invoking the @code{CPU_usage_Reset} routine resets the CPU usage
77statistics for all tasks in the system.
78
79@section Directives
80
81This section details the CPU usage statistics manager's directives.
82A subsection is dedicated to each of this manager's directives
83and describes the calling sequence, related constants, usage,
84and status codes.
85
86@page
87@subsection CPU_usage_Dump - Report CPU Usage Statistics
88
89@subheading CALLING SEQUENCE:
90
91@ifset is-C
92@example
93void CPU_usage_Dump( void );
94@end example
95@end ifset
96
97@ifset is-Ada
98@example
99An Ada interface is not currently available.
100@end example
101@end ifset
102
103@subheading STATUS CODES: NONE
104
105@subheading DESCRIPTION:
106
107This routine prints out a table detailing the CPU usage statistics for
108all tasks in the system.
109
110@subheading NOTES:
111
112NONE
113
114@page
115@subsection CPU_usage_Reset - Reset CPU Usage Statistics
116
117@subheading CALLING SEQUENCE:
118
119@ifset is-C
120@example
121void CPU_usage_Reset( void );
122@end example
123@end ifset
124
125@ifset is-Ada
126@example
127An Ada interface is not currently available.
128@end example
129@end ifset
130
131@subheading STATUS CODES: NONE
132
133@subheading DESCRIPTION:
134
135This routine re-initializes the CPU usage statistics for all tasks
136in the system to their initial state.  The initial state is that
137a task has not executed and thus has consumed no CPU time.
138default state which is when zero period executions have occurred.
139
140@subheading NOTES:
141
142NONE
Note: See TracBrowser for help on using the repository browser.