GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MON / dev > mon / sun-gcc
#include <MON_idle.h>
#include <MON/MON_msgs.h>
#include <MON/MON_pubdefs.h>
#include <MSG/MSG_pubdefs.h>
#include <PBS/INT.ih>
#include <PBS/MBA.h>
#include <PBS/TASK.h>
Functions | |
unsigned int | MON_idle_init (MON_Idle_Control *ctl_p, unsigned int dog_seconds, unsigned int dog_cpu_msecs) |
Initialize the IDLE monitor. | |
unsigned int | MON_idle_shutdown (MON_Idle_Control *ctl_p) |
Shutdown the IDLE monitor. | |
void | MON_idle_set_watchdog (MON_Idle_Control *ctl_p) |
Set the hardware watchdog timer. | |
static unsigned int | mon_idle_loop (MON_Idle_Control *ctl_p, int run_once) |
Idly consume CPU cycles in a loop. | |
static void * | mon_idle_task (TASK_parameter parm) |
Consume unused CPU cycles. | |
unsigned int | MON_idle_start (MON_Idle_Control *ctl_p, TASK_attr *attr_p) |
Start the IDLE monitor functions. | |
unsigned int | MON_idle_stop (MON_Idle_Control *ctl_p) |
Stop the IDLE monitor functions. | |
unsigned int | MON_idle_update_history (MON_Idle_Control *ctl_p) |
Update the IDLE time history. | |
static int | mon_idle_get_load (MON_Idle_Control *ctl_p, unsigned int first_index, unsigned int last_index) |
Get CPU loading between two IDLE time history samples. | |
unsigned int | MON_idle_get_stats (MON_Idle_Control *ctl_p, MON_Load_Stats *load_p) |
Get CPU loading statistics. |
** CVS $Id: MON_idle.c,v 1.7 2011/03/28 23:52:03 russell Exp $ **
Monitors the loading and idle time of the CPU. Starts an IDLE task that spins in a loop and reports a running total of the number of loop iterations that it completes. By setting the priority of this IDLE task to the lowest value possible, it will only run when the CPU is idle.
When first started, the IDLE task measures and records the number of time base register cycles required to execute its inner spin-loop with interrupts disabled. This value is then used as the benchmark for the amount of time required to execute the IDLE loop when the CPU is completely unloaded. At periodic intervals, the loop completion count is used to determine how many time base register cycles were spent executing the IDLE loop during the previous interval. By dividing this value by the total number of time base register cycles in the previous interval, a CPU loading/idle-time metric is produced.
int mon_idle_get_load | ( | MON_Idle_Control * | ctl_p, | |
unsigned int | first_index, | |||
unsigned int | last_index | |||
) | [static] |
Get CPU loading between two IDLE time history samples.
ctl_p | Pointer to IDLE state. | |
first_index | Index of first sample. | |
last_index | Index of last sample. |
References _MON_Idle_Control::history, _MON_Idle_Sample::loop_count, _MON_Idle_Control::loop_cycles, and _MON_Idle_Sample::time.
Referenced by MON_idle_get_stats().
unsigned int MON_idle_get_stats | ( | MON_Idle_Control * | ctl_p, | |
MON_Load_Stats * | load_p | |||
) |
Get CPU loading statistics.
ctl_p | Pointer to IDLE state. | |
load_p | Pointer to location to return stats. |
References _MON_Load_Stats::avg_prev_min, _MON_Load_Stats::avg_prev_sec, _MON_Idle_Control::history, _MON_Idle_Control::history_count, _MON_Load_Stats::max_prev_min, _MON_Load_Stats::min_prev_min, and mon_idle_get_load().
Referenced by MON_get_loading().
unsigned int MON_idle_init | ( | MON_Idle_Control * | ctl_p, | |
unsigned int | dog_seconds, | |||
unsigned int | dog_cpu_msecs | |||
) |
Initialize the IDLE monitor.
ctl_p | Pointer to IDLE state. | |
dog_seconds | Hardware watchdog timer setting value. | |
dog_cpu_msecs | IDLE loop run time between watchdog settings. |
References _MON_Idle_Control::dog_cpu_msecs, _MON_Idle_Control::dog_seconds, _MON_Idle_Control::dog_setting, and _MON_Idle_Control::tcb_p.
Referenced by MON_initialize().
unsigned int mon_idle_loop | ( | MON_Idle_Control * | ctl_p, | |
int | run_once | |||
) | [static] |
Idly consume CPU cycles in a loop.
ctl_p | Pointer to IDLE state. | |
run_once | Nonzero indicates that loop should be run once. |
References _MON_Idle_Control::dog_cpu_loops, _MON_Idle_Control::loop_count, MON_idle_set_watchdog(), and _MON_Idle_Control::run.
Referenced by MON_idle_start(), and mon_idle_task().
void MON_idle_set_watchdog | ( | MON_Idle_Control * | ctl_p | ) |
Set the hardware watchdog timer.
ctl_p | Pointer to IDLE state. |
References _MON_Idle_Control::dog_count, and _MON_Idle_Control::dog_setting.
Referenced by mon_idle_loop(), MON_idle_start(), and MON_set_watchdog().
unsigned int MON_idle_shutdown | ( | MON_Idle_Control * | ctl_p | ) |
Shutdown the IDLE monitor.
ctl_p | Pointer to IDLE state. |
References _MON_Idle_Control::tcb_p.
Referenced by MON_shutdown().
unsigned int MON_idle_start | ( | MON_Idle_Control * | ctl_p, | |
TASK_attr * | attr_p | |||
) |
Start the IDLE monitor functions.
ctl_p | Pointer to IDLE state. | |
attr_p | Pointer to IDLE task attributes. |
References _MON_Idle_Control::dog_count, _MON_Idle_Control::history_count, _MON_Idle_Control::loop_count, _MON_Idle_Control::loop_cycles, _MON_Idle_Control::loop_end, _MON_Idle_Control::loop_start, mon_idle_loop(), MON_idle_set_watchdog(), mon_idle_task(), _MON_Idle_Control::run, and _MON_Idle_Control::tcb_p.
Referenced by MON_start().
unsigned int MON_idle_stop | ( | MON_Idle_Control * | ctl_p | ) |
Stop the IDLE monitor functions.
ctl_p | Pointer to IDLE state. |
References _MON_Idle_Control::run, and _MON_Idle_Control::tcb_p.
Referenced by MON_stop().
void * mon_idle_task | ( | TASK_parameter | parm | ) | [static] |
Consume unused CPU cycles.
parm | Pointer to IDLE state. |
References _MON_Idle_Control::dog_cpu_loops, _MON_Idle_Control::dog_cpu_msecs, _MON_Idle_Control::loop_cycles, _MON_Idle_Control::loop_cycles_0, and mon_idle_loop().
Referenced by MON_idle_start().
unsigned int MON_idle_update_history | ( | MON_Idle_Control * | ctl_p | ) |
Update the IDLE time history.
ctl_p | Pointer to IDLE state. |
References _MON_Idle_Control::history, _MON_Idle_Control::history_count, _MON_Idle_Control::loop_count, _MON_Idle_Sample::loop_count, and _MON_Idle_Sample::time.
Referenced by mon_poll_task().