1 | @c |
---|
2 | @c COPYRIGHT (c) 2011. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | @c $Id:$ |
---|
7 | @c |
---|
8 | |
---|
9 | @chapter Constant Bandwidth Server Scheduler API |
---|
10 | |
---|
11 | @cindex cbs |
---|
12 | |
---|
13 | @section Introduction |
---|
14 | |
---|
15 | Unlike simple schedulers, the Constant Bandwidth Server (CBS) requires |
---|
16 | a special API for tasks to indicate their scheduling parameters. |
---|
17 | The directives provided by the CBS API are: |
---|
18 | |
---|
19 | @itemize @bullet |
---|
20 | @item @code{@value{DIRPREFIX}cbs_initialize} - Initialize the CBS library |
---|
21 | @item @code{@value{DIRPREFIX}cbs_cleanup} - Cleanup the CBS library |
---|
22 | @item @code{@value{DIRPREFIX}cbs_create_server} - Create a new bandwidth server |
---|
23 | @item @code{@value{DIRPREFIX}cbs_attach_thread} - Attach a thread to server |
---|
24 | @item @code{@value{DIRPREFIX}cbs_detach_thread} - Detach a thread from server |
---|
25 | @item @code{@value{DIRPREFIX}cbs_destroy_server} - Destroy a bandwidth server |
---|
26 | @item @code{@value{DIRPREFIX}cbs_get_server_id} - Get an ID of a server |
---|
27 | @item @code{@value{DIRPREFIX}cbs_get_parameters} - Get scheduling parameters of a server |
---|
28 | @item @code{@value{DIRPREFIX}cbs_set_parameters} - Set scheduling parameters of a server |
---|
29 | @item @code{@value{DIRPREFIX}cbs_get_execution_time} - Get elapsed execution time |
---|
30 | @item @code{@value{DIRPREFIX}cbs_get_remaining_budget} - Get remainig execution time |
---|
31 | @item @code{@value{DIRPREFIX}cbs_get_approved_budget} - Get scheduler approved execution time |
---|
32 | @end itemize |
---|
33 | |
---|
34 | @section Background |
---|
35 | |
---|
36 | @subsection Constant Bandwidth Server Definitions |
---|
37 | |
---|
38 | @cindex CBS parameters |
---|
39 | |
---|
40 | @findex rtems_cbs_parameters |
---|
41 | |
---|
42 | The Constant Bandwidth Server API enables tasks to communicate with |
---|
43 | the scheduler and indicate its scheduling parameters. The scheduler |
---|
44 | has to be set up first (by defining @code{CONFIGURE_SCHEDULER_CBS} macro). |
---|
45 | |
---|
46 | The difference to a plain EDF is the presence of servers. |
---|
47 | It is a budget aware extention of the EDF scheduler, therefore, tasks |
---|
48 | attached to servers behave in a similar way as with EDF unless they |
---|
49 | exceed their budget. |
---|
50 | |
---|
51 | The intention of servers is reservation of a certain computation |
---|
52 | time (budget) of the processor for all subsequent periods. The structure |
---|
53 | @code{rtems_cbs_parameters} determines the behavior of |
---|
54 | a server. It contains @code{deadline} which is equal to period, |
---|
55 | and @code{budget} which is the time the server is allowed to |
---|
56 | spend on CPU per each period. The ratio between those two parameters |
---|
57 | yields the maximum percentage of the CPU the server can use |
---|
58 | (bandwidth). Moreover, thanks to this limitation the overall |
---|
59 | utilization of CPU is under control, and the sum of bandwidths |
---|
60 | of all servers in the system yields the overall reserved portion |
---|
61 | of processor. The rest is still available for ordinary tasks that |
---|
62 | are not attached to any server. |
---|
63 | |
---|
64 | In order to make the server effective to the executing tasks, |
---|
65 | tasks have to be attached to the servers. The |
---|
66 | @code{rtems_cbs_server_id} is a type denoting an id of a server |
---|
67 | and @code{rtems_id} a type for id of tasks. |
---|
68 | |
---|
69 | @subsection Handling Periodic Tasks |
---|
70 | |
---|
71 | @cindex CBS periodic tasks |
---|
72 | |
---|
73 | Each task's execution begins with a default background priority |
---|
74 | (see the chapter Scheduling Concepts to understand the concept of |
---|
75 | priorities in EDF). Once you decide the tasks should start periodic |
---|
76 | execution, you have two possibilities. Either you use only the Rate |
---|
77 | Monotonic manager which takes care of periodic behavior, or you declare |
---|
78 | deadline and budget using the CBS API in which case these properties |
---|
79 | are constant for all subsequent periods, unless you change them using |
---|
80 | the CBS API again. Task now only has to indicate and end of |
---|
81 | each period using @code{rtems_rate_monotonic_period}. |
---|
82 | |
---|
83 | @subsection Registering a Callback Function |
---|
84 | |
---|
85 | @cindex CBS overrun handler |
---|
86 | |
---|
87 | In case tasks attached to servers are not aware of their execution time |
---|
88 | and happen to exceed it, the scheduler does not guarantee execution any |
---|
89 | more and pulls the priority of the task to background, which would |
---|
90 | possibly lead to immediate preemption (if there is at least one ready |
---|
91 | task with a higher pirority). However, the task is not blocked but a |
---|
92 | callback function is invoked. The callback function |
---|
93 | (@code{rtems_cbs_budget_overrun}) might be optionally registered upon |
---|
94 | a server creation (@code{rtems_cbs_create_server}). |
---|
95 | |
---|
96 | This enables the user to define what should happen in case of budget |
---|
97 | overrun. There is obviously no space for huge operations because the |
---|
98 | priority is down and not real time any more, however, you still can at |
---|
99 | least in release resources for other tasks, restart the task or log an |
---|
100 | error information. Since the routine is called directly from kernel, |
---|
101 | use @code{printk()} instead of @code{printf()}. |
---|
102 | |
---|
103 | The calling convention of the callback function is: |
---|
104 | @ifset is-C |
---|
105 | @findex rtems_asr |
---|
106 | @example |
---|
107 | void overrun_handler( |
---|
108 | rtems_cbs_server_id server_id |
---|
109 | ); |
---|
110 | @end example |
---|
111 | @end ifset |
---|
112 | |
---|
113 | @subsection Limitations |
---|
114 | |
---|
115 | @cindex CBS limitations |
---|
116 | |
---|
117 | When using this scheduler you have to keep in mind several things: |
---|
118 | |
---|
119 | @itemize @bullet |
---|
120 | @c it_limitations |
---|
121 | @item In the current implementation it is possible to attach only |
---|
122 | a single task to each server. |
---|
123 | @item If you have a task attached to a server and you voluntatily |
---|
124 | block it in the beginning of its execution, its priority will be |
---|
125 | probably pulled to background upon unblock, thus not guaranteed |
---|
126 | deadline any more. This is because you are effectively raising |
---|
127 | computation time of the task. When unbocking, you should be always |
---|
128 | sure that the ratio between remaining computation time and remaining |
---|
129 | deadline is not higher that the utilization you have agreed with the |
---|
130 | scheduler. |
---|
131 | @end itemize |
---|
132 | |
---|
133 | @section Operations |
---|
134 | |
---|
135 | @subsection Setting up a server |
---|
136 | |
---|
137 | The directive @code{rtems_cbs_create_server} is used to create a new |
---|
138 | server that is characterized by @code{rtems_cbs_parameters}. You also |
---|
139 | might want to register the @code{rtems_cbs_budget_overrun} callback |
---|
140 | routine. After this step tasks can be attached to the server. The directive |
---|
141 | @code{rtems_cbs_set_parameters} can change the scheduling parameters |
---|
142 | to avoid destroying and creating a new server again. |
---|
143 | |
---|
144 | @subsection Attaching Task to a Server |
---|
145 | |
---|
146 | If a task is attached to a server using @code{rtems_cbs_attach_thread}, |
---|
147 | the task's computation time per period is limited by the server and |
---|
148 | the deadline (period) of task is equal to deadline of the server which |
---|
149 | means if you conclude a period using @code{rate_monotonic_period}, |
---|
150 | the length of next period is always determined by the server's property. |
---|
151 | |
---|
152 | The task has a guaranteed bandwidth given by the server but should not |
---|
153 | exceed it, otherwise the priority is pulled to background until the |
---|
154 | start of next period and the @code{rtems_cbs_budget_overrun} callback |
---|
155 | function is invoked. |
---|
156 | |
---|
157 | When attaching a task to server, the preemptability flag of the task |
---|
158 | is raised, otherwise it would not be possible to control the execution |
---|
159 | of the task. |
---|
160 | |
---|
161 | @subsection Detaching Task from a Server |
---|
162 | |
---|
163 | The directive @code{rtems_cbs_detach_thread} is just an inverse |
---|
164 | operation to the previous one, the task continues its execution with |
---|
165 | the initial priority. |
---|
166 | |
---|
167 | Preemptability of the task is restored to the initial value. |
---|
168 | |
---|
169 | @subsection Examples |
---|
170 | |
---|
171 | The following example presents a simple common use of the API. |
---|
172 | |
---|
173 | You can see the initialization and cleanup call here, if there are |
---|
174 | multiple tasks in the system, it is obvious that the initialization |
---|
175 | should be called before creating the task. |
---|
176 | |
---|
177 | Notice also that in this case we decided to register an overrun handler, |
---|
178 | instead of which there could be @code{NULL}. This handler just prints |
---|
179 | a message to terminal, what else may be done here depends on a specific |
---|
180 | application. |
---|
181 | |
---|
182 | During the periodic execution, remaining budget should be watched |
---|
183 | to avoid overrun. |
---|
184 | |
---|
185 | @example |
---|
186 | void overrun_handler ( |
---|
187 | rtems_cbs_server_id server_id |
---|
188 | ) |
---|
189 | @{ |
---|
190 | printk( "Budget overrun, fixing the task\n" ); |
---|
191 | return; |
---|
192 | @} |
---|
193 | |
---|
194 | rtems_task Tasks_Periodic( |
---|
195 | rtems_task_argument argument |
---|
196 | ) |
---|
197 | @{ |
---|
198 | rtems_id rmid; |
---|
199 | |
---|
200 | rtems_cbs_server_id server_id; |
---|
201 | rtems_cbs_parameters params; |
---|
202 | |
---|
203 | params.deadline = 10; |
---|
204 | params.budget = 4; |
---|
205 | |
---|
206 | rtems_cbs_initialize(); |
---|
207 | |
---|
208 | rtems_cbs_create_server( ¶ms, &overrun_handler, &server_id ) |
---|
209 | |
---|
210 | rtems_cbs_attach_thread( server_id, SELF ); |
---|
211 | |
---|
212 | rtems_rate_monotonic_create( argument, &rmid ); |
---|
213 | |
---|
214 | while ( 1 ) @{ |
---|
215 | if (rtems_rate_monotonic_period(rmid, params.deadline)==RTEMS_TIMEOUT) |
---|
216 | break; |
---|
217 | |
---|
218 | /* Perform some periodic action */ |
---|
219 | @} |
---|
220 | |
---|
221 | rtems_rate_monotonic_delete( rmid ); |
---|
222 | |
---|
223 | rtems_cbs_cleanup(); |
---|
224 | exit( 1 ); |
---|
225 | @} |
---|
226 | @end example |
---|
227 | |
---|
228 | @section Directives |
---|
229 | |
---|
230 | This section details the Constant Bandwidth Server's directives. |
---|
231 | A subsection is dedicated to each of this manager's directives |
---|
232 | and describes the calling sequence, related constants, usage, |
---|
233 | and status codes. |
---|
234 | |
---|
235 | @c |
---|
236 | @c |
---|
237 | @c |
---|
238 | @page |
---|
239 | @subsection CBS_INITIALIZE - Initialize the CBS library |
---|
240 | |
---|
241 | @cindex initialize the CBS library |
---|
242 | |
---|
243 | @subheading CALLING SEQUENCE: |
---|
244 | |
---|
245 | @ifset is-C |
---|
246 | @findex rtems_cbs_initialize |
---|
247 | @example |
---|
248 | int rtems_cbs_initialize( void ); |
---|
249 | @end example |
---|
250 | @end ifset |
---|
251 | |
---|
252 | @subheading DIRECTIVE STATUS CODES: |
---|
253 | @code{@value{RPREFIX}CBS_OK} - successful initialization@* |
---|
254 | @code{@value{RPREFIX}CBS_ERROR_NO_MEMORY} - not enough memory for data@* |
---|
255 | |
---|
256 | @subheading DESCRIPTION: |
---|
257 | |
---|
258 | This routine initializes the library in terms of allocating necessary memory |
---|
259 | for the servers. In case not enough memory is available in the system, |
---|
260 | @code{@value{RPREFIX}CBS_ERROR_NO_MEMORY} is returned, otherwise |
---|
261 | @code{@value{RPREFIX}CBS_OK}. |
---|
262 | |
---|
263 | @subheading NOTES: |
---|
264 | |
---|
265 | Additional memory per each server is allocated upon invocation of |
---|
266 | @code{rtems_cbs_create_server}. |
---|
267 | |
---|
268 | Tasks in the system are not influenced, they still keep executing |
---|
269 | with their initial parameters. |
---|
270 | |
---|
271 | @c |
---|
272 | @c |
---|
273 | @c |
---|
274 | @page |
---|
275 | @subsection CBS_CLEANUP - Cleanup the CBS library |
---|
276 | |
---|
277 | @cindex cleanup the CBS library |
---|
278 | |
---|
279 | @subheading CALLING SEQUENCE: |
---|
280 | |
---|
281 | @ifset is-C |
---|
282 | @findex rtems_cbs_cleanup |
---|
283 | @example |
---|
284 | int rtems_cbs_cleanup( void ); |
---|
285 | @end example |
---|
286 | @end ifset |
---|
287 | |
---|
288 | @subheading DIRECTIVE STATUS CODES: |
---|
289 | @code{@value{RPREFIX}CBS_OK} - always successful |
---|
290 | |
---|
291 | @subheading DESCRIPTION: |
---|
292 | |
---|
293 | This routine detaches all tasks from their servers, destroys all servers |
---|
294 | and returns memory back to the system. |
---|
295 | |
---|
296 | @subheading NOTES: |
---|
297 | |
---|
298 | All tasks continue executing with their initial priorities. |
---|
299 | |
---|
300 | @c |
---|
301 | @c |
---|
302 | @c |
---|
303 | @page |
---|
304 | @subsection CBS_CREATE_SERVER - Create a new bandwidth server |
---|
305 | |
---|
306 | @cindex create a new bandwidth server |
---|
307 | |
---|
308 | @subheading CALLING SEQUENCE: |
---|
309 | |
---|
310 | @ifset is-C |
---|
311 | @findex rtems_cbs_create_server |
---|
312 | @example |
---|
313 | int rtems_cbs_create_server ( |
---|
314 | rtems_cbs_parameters *params, |
---|
315 | rtems_cbs_budget_overrun budget_overrun_callback, |
---|
316 | rtems_cbs_server_id *server_id |
---|
317 | ); |
---|
318 | @end example |
---|
319 | @end ifset |
---|
320 | |
---|
321 | @subheading DIRECTIVE STATUS CODES: |
---|
322 | @code{@value{RPREFIX}CBS_OK} - successfully created@* |
---|
323 | @code{@value{RPREFIX}CBS_ERROR_NO_MEMORY} - not enough memory for data@* |
---|
324 | @code{@value{RPREFIX}CBS_ERROR_FULL} - maximum servers exceeded@* |
---|
325 | @code{@value{RPREFIX}CBS_ERROR_INVALID_PARAMETER} - invalid input argument@* |
---|
326 | |
---|
327 | @subheading DESCRIPTION: |
---|
328 | |
---|
329 | This routine prepares an instance of a constant bandwidth server. |
---|
330 | The input parameter @code{rtems_cbs_parameters} specifies scheduling |
---|
331 | parameters of the server (period and budget). If these are not valid, |
---|
332 | @code{@value{RPREFIX}CBS_ERROR_INVALID_PARAMETER} is returned. |
---|
333 | The @code{budget_overrun_callback} is an optional callback function, which is |
---|
334 | invoked in case the server's budget within one period is exceeded. |
---|
335 | Output parameter @code{server_id} becomes an id of the newly created server. |
---|
336 | If there is not enough memory, the @code{@value{RPREFIX}CBS_ERROR_NO_MEMORY} |
---|
337 | is returned. If the maximum server count in the system is exceeded, |
---|
338 | @code{@value{RPREFIX}CBS_ERROR_FULL} is returned. |
---|
339 | |
---|
340 | @subheading NOTES: |
---|
341 | |
---|
342 | No task execution is being influenced so far. |
---|
343 | |
---|
344 | @c |
---|
345 | @c |
---|
346 | @c |
---|
347 | @page |
---|
348 | @subsection CBS_ATTACH_THREAD - Attach a thread to server |
---|
349 | |
---|
350 | @cindex attach a thread to server |
---|
351 | |
---|
352 | @subheading CALLING SEQUENCE: |
---|
353 | |
---|
354 | @ifset is-C |
---|
355 | @findex rtems_cbs_attach_thread |
---|
356 | @example |
---|
357 | int rtems_cbs_attach_thread ( |
---|
358 | rtems_cbs_server_id server_id, |
---|
359 | rtems_id task_id |
---|
360 | ); |
---|
361 | @end example |
---|
362 | @end ifset |
---|
363 | |
---|
364 | @subheading DIRECTIVE STATUS CODES: |
---|
365 | @code{@value{RPREFIX}CBS_OK} - successfully attached@* |
---|
366 | @code{@value{RPREFIX}CBS_ERROR_FULL} - server maximum tasks exceeded@* |
---|
367 | @code{@value{RPREFIX}CBS_ERROR_INVALID_PARAMETER} - invalid input argument@* |
---|
368 | @code{@value{RPREFIX}CBS_ERROR_NOSERVER} - server is not valid@* |
---|
369 | |
---|
370 | @subheading DESCRIPTION: |
---|
371 | |
---|
372 | Attaches a task (@code{task_id}) to a server (@code{server_id}). |
---|
373 | The server has to be previously created. Now, the task starts |
---|
374 | to be scheduled according to the server parameters and not |
---|
375 | using initial priority. This implementation allows only one task |
---|
376 | per server, if the user tries to bind another task to the same |
---|
377 | server, @code{@value{RPREFIX}CBS_ERROR_FULL} is returned. |
---|
378 | |
---|
379 | @subheading NOTES: |
---|
380 | |
---|
381 | Tasks attached to servers become preemptible. |
---|
382 | |
---|
383 | @c |
---|
384 | @c |
---|
385 | @c |
---|
386 | @page |
---|
387 | @subsection CBS_DETACH_THREAD - Detach a thread from server |
---|
388 | |
---|
389 | @cindex detach a thread from server |
---|
390 | |
---|
391 | @subheading CALLING SEQUENCE: |
---|
392 | |
---|
393 | @ifset is-C |
---|
394 | @findex rtems_cbs_detach_thread |
---|
395 | @example |
---|
396 | int rtems_cbs_detach_thread ( |
---|
397 | rtems_cbs_server_id server_id, |
---|
398 | rtems_id task_id |
---|
399 | ); |
---|
400 | @end example |
---|
401 | @end ifset |
---|
402 | |
---|
403 | @subheading DIRECTIVE STATUS CODES: |
---|
404 | @code{@value{RPREFIX}CBS_OK} - successfully detached@* |
---|
405 | @code{@value{RPREFIX}CBS_ERROR_INVALID_PARAMETER} - invalid input argument@* |
---|
406 | @code{@value{RPREFIX}CBS_ERROR_NOSERVER} - server is not valid@* |
---|
407 | |
---|
408 | @subheading DESCRIPTION: |
---|
409 | |
---|
410 | This directive detaches a thread from server. The task continues its |
---|
411 | execution with initial priority. |
---|
412 | |
---|
413 | @subheading NOTES: |
---|
414 | |
---|
415 | The server can be reused for any other task. |
---|
416 | |
---|
417 | @c |
---|
418 | @c |
---|
419 | @c |
---|
420 | @page |
---|
421 | @subsection CBS_DESTROY_SERVER - Destroy a bandwidth server |
---|
422 | |
---|
423 | @cindex destroy a bandwidth server |
---|
424 | |
---|
425 | @subheading CALLING SEQUENCE: |
---|
426 | |
---|
427 | @ifset is-C |
---|
428 | @findex rtems_cbs_destroy_server |
---|
429 | @example |
---|
430 | int rtems_cbs_destroy_server ( |
---|
431 | rtems_cbs_server_id server_id |
---|
432 | ); |
---|
433 | @end example |
---|
434 | @end ifset |
---|
435 | |
---|
436 | @subheading DIRECTIVE STATUS CODES: |
---|
437 | @code{@value{RPREFIX}CBS_OK} - successfully destroyed@* |
---|
438 | @code{@value{RPREFIX}CBS_ERROR_INVALID_PARAMETER} - invalid input argument@* |
---|
439 | @code{@value{RPREFIX}CBS_ERROR_NOSERVER} - server is not valid@* |
---|
440 | |
---|
441 | @subheading DESCRIPTION: |
---|
442 | |
---|
443 | This directive destroys a server. If any task was attached to the server, |
---|
444 | the task is detached and continues its execution according to EDF rules |
---|
445 | with initial properties. |
---|
446 | |
---|
447 | @subheading NOTES: |
---|
448 | |
---|
449 | This again enables one more task to be created. |
---|
450 | |
---|
451 | @c |
---|
452 | @c |
---|
453 | @c |
---|
454 | @page |
---|
455 | @subsection CBS_GET_SERVER_ID - Get an ID of a server |
---|
456 | |
---|
457 | @cindex get an ID of a server |
---|
458 | |
---|
459 | @subheading CALLING SEQUENCE: |
---|
460 | |
---|
461 | @ifset is-C |
---|
462 | @findex rtems_cbs_get_server_id |
---|
463 | @example |
---|
464 | int rtems_cbs_get_server_id ( |
---|
465 | rtems_id task_id, |
---|
466 | rtems_cbs_server_id *server_id |
---|
467 | ); |
---|
468 | @end example |
---|
469 | @end ifset |
---|
470 | |
---|
471 | @subheading DIRECTIVE STATUS CODES: |
---|
472 | @code{@value{RPREFIX}CBS_OK} - successful@* |
---|
473 | @code{@value{RPREFIX}CBS_ERROR_NOSERVER} - server is not valid@* |
---|
474 | |
---|
475 | @subheading DESCRIPTION: |
---|
476 | |
---|
477 | This directive returns an id of server belonging to a given task. |
---|
478 | |
---|
479 | @c |
---|
480 | @c |
---|
481 | @c |
---|
482 | @page |
---|
483 | @subsection CBS_GET_PARAMETERS - Get scheduling parameters of a server |
---|
484 | |
---|
485 | @cindex get scheduling parameters of a server |
---|
486 | |
---|
487 | @subheading CALLING SEQUENCE: |
---|
488 | |
---|
489 | @ifset is-C |
---|
490 | @findex rtems_cbs_get_parameters |
---|
491 | @example |
---|
492 | rtems_cbs_get_parameters ( |
---|
493 | rtems_cbs_server_id server_id, |
---|
494 | rtems_cbs_parameters *params |
---|
495 | ); |
---|
496 | @end example |
---|
497 | @end ifset |
---|
498 | |
---|
499 | @subheading DIRECTIVE STATUS CODES: |
---|
500 | @code{@value{RPREFIX}CBS_OK} - successful@* |
---|
501 | @code{@value{RPREFIX}CBS_ERROR_INVALID_PARAMETER} - invalid input argument@* |
---|
502 | @code{@value{RPREFIX}CBS_ERROR_NOSERVER} - server is not valid@* |
---|
503 | |
---|
504 | @subheading DESCRIPTION: |
---|
505 | |
---|
506 | This directive returns a structure with current scheduling parameters |
---|
507 | of a given server (period and execution time). |
---|
508 | |
---|
509 | @subheading NOTES: |
---|
510 | |
---|
511 | It makes no difference if any task is assigned or not. |
---|
512 | |
---|
513 | @c |
---|
514 | @c |
---|
515 | @c |
---|
516 | @page |
---|
517 | @subsection CBS_SET_PARAMETERS - Set scheduling parameters |
---|
518 | |
---|
519 | @cindex set scheduling parameters |
---|
520 | |
---|
521 | @subheading CALLING SEQUENCE: |
---|
522 | |
---|
523 | @ifset is-C |
---|
524 | @findex rtems_cbs_set_parameters |
---|
525 | @example |
---|
526 | int rtems_cbs_set_parameters ( |
---|
527 | rtems_cbs_server_id server_id, |
---|
528 | rtems_cbs_parameters *params |
---|
529 | ); |
---|
530 | @end example |
---|
531 | @end ifset |
---|
532 | |
---|
533 | @subheading DIRECTIVE STATUS CODES: |
---|
534 | @code{@value{RPREFIX}CBS_OK} - successful@* |
---|
535 | @code{@value{RPREFIX}CBS_ERROR_INVALID_PARAMETER} - invalid input argument@* |
---|
536 | @code{@value{RPREFIX}CBS_ERROR_NOSERVER} - server is not valid@* |
---|
537 | |
---|
538 | @subheading DESCRIPTION: |
---|
539 | |
---|
540 | This directive sets new scheduling parameters to the server. This operation |
---|
541 | can be performed regardless of whether a task is assigned or not. |
---|
542 | If a task is assigned, the parameters become effective imediately, therefore it |
---|
543 | is recommended to apply the change between two subsequent periods. |
---|
544 | |
---|
545 | @subheading NOTES: |
---|
546 | |
---|
547 | There is an upper limit on both period and budget equal to (2^31)-1 ticks. |
---|
548 | |
---|
549 | @c |
---|
550 | @c |
---|
551 | @c |
---|
552 | @page |
---|
553 | @subsection CBS_GET_EXECUTION_TIME - Get elapsed execution time |
---|
554 | |
---|
555 | @cindex get elapsed execution time |
---|
556 | |
---|
557 | @subheading CALLING SEQUENCE: |
---|
558 | |
---|
559 | @ifset is-C |
---|
560 | @findex rtems_cbs_get_execution_time |
---|
561 | @example |
---|
562 | int rtems_cbs_get_execution_time ( |
---|
563 | rtems_cbs_server_id server_id, |
---|
564 | time_t *exec_time, |
---|
565 | time_t *abs_time |
---|
566 | ); |
---|
567 | @end example |
---|
568 | @end ifset |
---|
569 | |
---|
570 | @subheading DIRECTIVE STATUS CODES: |
---|
571 | @code{@value{RPREFIX}CBS_OK} - successful@* |
---|
572 | @code{@value{RPREFIX}CBS_ERROR_INVALID_PARAMETER} - invalid input argument@* |
---|
573 | @code{@value{RPREFIX}CBS_ERROR_NOSERVER} - server is not valid@* |
---|
574 | |
---|
575 | @subheading DESCRIPTION: |
---|
576 | |
---|
577 | This routine returns consumed execution time (@code{exec_time}) of a server |
---|
578 | during the current period. |
---|
579 | |
---|
580 | @subheading NOTES: |
---|
581 | |
---|
582 | Absolute time (@code{abs_time}) not supported now. |
---|
583 | |
---|
584 | @c |
---|
585 | @c |
---|
586 | @c |
---|
587 | @page |
---|
588 | @subsection CBS_GET_REMAINING_BUDGET - Get remaining execution time |
---|
589 | |
---|
590 | @cindex get remaining execution time |
---|
591 | |
---|
592 | @subheading CALLING SEQUENCE: |
---|
593 | |
---|
594 | @ifset is-C |
---|
595 | @findex rtems_cbs_get_remaining_budget |
---|
596 | @example |
---|
597 | int rtems_cbs_get_remaining_budget ( |
---|
598 | rtems_cbs_server_id server_id, |
---|
599 | time_t *remaining_budget |
---|
600 | ); |
---|
601 | @end example |
---|
602 | @end ifset |
---|
603 | |
---|
604 | @subheading DIRECTIVE STATUS CODES: |
---|
605 | @code{@value{RPREFIX}CBS_OK} - successful@* |
---|
606 | @code{@value{RPREFIX}CBS_ERROR_INVALID_PARAMETER} - invalid input argument@* |
---|
607 | @code{@value{RPREFIX}CBS_ERROR_NOSERVER} - server is not valid@* |
---|
608 | |
---|
609 | @subheading DESCRIPTION: |
---|
610 | |
---|
611 | This directive returns remaining execution time of a given server for |
---|
612 | current period. |
---|
613 | |
---|
614 | @subheading NOTES: |
---|
615 | |
---|
616 | If the execution time approaches zero, the assigned task should finish |
---|
617 | computations of the current period. |
---|
618 | |
---|
619 | @c |
---|
620 | @c |
---|
621 | @c |
---|
622 | @page |
---|
623 | @subsection CBS_GET_APPROVED_BUDGET - Get scheduler approved execution time |
---|
624 | |
---|
625 | @cindex get scheduler approved execution time |
---|
626 | |
---|
627 | @subheading CALLING SEQUENCE: |
---|
628 | |
---|
629 | @ifset is-C |
---|
630 | @findex rtems_cbs_get_approved_budget |
---|
631 | @example |
---|
632 | int rtems_cbs_get_approved_budget ( |
---|
633 | rtems_cbs_server_id server_id, |
---|
634 | time_t *appr_budget |
---|
635 | ); |
---|
636 | @end example |
---|
637 | @end ifset |
---|
638 | |
---|
639 | @subheading DIRECTIVE STATUS CODES: |
---|
640 | @code{@value{RPREFIX}CBS_OK} - successful@* |
---|
641 | @code{@value{RPREFIX}CBS_ERROR_INVALID_PARAMETER} - invalid input argument@* |
---|
642 | @code{@value{RPREFIX}CBS_ERROR_NOSERVER} - server is not valid@* |
---|
643 | |
---|
644 | @subheading DESCRIPTION: |
---|
645 | |
---|
646 | This directive returns server's approved budget for subsequent periods. |
---|