GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EFC / V4-5-5 > defc / rhel5-64
#include <EFA_p.h>
#include <EFC_time.ih>
#include <EDS/EDS_cfg.h>
#include <LSF/LSF_reason.h>
#include <dprintf.h>
#include <EFA_synch.c>
Defines | |
#define | PAUSED |
Defines a bit mask representing which close reasons will force the state to paused. | |
#define | STOPPED |
Defines a bit mask representing which close reasons will force the state to stopped. | |
Functions | |
static __inline void | efa_get_new_packet (EFA *efa) |
Gets a new packet after the current packet has been posted. | |
static __inline void | efa_compose_end_hdr (EFA *efa) |
Composes the end of sample header from the information of the last event. | |
int | EFA_enable (EFA *efa, int enable) |
Enables/disables EFA. This can only be done outside the context of a run, i.e. the state must be STOPPED. | |
int | EFA_sizeof (int result_size, int result_cnt) |
Computes the size, in bytes, of the EFA control structure. | |
int | EFA_resultSizeof (const EFA *efa) |
Returns the size, in bytes, of one result vector. | |
int | EFA_construct (EFA *efa, void *pool, int enable, const EFA_services *services, void *ctx, unsigned int size, unsigned int postCnt, unsigned int flushCnt) |
Set up the internal data structures of the EFA control structure. | |
int | EFA_notify (EFA *efa, int mode, const EDS_cfgInfo *cfg) |
Callback signature to notify an analyis routine of a mode change. | |
int | EFA_flush (EFA *efa, int reason) |
Forces a posting of the current results. | |
void | EFA_postprocess (EFA *efa) |
Processes a packet when it has been filled. This is just the logic to drive EFA_flush. | |
int | EFA_start (EFA *efa, int reason, int run_id, int startTime, int mode) |
Callback signature to start or prepare a posting stream to receive events. | |
unsigned int | EFA_hdrCompose (EFA_hdr *hdr, unsigned int relative, unsigned long long seq, unsigned int gemClock, unsigned int gemStrobe) |
Composes specified event header. |
CVS $Id: EFA.c,v 1.4 2011/03/28 17:51:27 russell Exp $
Each filter is allowed to produced a vector of N 32-bits words which act as a summary of its results. The first word of this vector must be a 32-bit mask of the conditions.
This facility provides a framework to analyze these result vectors. Typically, these results are bundled into a vector of results and passed to an analysis routine. For example, EFS the generic statistics package, is an example of such a routine.
#define PAUSED |
Value:
((1<<LSF_REASON_CLOSE_K_PAUSE ) \ | (1<<LSF_REASON_CLOSE_K_PAUSE_OP ) \ | (1<<LSF_REASON_CLOSE_K_PAUSE_AUTO ))
Referenced by EFA_flush().
#define STOPPED |
Value:
((1<<LSF_REASON_CLOSE_K_STOP ) \ | (1<<LSF_REASON_CLOSE_K_STOP_OP ) \ | (1<<LSF_REASON_CLOSE_K_STOP_TIME ) \ | (1<<LSF_REASON_CLOSE_K_STOP_COUNT ) \ | (1<<LSF_REASON_CLOSE_K_ABORT ) \ | (1<<LSF_REASON_CLOSE_K_ABORT_OP ) \ | (1<<LSF_REASON_CLOSE_K_ABORT_AUTO ))
Referenced by EFA_flush().
static __inline void efa_compose_end_hdr | ( | EFA * | efa | ) | [static] |
Composes the end of sample header from the information of the last event.
efa The Event Filter Analysis control handle
References EFA_hdrCompose(), _EFA_span::hdrs, _EFA::last, _EFA_evtInfo::ppstime, _EFA::reason, _EFA::span, _EFA_evtInfo::trgtime, and _EFA_evtInfo::xsequence.
Referenced by EFA_flush().
int EFA_construct | ( | EFA * | efa, | |
void * | pool, | |||
int | enable, | |||
const EFA_services * | services, | |||
void * | ctx, | |||
unsigned int | size, | |||
unsigned int | postCnt, | |||
unsigned int | flushCnt | |||
) |
Set up the internal data structures of the EFA control structure.
0,Success |
efa | The Event Filter Analysis control structure | |
pool | The memory pool | |
enable | 1 if start in the enabled state, else start in the disabled state | |
services | The set of service routines | |
ctx | Arbitrary user context parameter passed to the user callback routines | |
size | The size of a result vector. This value should have been obtained by a call to EFA_resultSizeof This routine checks that this value matches that from EFA_resultSizeof. | |
postCnt | The number of result vectors in a packet. This results in a process flush reason | |
flushCnt | The number of result vectors before a flush is issued. This results in a process LSF_REASON_CLOSE_K_STOP_CNT flush reason. |
References _EFA::beg, _EFA::beg_evt_fill, _EFA::ctx, _EFA::cur, EFA_alloc(), EFA_STATE_K_DISABLED, EFA_STATE_K_STOPPED, _EFA::flushLeft, _EFA::flushLimit, _EFA::pool, _EFA::postLeft, _EFA::postLimit, _EFA::services, _EFA::size, and _EFA::state.
Referenced by EFC_stdConstruct().
int EFA_enable | ( | EFA * | efa, | |
int | enable | |||
) |
Enables/disables EFA. This can only be done outside the context of a run, i.e. the state must be STOPPED.
-1, on failure.
efa | The Event Filter Analysis control handle | |
enable | If non-zero, enable, if zero, disable |
References EFA_STATE_K_DISABLED, EFA_STATE_K_STOPPED, and _EFA::state.
int EFA_flush | ( | EFA * | efa, | |
int | reason | |||
) |
Forces a posting of the current results.
efa | The event filter analysis control structure | |
reason | The reason flush is being called. |
References efa_compose_end_hdr(), efa_flush(), EFA_FLUSH_REASON_K_RECORD_PROCESS, efa_get_new_packet(), EFA_STATE_K_PAUSED, EFA_STATE_K_STOPPED, PAUSED, _EFA::state, and STOPPED.
Referenced by EFA_notify(), EFA_postprocess(), and efc_flush().
static __inline void efa_get_new_packet | ( | EFA * | efa | ) | [static] |
Gets a new packet after the current packet has been posted.
efa The Event Filter Analysis control handle
References _EFA::beg, _EFA::cur, EFA_alloc(), _EFA_span::hdrs, _EFA_hdr::relative, and _EFA::span.
Referenced by EFA_flush().
unsigned int EFA_hdrCompose | ( | EFA_hdr * | hdr, | |
unsigned int | relative, | |||
unsigned long long | seq, | |||
unsigned int | gemClock, | |||
unsigned int | gemStrobe | |||
) |
Composes specified event header.
hdr | Pointer to the target EFA_hdr | |
relative | The relative (to the beginning of the buffer) event number (1 = first event) | |
seq | Extended seqence number of the event | |
gemClock | Event clock register read from GEM contributor of event | |
gemStrobe | Event PPS cock register read from GEM contributor of event |
References _EFA_hdrTimetones::cur, EFA__hdrSeqSet(), EFC__timetonesGet(), _EFA_hdrTimetone::flags, _EFA_hdr::gemClock, _EFA_hdrTimetone::gemStrobe, _EFA_hdrTimetones::prv, _EFA_hdr::relative, _EFA_hdrTimetone::secs, _EFA_hdr::seq, and _EFA_hdr::timetones.
Referenced by EFA__preprocess(), and efa_compose_end_hdr().
int EFA_notify | ( | EFA * | efa, | |
int | mode, | |||
const EDS_cfgInfo * | cfg | |||
) |
Callback signature to notify an analyis routine of a mode change.
efa | The Event Filter Analysis control handle | |
mode | The new running mode. | |
cfg | The new configuration information |
References _EFA_span::cfg_id, _EFA_span::cfg_key, EFA_flush(), _EFA::flushLeft, _EFA::flushLimit, _EFA_span::mode, _EFA::postLeft, _EFA::postLimit, and _EFA::span.
Referenced by EFC_modeSelect().
void EFA_postprocess | ( | EFA * | efa | ) |
Processes a packet when it has been filled. This is just the logic to drive EFA_flush.
efa | The event filter analysis control structure |
References EFA_flush(), EFA_FLUSH_REASON_K_RECORD_PROCESS, EFA_FLUSH_REASON_K_RECORD_UPDATE, _EFA::flushLeft, _EFA::flushLimit, _EFA::postLeft, and _EFA::postLimit.
Referenced by EFC_filter().
int EFA_resultSizeof | ( | const EFA * | efa | ) |
Returns the size, in bytes, of one result vector.
The | size, in bytes, of one result vector |
efa | The Event Filter Analysis Control Block |
References _EFA::size.
Referenced by efc_result_sizeof().
int EFA_sizeof | ( | int | result_size, | |
int | result_cnt | |||
) |
Computes the size, in bytes, of the EFA control structure.
result_size | The size, in bytes, of one result vector | |
result_cnt | The number of result vectors in one packet |
References efa_apb_sizeof().
Referenced by EFC_stdSizeof().
int EFA_start | ( | EFA * | efa, | |
int | reason, | |||
int | run_id, | |||
int | startTime, | |||
int | mode | |||
) |
Callback signature to start or prepare a posting stream to receive events.
efa | The Event Filter Analysis control handle | |
reason | The LSF_REASON_OPEN to indicate why the stream is being started | |
run_id | Suggested use is to identify the block of events between when EDS_fwHandlerStart is called and EDS_fwHandlerFlush is called with a stop reason | |
startTime | The run start time rounded to the nearest second | |
mode | This must be the running mode. |
References _EFA::beg_evt_fill, _EFA::ctx, EFA_STATE_K_DISABLED, EFA_STATE_K_STARTED, EFA_STATE_K_STOPPED, _EFA::flushLeft, _EFA::flushLimit, _EFA::postLeft, _EFA::postLimit, _EFA::services, _EFA_services::start, and _EFA::state.
Referenced by EFC_start().