source: rtems/cpukit/score/src/schedulercbsgetexecutiontime.c @ 4f5baff

4.115
Last change on this file since 4f5baff was 1b475860, checked in by Christopher Kerl <zargyyoyo@…>, on Nov 29, 2012 at 7:39:17 PM

score misc: Score misc: Clean up Doxygen #6 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

http://www.google-melange.com/gci/task/view/google/gci2012/7976215

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 * @file
3 *
4 * @brief Get Thread Execution Info
5 *
6 * @ingroup ScoreScheduler
7 */
8
9/*
10 *  Copyright (C) 2011 Petr Benes.
11 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/system.h>
23#include <rtems/config.h>
24#include <rtems/score/scheduler.h>
25#include <rtems/score/schedulercbs.h>
26
27int _Scheduler_CBS_Get_execution_time (
28  Scheduler_CBS_Server_id   server_id,
29  time_t                   *exec_time,
30  time_t                   *abs_time
31)
32{
33  Objects_Locations location;
34  Thread_Control *the_thread;
35
36  if ( server_id >= _Scheduler_CBS_Maximum_servers )
37    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
38  if ( !_Scheduler_CBS_Server_list[server_id] )
39    return SCHEDULER_CBS_ERROR_NOSERVER;
40  if ( _Scheduler_CBS_Server_list[server_id]->task_id == -1 ) {
41    *exec_time = 0;
42    return SCHEDULER_CBS_OK;
43  }
44
45  the_thread = _Thread_Get(
46                 _Scheduler_CBS_Server_list[server_id]->task_id,
47                 &location
48               );
49  /* The routine _Thread_Get may disable dispatch and not enable again. */
50  if ( the_thread ) {
51    _Thread_Enable_dispatch();
52    *exec_time = _Scheduler_CBS_Server_list[server_id]->parameters.budget -
53      the_thread->cpu_time_budget;
54  }
55  else {
56    *exec_time = _Scheduler_CBS_Server_list[server_id]->parameters.budget;
57  }
58  return SCHEDULER_CBS_OK;
59}
Note: See TracBrowser for help on using the repository browser.