Go to the source code of this file.
Data Structures | |
struct | utcb_list_t |
List-element to manage utcbs/threads. More... | |
struct | watch_arg_t |
argument type for IPC-communication with watch thread More... | |
Typedefs | |
typedef enum watch_cmd_val_t | watch_cmd_t |
Cmd-type for IPC-communication with watch thread. | |
Enumerations | |
enum | watch_cmd_val_t { WATCH_CMD_INV, WATCH_CMD_ADD, WATCH_CMD_DEL } |
Cmd-type for IPC-communication with watch thread. More... | |
Functions | |
static void | watch_thread (void *arg) |
The main watcher thread. | |
int | l4cpu_reserve_utcb_watch_add (l4_threadid_t thread, l4cpu_reserve_utcb_t *utcb, const char *name, unsigned maxtime, int ts_count) |
Add a thread to the watched threads. | |
int | l4cpu_reserve_utcb_watch_del (const l4cpu_reserve_utcb_t *utcb) |
Stop watching of a thread. | |
int | l4cpu_reserve_utcb_watch_init (int poll_interval) |
Initialize watching threads using the utcb rings. | |
static int | watch_add_utcb_do (watch_arg_t *arg) |
Actually add a new thread to the list of watched threads. | |
static int | watch_del_utcb_do (const l4cpu_reserve_utcb_t *utcb) |
Actually remove a thread from the list of watched threads. | |
static void | watch_insert_sample (utcb_list_t *l, int id, long time) |
Helper function to add a sample to a timeslice of a thread. | |
static int | watch_add_res_entry (utcb_list_t *l, int id, unsigned long long release, long time) |
Add a history element: end of reservation/next reservation. | |
static void | watch_add_period_entry (utcb_list_t *l, int id, unsigned long long release, long time) |
Add a history element: end of period/next period. | |
static void | watch_add_lost (utcb_list_t *l, int count) |
Add a history element: end of period/next period. | |
static void | print_sched_event (int id, l4cpu_reserve_utcb_elem_t *stat) __attribute__((unused)) |
Dump a scheduling element to the console. | |
static void | watch_eval_utcbs (void) |
Poll all watched threads for new events. | |
Variables | |
static utcb_list_t * | utcb_list |
the utcbs/threads are kept in this list | |
static l4_threadid_t | watch_thread_id |
thread-id of watcher thread |
Definition in file utcb_watch.c.
typedef enum watch_cmd_val_t watch_cmd_t |
Cmd-type for IPC-communication with watch thread.
enum watch_cmd_val_t |
int l4cpu_reserve_utcb_watch_add | ( | l4_threadid_t | thread, | |
l4cpu_reserve_utcb_t * | utcb, | |||
const char * | name, | |||
unsigned | maxtime, | |||
int | ts_count | |||
) |
Add a thread to the watched threads.
thread | thread to be watched | |
utcb | pointer to the utcb of that thread | |
name | name of the thread/watch entity | |
ts_count | maximum number of timeslices to watch (incl. the be-timeslice) |
0 | OK, error else |
Definition at line 70 of file utcb_watch.c.
References L4CPU_RESERVE_UTCB_NAME_LEN, watch_arg_t::maxtime, watch_arg_t::name, watch_arg_t::thread, watch_arg_t::ts_count, watch_arg_t::utcb, WATCH_CMD_ADD, and watch_thread_id.
int l4cpu_reserve_utcb_watch_del | ( | const l4cpu_reserve_utcb_t * | utcb | ) |
Stop watching of a thread.
thread | thread that is not to be watched any longer |
0 | OK, error else |
Definition at line 95 of file utcb_watch.c.
References WATCH_CMD_DEL, and watch_thread_id.
int l4cpu_reserve_utcb_watch_init | ( | int | polltime | ) |
Initialize watching threads using the utcb rings.
poll_interval | poll interval, in microseconds |
0 | OK, error else |
Definition at line 108 of file utcb_watch.c.
References watch_thread(), and watch_thread_id.
static void print_sched_event | ( | int | id, | |
l4cpu_reserve_utcb_elem_t * | stat | |||
) | [static] |
Dump a scheduling element to the console.
Definition at line 274 of file utcb_watch.c.
References l4cpu_reserve_utcb_elem_t::id, l4cpu_reserve_utcb_stat_itoa(), l4cpu_reserve_utcb_elem_t::left, l4cpu_reserve_utcb_elem_t::release, and l4cpu_reserve_utcb_elem_t::type.
static void watch_add_lost | ( | utcb_list_t * | l, | |
int | count | |||
) | [static] |
Add a history element: end of period/next period.
This function sets the history element of the given id to the given time. For all rt-timeslices that got no reservation in this period, a history-element with time 0 will be added.
Definition at line 262 of file utcb_watch.c.
References utcb_list_t::hists, and utcb_list_t::ts_count.
Referenced by watch_eval_utcbs().
static void watch_add_period_entry | ( | utcb_list_t * | l, | |
int | id, | |||
unsigned long long | release, | |||
long | time | |||
) | [static] |
Add a history element: end of period/next period.
This function sets the history element of the given id to the given time. For all rt-timeslices that got no reservation in this period, a history-element with time 0 will be added.
Definition at line 243 of file utcb_watch.c.
References utcb_list_t::ts_count, utcb_list_t::ts_num, watch_add_res_entry(), and watch_insert_sample().
Referenced by watch_eval_utcbs().
static int watch_add_res_entry | ( | utcb_list_t * | l, | |
int | id, | |||
unsigned long long | release, | |||
long | time | |||
) | [static] |
Add a history element: end of reservation/next reservation.
This function sets the history element of the given id to the given time. For all rt-timeslices below the given one, a history-element with time 0 will be added.
Definition at line 215 of file utcb_watch.c.
References utcb_list_t::period, utcb_list_t::release, utcb_list_t::ts_count, utcb_list_t::ts_num, and watch_insert_sample().
Referenced by watch_add_period_entry(), and watch_eval_utcbs().
static int watch_add_utcb_do | ( | watch_arg_t * | arg | ) | [static] |
Actually add a new thread to the list of watched threads.
Definition at line 129 of file utcb_watch.c.
References utcb_list_t::hists, L4CPU_RESERVE_UTCB_NAME_LEN, watch_arg_t::maxtime, watch_arg_t::name, utcb_list_t::name, utcb_list_t::next, watch_arg_t::thread, utcb_list_t::thread, utcb_list_t::ts_count, watch_arg_t::ts_count, watch_arg_t::utcb, and utcb_list_t::utcb.
Referenced by watch_thread().
static int watch_del_utcb_do | ( | const l4cpu_reserve_utcb_t * | utcb | ) | [static] |
Actually remove a thread from the list of watched threads.
Definition at line 171 of file utcb_watch.c.
References utcb_list_t::hists, utcb_list_t::next, utcb_list_t::ts_count, and utcb_list_t::utcb.
Referenced by watch_thread().
static void watch_eval_utcbs | ( | void | ) | [static] |
Poll all watched threads for new events.
Definition at line 282 of file utcb_watch.c.
References l4cpu_reserve_utcb_t::full, l4cpu_reserve_utcb_t::head, l4cpu_reserve_utcb_elem_t::id, L4_UTCB_NEXT_PERIOD, L4_UTCB_NEXT_RESERVATION, L4_UTCB_PERIOD_OVERRUN, L4_UTCB_RESERVATION_OVERRUN, L4CPU_RESERVE_UTCB_STAT_COUNT, l4cpu_reserve_utcb_elem_t::left, utcb_list_t::next, l4cpu_reserve_utcb_elem_t::release, l4cpu_reserve_utcb_t::stat, l4cpu_reserve_utcb_t::tail, l4cpu_reserve_utcb_elem_t::type, utcb_list_t::utcb, watch_add_lost(), watch_add_period_entry(), and watch_add_res_entry().
Referenced by watch_thread().
static void watch_insert_sample | ( | utcb_list_t * | l, | |
int | id, | |||
long | time | |||
) | [static] |
Helper function to add a sample to a timeslice of a thread.
l | utcb-list describing the thread | |
id | timeslice id | |
time | consumed time of the timeslice in the current period |
Definition at line 201 of file utcb_watch.c.
References utcb_list_t::hists.
Referenced by watch_add_period_entry(), and watch_add_res_entry().
static void watch_thread | ( | void * | arg | ) | [static] |
The main watcher thread.
This thread waits for requests from other threads to add/remove threads and periodically polls the watched threads for events.
Definition at line 325 of file utcb_watch.c.
References watch_add_utcb_do(), WATCH_CMD_ADD, WATCH_CMD_DEL, watch_del_utcb_do(), watch_eval_utcbs(), and watch_thread_id.
Referenced by l4cpu_reserve_utcb_watch_init().
utcb_list_t* utcb_list [static] |
l4_threadid_t watch_thread_id [static] |
thread-id of watcher thread
Definition at line 62 of file utcb_watch.c.
Referenced by l4cpu_reserve_utcb_watch_add(), l4cpu_reserve_utcb_watch_del(), l4cpu_reserve_utcb_watch_init(), and watch_thread().