source: rtems-docs/c-user/constant_bandwidth_server.rst @ 3384994

5
Last change on this file since 3384994 was 3384994, checked in by Chris Johns <chrisj@…>, on 11/13/17 at 02:25:18

Clean up sphinx warnings.

  • Fix minor formatting issues.
  • Fix reference the gloassary TLS using ':term:'.
  • Make sure nothing is between an anchor and the heading where ':ref:' references the anchor. This meant moving all the recently added '.. index::' entries.

Update #3232.
Update #3229.

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