GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> GRBP / V1-0-4 > grbp_msg_test / rhel4-32


Interface   Data Structures   File List   Data Fields   Globals  

grbp_msg_test.c File Reference

Program to create a fake set of messages. Used to test the ability to write message files and test resequencing. More...

#include <GRBP_pktdef.h>
#include <GRBP_msgdef.h>
#include <GRB/GRB_pktdef.h>
#include <GRBP/io/GRB_stream.h>
#include <stdio.h>
#include <stdlib.h>

Classes

struct  _Pkt
 A packet of 50 messages. More...

Typedefs

typedef struct _Pkt Pkt
 Typedef for struct _Pkt.

Functions

int main (int argc, const char *argv[])
 Entry point to the GRB message testing program.
static __inline int pick (int idx)
 Picks which buffer to use. Currently it just alternates.
static __inline int set_limits (int which, int previous)
 Sets the number of messages to put into a packet. This cannot be greater than the maximum allowed by the packet (currently 50).
static void report_usage (void)
 Reports on how to use this program.


Detailed Description

Program to create a fake set of messages. Used to test the ability to write message files and test resequencing.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: grbp_msg_test.c,v 1.3 2011/03/30 22:11:50 russell Exp $

This not so much a test program as a template to show how to write a program that might do something more meaningful. In its current instantiation it writes 1000 pseudo-messages to two message packets in groups of 25 messages, with every other message going to every other packet. Thus the output represents an idealized situation, whereby every other packet comes from every other EPU and every other event in the source stream goes to every other packet.

Changes that would like be made include

  1. A more sophisticated version of the packet picking routine. This would allow one randomize the order in which packets appear to be received by the reader (the SIU).

  1. A more sophisticated version of setting the limit of the number of messages to commit to a packet before that packet is written to the output stream. This would allow one to simulate the effect the EPU flushing the packet to the SIU on a timeout rather than a message count.

  1. Replace the standard message (a GRBP_msg) with one of your own. This would allow one to simulate a packet stream with your own message contents. To do this, one would have to replace the routine GRBP_pktMsgAdd with your own version. It is pretty simply, so should be fairly easy.

The end use is ultimately to produce a realistic packet stream that one can use to exercise the code, running on the SIU, that will merge the packets from the two EPU sources and resort the messages back into the order that they were conceived in.


Function Documentation

int main ( int  argc,
const char *  argv[] 
)

Entry point to the GRB message testing program.

Usage is

      $ grbp_msg <file-name>

        where file-name is the name of the file to write. By convention
        the extension is .grb.

References GRB_STREAM_TYPE_K_FILE, GRBP__pktMsgAdd(), _GRBP_pkt::hdr, pick(), report_usage(), and set_limits().

static __inline int pick ( int  idx  )  [static]

Picks which buffer to use. Currently it just alternates.

Returns:
A packet index (0 or 1)
Parameters:
idx The event index
A more sophisticated version of this would allow one to introduce a randomization into which packet the event was destined.

Referenced by main().

static __inline int set_limits ( int  which,
int  previous 
) [static]

Sets the number of messages to put into a packet. This cannot be greater than the maximum allowed by the packet (currently 50).

Returns:
A value between 1 and the maximum allowed, currently 50
Parameters:
which Which packet the limit is being calculated for
previous The previous limit
A more sophisticated version of this would allow on to introduce a randomization into the number of messages to go into a packet. By varying this value, one could somewhat simulate the effect of a timeout when sending a packet from the EPU to the SIU

Referenced by main().


Generated on Fri Sep 30 19:28:00 2011 by  doxygen 1.5.8