GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MON / dev > mon / mv2304
#include <PBS/TASK.h>
** CVS $Id: MON_pubdefs.h,v 1.5 2011/03/28 23:52:02 russell Exp $ **
Defines the public interface to the functions found in the MON package.
enum _MON_Perf_Event_1 |
Events from set 1 that can be counted.
enum _MON_Perf_Event_2 |
Events from set 2 that can be counted.
enum _MON_Perf_Event_3 |
Events from set 3 that can be counted.
enum _MON_Perf_Event_4 |
Events from set 4 that can be counted.
enum _MON_Perf_RTC_Select |
Time base register bit selections (for 0-to-1 bit transition events).
unsigned int MON_collect_perf_stats | ( | MON_Perf_Config * | cfg_p, | |
unsigned int | time_us, | |||
MON_Perf_Stats * | stats_p, | |||
MON_Perf_Cb | cb, | |||
void * | cb_parm | |||
) |
Collect performance monitor stats for a specified period of time.
This function configures and starts the CPU performance monitor facility and establishes a wake-up timer that expires after the specified amount of time. The handler for the wake-up timer stops the CPU event counters and triggers a call to the specified callback function. The callback function is executed in the context of the MON polling task. See also the MON_start_perf_mon() and MON_stop_perf_mon() functions.
Note that all event counters are cleared to zero before counting is started. This means that if the MON_EVENT_x_HOLD event is selected for a counter, its value will be set to 0 and held at that value during the collection period.
cfg_p | Pointer to performance monitor configuration (must not be NULL). | |
time_us | Length of time, in microseconds, to collect statistics. | |
stats_p | Pointer to location to return statistics. | |
cb | Function to call when the collection is complete. | |
cb_parm | Parameter to pass to cb function. |
An error MSG code if the MON package is not in the STARTED state, the CPU is already counting events, or an error occurs.
References mon_lock_access(), MON_perf_collect(), MON_STATE_STARTED, mon_unlock_access(), _MON_Control::perf_ctl, and _MON_Control::state.
unsigned int MON_get_loading | ( | MON_Load_Stats * | stats_p | ) |
Get current CPU loading statistics.
This function returns a snapshot of the CPU loading statistics for the previous minute of operation.
stats_p | Pointer to buffer to store loading statistics (must not be NULL). |
An error MSG code if the MON package is not in the STARTED state or an error occurs.
References _MON_Control::idle_ctl, MON_idle_get_stats(), mon_lock_access(), MON_STATE_STARTED, mon_unlock_access(), and _MON_Control::state.
unsigned int MON_initialize | ( | void | ) |
Initialize the MON functions.
This function initializes the MON package and transitions it to the INITIALIZED state. It should be the first MON function called when using the MON package.
An error MSG code if the MON package has already been initialized or an error occurs.
References _MON_Idle_Control::dog_seconds, _MON_Control::idle_ctl, mon_change_state(), mon_create_control_block(), MON_idle_init(), MON_perf_init(), MON_poll_init(), MON_STATE_INIT_FAIL, MON_STATE_INITIALIZED, MON_STATE_INITIALIZING, MON_STATE_UNINITIALIZED, _MON_Control::mtx, _MON_Control::perf_ctl, _MON_Control::poll_ctl, and _MON_Control::state.
unsigned int MON_set_watchdog | ( | void | ) |
Set the hardware watchdog timer.
An error MSG code if an error occurs.
References _MON_Control::idle_ctl, MON_idle_set_watchdog(), MON_STATE_STARTED, and _MON_Control::state.
unsigned int MON_shutdown | ( | void | ) |
Shutdown the MON functions.
This function shuts down the MON package and transitions it back to the UNINITIALIZED state. It can be called only if the current MON state is INITIALIZED, INIT_FAIL, or SHUTDOWN_FAIL. This function should be called after MON_stop() when the MON package is no longer needed.
An error MSG code if the MON package is in an invalid state or an error occurs.
References _MON_Control::idle_ctl, mon_change_state(), MON_idle_shutdown(), MON_perf_shutdown(), MON_poll_shutdown(), MON_STATE_INIT_FAIL, MON_STATE_INITIALIZED, MON_STATE_SHUTDOWN, MON_STATE_SHUTDOWN_FAIL, MON_STATE_UNINITIALIZED, _MON_Control::perf_ctl, _MON_Control::poll_ctl, and _MON_Control::state.
unsigned int MON_start | ( | TASK_attr * | idle_attr_p, | |
TASK_attr * | poll_attr_p | |||
) |
Start the MON functions.
This function starts the various MON tasks and transitions MON to the STARTED state. It can be called only if the current MON state is INITIALIZED. This function should be called after MON_initialize() when using the MON package.
idle_attr_p | IDLE task attributes. Default task attributes (with a name of 'IDLE' and a priority of 255) will be used if this value is NULL. | |
poll_attr_p | POLL task attributes. Default task attributes (with a name of 'POLL' and a priority of 90) will be used if this value is NULL. |
An error MSG code if the MON package is not in the INITIALIZED state or an error occurs.
References _MON_Control::idle_ctl, mon_change_state(), MON_idle_start(), MON_poll_start(), MON_STATE_INITIALIZED, MON_STATE_START_FAIL, MON_STATE_STARTED, MON_STATE_STARTING, _MON_Control::poll_ctl, and _MON_Control::state.
Referenced by MON_start_with_db().
unsigned int MON_start_perf_mon | ( | MON_Perf_Config * | cfg_p | ) |
Start CPU performance monitoring.
This function configures and starts the CPU performance monitor facility, which counts various CPU events. If started with this function, the CPU will count events until MON_stop_perf_mon() is called. See also the MON_collect_perf_stats() function, which counts CPU events for a specified period of time.
Note that all event counters are cleared to zero before counting is started. This means that if the MON_EVENT_x_HOLD event is selected for a counter, its value will be set to 0 and held at that value during the collection period.
cfg_p | Pointer to performance monitor configuration (must not be NULL). |
An error MSG code if the MON package is not in the STARTED state, the CPU is already counting events, or an error occurs.
References mon_lock_access(), MON_perf_start(), MON_STATE_STARTED, mon_unlock_access(), _MON_Control::perf_ctl, and _MON_Control::state.
unsigned int MON_start_with_db | ( | void | ) |
Start the MON functions using the CPU_DB server.
This function is a wrapper for MON_start. It forces MON_start to use the CPU_DB server to determine the attributes for the POLL and IDLE tasks.
A MSG code if an error occurs.
References MON_start().
unsigned int MON_stop | ( | void | ) |
Stop the MON functions.
This function stops the various MON tasks and transitions MON back to the INITIALIZED state. It can be called only if the current MON state is STARTED, START_FAIL, or STOP_FAIL. This function should be called before MON_shutdown() when the MON package is no longer needed.
An error MSG code if the MON package is in an invalid state or an error occurs.
References _MON_Control::idle_ctl, mon_change_state(), MON_idle_stop(), MON_perf_stop(), MON_poll_stop(), MON_STATE_INITIALIZED, MON_STATE_START_FAIL, MON_STATE_STARTED, MON_STATE_STOP_FAIL, MON_STATE_STOPPING, _MON_Control::perf_ctl, _MON_Control::poll_ctl, and _MON_Control::state.
unsigned int MON_stop_perf_mon | ( | MON_Perf_Stats * | stats_p | ) |
Stop CPU performance monitoring.
This function stops the CPU from counting events and returns the current counter values. If the CPU is not actively counting events, the most recent event counter values are returned.
stats_p | Pointer to location to store monitor statistics. If this value is NULL, event counting is stopped without returning the event counter values. |
An error MSG code if the MON package is not in the STARTED state or an error occurs.
References mon_lock_access(), MON_perf_stop(), MON_STATE_STARTED, mon_unlock_access(), _MON_Control::perf_ctl, and _MON_Control::state.