GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSSP / dev > qssp / linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

QSTD.c File Reference

Decodes the Science Statistics (Physics) for the handlers. More...

#include <QSSP/QSTD.h>
#include <QSSP/QSSP_span.h>
#include <QSSP/QSTD_labels.h>
#include <QSTD_versions.h>
#include <QSTD_pvtdefs.h>
#include <dprintf.h>
#include <QSP/QFCP_cache.h>
#include <QSD/QFR_file.h>
#include <QSD/QFC_member.h>
#include <EFC/EFS_ids.h>
#include <LSF/LSF.h>
#include <LSF/LSF_scan.h>
#include <LSF/LSF_reason.h>
#include <LDT/BFU.h>
#include <string.h>
#include <stdlib.h>

Defines

#define RND_8(_v)   ((_v + 7) & ~0x7)

Typedefs

typedef const unsigned int *(* DecodeSampleV0 )(QSTD *qstd, QSTD_sampleV0 *sample, const unsigned int *dat, unsigned char bridge)
 Signature to decode a statistics sample from the input data.

Functions

static __inline QFCP_cache * qstd_file_cache_get (void)
 Returns a pointer to the file cache.
static const unsigned int * decode_statsV0_norm (QSTD *qstd, QSTD_statisticsV0 *stats, const unsigned int *dat, unsigned char bridge)
 Decodes a normal (not differenced) statistics record.
static const unsigned int * decode_statsV0_diff (QSTD *qstd, QSTD_statisticsV0 *stats, const unsigned int *dat, unsigned char bridge)
 Decodes the statistics in difference format.
static const unsigned int * decode_sampleV0_0 (QSTD *qstd, QSTD_sampleV0 *sample, const unsigned int *dat, unsigned char bridge)
 Decodes a format 0 sample record.
static const unsigned int * decode_sampleV0_1 (QSTD *qstd, QSTD_sampleV0 *sample, const unsigned int *dat, unsigned char bridge)
 Decodes a format 1 sample record.
static const unsigned int * decode_sampleV0_2 (QSTD *qstd, QSTD_sampleV0 *sample, const unsigned int *dat, unsigned char bridge)
 Decodes a format 2 sample record.
QSTDQSTD_alloc (void *must_be_null)
 Allocates and constructs a QSTD handle.
QSTDQSTD_construct (QSTD *qstd, void *must_be_null)
 The constructor for a QSTD control structure.
void QSTD_destruct (QSTD *qstd)
 The destructor for a QSTD control structure.
const QSTD_ctxQSTD_ctxGet (const QSTD *qstd)
 Locates the statistics context (meta-data).
int QSTD_sizeof (void *must_be_null)
 Returns the size, in bytes, of a QSTD control structure.
const LSF_contribution * QSTD_updateAtDatagram (QSTD *qstd, const LSF_datagram *dgm)
 Updates the context at datagram time.
int QSTD_updateAtContribution (QSTD *qstd, const LSF_contribution *ctb)
 Updates the context at datagram time.
static __inline void qstd_sampleV0_add (QSTD_sampleV0 *dst, const QSTD_sampleV0 *src)
 Adds the source sample to the destination sample.
static __inline int qstd_sampleV0_decode (QSTD *qstd, unsigned int type_id, unsigned char bridge, const unsigned int *dat)
 Decodes the statistics data.
int QSTD_updateAtRecord (QSTD *qstd, const LSF_record *rec)
 Updates the context at record time.


Detailed Description

Decodes the Science Statistics (Physics) for the handlers.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: QSTD.c,v 1.6 2011/03/29 00:14:57 russell Exp $

Typedef Documentation

const unsigned int *(* DecodeSampleV0)(QSTD *qstd, QSTD_sampleV0 *sample, const unsigned int *dat, unsigned char bridge)

Signature to decode a statistics sample from the input data.

Returns:
The next decode location
Parameters:
qstd The QSTD context handle
sample The structure to receive the decoded data from
dat The input data
bridge The bridge word, contains decoding options


Function Documentation

static const unsigned int * decode_sampleV0_0 ( QSTD qstd,
QSTD_sampleV0 sample,
const unsigned int *  dat,
unsigned char  bridge 
) [static]

Decodes a format 0 sample record.

Returns:
The next address to decode from
Parameters:
qstd The decoding context
sample The data structure to receive the decoded statistics
dat The statistics data
bridge The record's bridge word

References _QSTD::cumulative, decode_statsV0_norm(), _QSTD::diff, QSSP_spanV0DecodeTwo(), _QSTD_sampleV0::span, _QSTD_sampleV0::stats, and _QSTD_sample::v0.

Referenced by qstd_sampleV0_decode().

static const unsigned int * decode_sampleV0_1 ( QSTD qstd,
QSTD_sampleV0 sample,
const unsigned int *  dat,
unsigned char  bridge 
) [static]

Decodes a format 1 sample record.

Returns:
The next address to decode from
Parameters:
qstd The decoding context
sample The data structure to receive the decoded statistics
dat The statistics data
bridge The record's bridge word

References _QSTD::cumulative, decode_statsV0_norm(), _QSTD::diff, QSSP_spanV0DecodeOne(), _QSTD_sampleV0::span, _QSTD_sampleV0::stats, and _QSTD_sample::v0.

Referenced by qstd_sampleV0_decode().

static const unsigned int * decode_sampleV0_2 ( QSTD qstd,
QSTD_sampleV0 sample,
const unsigned int *  dat,
unsigned char  bridge 
) [static]

Decodes a format 2 sample record.

Returns:
The next address to decode from
Parameters:
qstd The decoding context
sample The data structure to receive the decoded statistics
dat The statistics data
bridge The record's bridge word

References _QSTD::cumulative, decode_statsV0_diff(), _QSTD::diff, QSSP_spanV0DecodeDiff(), _QSTD_sampleV0::span, _QSTD_sampleV0::stats, and _QSTD_sample::v0.

Referenced by qstd_sampleV0_decode().

static const unsigned int * decode_statsV0_diff ( QSTD qstd,
QSTD_statisticsV0 stats,
const unsigned int *  dat,
unsigned char  bridge 
) [static]

Decodes the statistics in difference format.

Returns:
The next address to decode from
Parameters:
qstd The decoding context
stats The data structure to receive the decoded statistics
dat The statistics data
bridge The record's bridge word

References _QSTD_statisticsV0::cnts, _QSTD_statisticsV0::nonzero, _QSTD::sample, _QSTD_sampleV0::stats, and _QSTD_sample::v0.

Referenced by decode_sampleV0_2().

static const unsigned int * decode_statsV0_norm ( QSTD qstd,
QSTD_statisticsV0 stats,
const unsigned int *  dat,
unsigned char  bridge 
) [static]

Decodes a normal (not differenced) statistics record.

Returns:
The next address to decode from
Parameters:
qstd The decoding context
stats The data structure to receive the decoded statistics
dat The statistics data
bridge The record's bridge word

References _QSTD_statisticsV0::cnts, and _QSTD_statisticsV0::nonzero.

Referenced by decode_sampleV0_0(), and decode_sampleV0_1().

QSTD * QSTD_alloc ( void *  must_be_null  ) 

Allocates and constructs a QSTD handle.

Returns:
Pointer to the allocated handle
Parameters:
must_be_null Reserved for future use.

References QSTD_construct().

QSTD * QSTD_construct ( QSTD qstd,
void *  must_be_null 
)

The constructor for a QSTD control structure.

Returns:
Pointer to the QSTD control structure
Parameters:
qstd The control structure to be constructed. If NULL, a control structure will be allocated
must_be_null Reserved for future use.

References _QSTD_ctx::com, _QSTD::ctx, _QSTD::cumulative, _QSTD_ctx::cumulative, _QSTD::free, _QSTD::labelsHandlers, QSSP_ctxConstruct(), _QSTD_ctx::qstd, qstd_file_cache_get(), QSTD_labelsHandlersDefGet(), QSTD_sizeof(), QSTD_versionsHandlersDefGet(), and _QSTD::versionsHandlers.

Referenced by QSTD_alloc().

const QSTD_ctx * QSTD_ctxGet ( const QSTD qstd  ) 

Locates the statistics context (meta-data).

Parameters:
qstd The statistics context

References _QSTD::ctx.

void QSTD_destruct ( QSTD qstd  ) 

The destructor for a QSTD control structure.

Returns:
Pointer to the QSS control structure
Parameters:
qstd The control structure to be destructed.

References _QSTD::free.

static __inline QFCP_cache * qstd_file_cache_get ( void   )  [static]

Returns a pointer to the file cache.

Returns:
The file cache
This routine return the handle, creating it if necessary. This not really the right architecture. This needs to be part of a QSS global environment. This can't be accomplished at this time because it would require a backwardly incompatiable change to QSSP_construct.

References RND_8.

Referenced by QSTD_construct().

static __inline void qstd_sampleV0_add ( QSTD_sampleV0 dst,
const QSTD_sampleV0 src 
) [static]

Adds the source sample to the destination sample.

Parameters:
dst The destination sample
src The source sample

References _QSTD_statisticsV0::cnts, QSSP_spanV0Complete(), QSTD_TYPE_K_CUMULATIVE_END, _QSTD_sampleV0::span, _QSTD_sampleV0::stats, and _QSTD_sampleV0::type.

Referenced by qstd_sampleV0_decode().

static __inline int qstd_sampleV0_decode ( QSTD qstd,
unsigned int  type_id,
unsigned char  bridge,
const unsigned int *  dat 
) [static]

Decodes the statistics data.

Return values:
If not negative, then the sample type (QSTD_TYPE_K)
If negative
Parameters:
qstd The QSTD context handle
type_id 0 = just the set of values 1 = the difference between the current and last set
bridge bit 0 0 = normal record; 1 = global record
dat The statistics data

References _QSTD::ctx, _QSTD::cumulative, _QSTD_ctx::current, decode_sampleV0_0(), decode_sampleV0_1(), decode_sampleV0_2(), QSSP_spanV0Complete(), qstd_sampleV0_add(), QSTD_TYPE_K_CUMULATIVE_BEG, QSTD_TYPE_K_INCREMENTAL, _QSTD::sample, _QSTD_sampleV0::span, _QSTD_sampleV0::type, and _QSTD_sample::v0.

Referenced by QSTD_updateAtRecord().

int QSTD_sizeof ( void *  must_be_null  ) 

Returns the size, in bytes, of a QSTD control structure.

Returns:
The size, in bytes, of a QSTD control structure
Parameters:
must_be_null Parameter reserved for future use

Referenced by QSTD_construct().

int QSTD_updateAtContribution ( QSTD qstd,
const LSF_contribution *  ctb 
)

Updates the context at datagram time.

Return values:
If have a statistics sample contribution, the number of records in the contribution.
>0,if have a record contributor
=0,if have the contribution context
-1,if unrecognized
Parameters:
qstd The statistics context to update.
ctb The statistics contribution

const LSF_contribution * QSTD_updateAtDatagram ( QSTD qstd,
const LSF_datagram *  dgm 
)

int QSTD_updateAtRecord ( QSTD qstd,
const LSF_record *  rec 
)

Updates the context at record time.

Return values:
Non-negative values indicate are one of the QSTD_type's
Negative values indicate an unsuccessful update
Parameters:
qstd The statistics context to update.
rec The statistics record

References _QSTD::ctx, qstd_sampleV0_decode(), _QSTD_ctxVersions::sample, and _QSTD_ctx::version.


Generated on Mon Mar 28 17:16:51 2011 by  doxygen 1.5.8