source: rtems/cpukit/score/src/schedulercbsgetexecutiontime.c @ f031df0e

4.115
Last change on this file since f031df0e was 5618c37a, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 13:14:48

score: Create thread implementation header

Move implementation specific parts of thread.h and thread.inl into new
header file threadimpl.h. The thread.h contains now only the
application visible API.

Remove superfluous header file includes from various files.

  • 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/score/schedulercbs.h>
23#include <rtems/score/threadimpl.h>
24
25int _Scheduler_CBS_Get_execution_time (
26  Scheduler_CBS_Server_id   server_id,
27  time_t                   *exec_time,
28  time_t                   *abs_time
29)
30{
31  Objects_Locations location;
32  Thread_Control *the_thread;
33
34  if ( server_id >= _Scheduler_CBS_Maximum_servers )
35    return SCHEDULER_CBS_ERROR_INVALID_PARAMETER;
36  if ( !_Scheduler_CBS_Server_list[server_id] )
37    return SCHEDULER_CBS_ERROR_NOSERVER;
38  if ( _Scheduler_CBS_Server_list[server_id]->task_id == -1 ) {
39    *exec_time = 0;
40    return SCHEDULER_CBS_OK;
41  }
42
43  the_thread = _Thread_Get(
44                 _Scheduler_CBS_Server_list[server_id]->task_id,
45                 &location
46               );
47  /* The routine _Thread_Get may disable dispatch and not enable again. */
48  if ( the_thread ) {
49    *exec_time = _Scheduler_CBS_Server_list[server_id]->parameters.budget -
50      the_thread->cpu_time_budget;
51    _Objects_Put( &the_thread->Object );
52  }
53  else {
54    *exec_time = _Scheduler_CBS_Server_list[server_id]->parameters.budget;
55  }
56  return SCHEDULER_CBS_OK;
57}
Note: See TracBrowser for help on using the repository browser.