L4Re – L4 Runtime Environment
scheduler
Go to the documentation of this file.
1 // vi:set ft=cpp: -*- Mode: C++ -*-
6 /*
7  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8  * Alexander Warg <warg@os.inf.tu-dresden.de>
9  * economic rights: Technische Universität Dresden (Germany)
10  *
11  * This file is part of TUD:OS and distributed under the terms of the
12  * GNU General Public License 2.
13  * Please see the COPYING-GPL-2 file for details.
14  *
15  * As a special exception, you may use this file as part of a free software
16  * library without restriction. Specifically, if other files instantiate
17  * templates or use macros or inline functions from this file, or you compile
18  * this file and link it with other files to produce an executable, this
19  * file does not by itself cause the resulting executable to be covered by
20  * the GNU General Public License. This exception does not however
21  * invalidate any other reasons why the executable file might be covered by
22  * the GNU General Public License.
23  */
24 #pragma once
25 
26 #include <l4/sys/icu>
27 #include <l4/sys/scheduler.h>
28 #include <l4/sys/capability>
29 #include <l4/sys/cxx/ipc_iface>
30 
31 namespace L4 {
32 
45 class L4_EXPORT Scheduler :
46  public Kobject_t<Scheduler, Icu, L4_PROTO_SCHEDULER,
47  Type_info::Demand_t<1> >
48 {
49 public:
50  // ABI function for 'info' call
52  l4_msgtag_t, info, (l4_umword_t gran_offset, l4_umword_t *map,
53  l4_umword_t *cpu_max));
54 
70  l4_utcb_t *utcb = l4_utcb()) const noexcept
71  {
72  l4_umword_t max = 0;
73  l4_msgtag_t t =
74  info_t::call(c(), cpus->gran_offset, &cpus->map, &max, utcb);
75  if (cpu_max) *cpu_max = max;
76  return t;
77  }
78 
101  l4_msgtag_t, run_thread, (Ipc::Cap<Thread> thread, l4_sched_param_t const &sp));
102 
130  l4_msgtag_t, idle_time, (l4_sched_cpu_set_t const &cpus,
132 
142  bool is_online(l4_umword_t cpu, l4_utcb_t *utcb = l4_utcb()) const noexcept
143  { return l4_scheduler_is_online_u(cap(), cpu, utcb); }
144 
146 };
147 }
L4::Cap related definitions.
Capability type for RPC interfaces (see L4::Cap<T>).
Definition: ipc_types:542
Helper class to create an L4Re interface class that is derived from a single base class.
Definition: __typeinfo.h:760
C++ interface of the Scheduler kernel object.
Definition: scheduler:48
bool is_online(l4_umword_t cpu, l4_utcb_t *utcb=l4_utcb()) const noexcept
Query if a CPU is online.
Definition: scheduler:142
l4_msgtag_t info(l4_umword_t *cpu_max, l4_sched_cpu_set_t *cpus, l4_utcb_t *utcb=l4_utcb()) const noexcept
Get scheduler information.
Definition: scheduler:69
T1 max(T1 a, T1 b)
Get the maximum of a and b.
Definition: minmax:46
unsigned long l4_umword_t
Unsigned machine word.
Definition: l4int.h:51
l4_uint64_t l4_kernel_clock_t
Kernel clock type.
Definition: l4int.h:64
@ L4_SCHEDULER_RUN_THREAD_OP
Run a thread on this scheduler.
Definition: scheduler.h:204
@ L4_SCHEDULER_IDLE_TIME_OP
Query idle time for the scheduler.
Definition: scheduler.h:205
@ L4_SCHEDULER_INFO_OP
Query infos about the scheduler.
Definition: scheduler.h:203
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition: utcb.h:67
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition: utcb.h:340
Interrupt controller.
Interface Definition Language.
#define L4_INLINE_RPC_NF_OP(op, res, name, args...)
Define an inline RPC call type with specific opcode (the type only, no callable).
Definition: ipc_iface:453
#define L4_INLINE_RPC_OP(op, res, name, args, attr...)
Define an inline RPC call with specific opcode (type and callable).
Definition: ipc_iface:484
L4 low-level kernel interface.
Scheduler object functions.
List of RPCs typically used for kernel interfaces.
Definition: __typeinfo.h:475
Message tag data structure.
Definition: types.h:160
l4_umword_t gran_offset
Combination of granularity and offset.
Definition: scheduler.h:58
l4_umword_t map
Bitmap of CPUs.
Definition: scheduler.h:63
Scheduler parameter set.
Definition: scheduler.h:121