-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.51 2002-11-14 17:24:02 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.52 2002-11-18 09:47:21 hadaq Exp $";
#define _POSIX_C_SOURCE 199309L
#include "shmtrans.h"
#include "ansiTape.h"
-#define NTRIGTYPES 64UL /* must be 2^n */
-#define NTRIGTYPES_IN_FILE 16 /* must be 2^n */
+#define NTRIGTYPES 64UL /* must be 2^n */
+#define NTRIGTYPES_IN_FILE 16 /* must be 2^n */
static time_t ourTime;
unsigned long priority;
unsigned long queueSize;
char verbosity[PARAM_MAX_VALUE_LEN];
-} TheArgs;
+}
+
+TheArgs;
typedef struct TheStatsS {
unsigned long *evtsDiscarded;
unsigned long *bytesWritten;
unsigned long *triggerType[NTRIGTYPES];
unsigned long *trigNr[32];
-} TheStats;
+}
+
+TheStats;
static jmp_buf terminateJmp;
syslog(LOG_ERR, "Usage: [-a (agent)] [-p priority]");
}
-static void argsDump(TheArgs *my) {
+static void argsDump(TheArgs * my)
+{
int i;
syslog(LOG_DEBUG, "nrOfMsgs: %d", my->nrOfMsgs);
syslog(LOG_DEBUG, "verbosity: %s", my->verbosity);
}
-static void argsDefault(TheArgs *my) {
+static void argsDefault(TheArgs * my)
+{
int i;
my->nrOfMsgs = 0;
strcpy(my->verbosity, "info");
}
-static int argsFromCL(TheArgs *my, int argc, char *argv[]) {
+static int argsFromCL(TheArgs * my, int argc, char *argv[])
+{
extern char *optarg;
int i;
break;
case 's':
syslog(LOG_WARNING,
- "-s option obsolete, will be removed in a future version");
+ "-s option obsolete, will be removed in a future version");
break;
case 'o':
strcpy(my->outPath, optarg);
return 0;
}
-static int argsFromParam(TheArgs *my, int argc, char *argv[]) {
+static int argsFromParam(TheArgs * my, int argc, char *argv[])
+{
Param paramS, *param = ¶mS;
int paramWasFound;
Param_getInt(param, argv[0], "nrofmsgs", ¶mWasFound, &my->nrOfMsgs);
Param_getStringArray(param, argv[0], "slwctrlfile",
- PARAM_MAX_ARRAY_LEN, &my->slowCtrlFileCnt, my->slowCtrlFiles);
+ PARAM_MAX_ARRAY_LEN, &my->slowCtrlFileCnt, my->slowCtrlFiles);
Param_getString(param, argv[0], "outpath", ¶mWasFound, my->outPath);
Param_getString(param, argv[0], "outdev", ¶mWasFound, my->outDev);
Param_getInt(param, argv[0], "runnr", ¶mWasFound, &my->runNr);
desParam(param);
}
-static char *unit(unsigned long v) {
+static char *unit(unsigned long v)
+{
static char retVal[6];
static char u[] = " kM";
int i;
return retVal;
}
-static void statsDump(TheArgs *theArgs, TheStats *my, int interval) {
+static void statsDump(TheArgs * theArgs, TheStats * my, int interval)
+{
static unsigned long lastEC;
static unsigned long lastEE;
static unsigned long lastTE;
time_t dT;
int i;
-
+
if (theArgs->isStandalone
&& strcmp(theArgs->verbosity, "info") == 0
&& (dT = (time(NULL) - lastTime)) >= interval
- ) {
+ ) {
int col = 0;
fputs("==============================================================================\n", stderr);
if (col != 0) {
fputc('\n', stderr);
}
-
lastTime += dT;
}
}
-static void storeInfoStart(const char *n, time_t t, TheArgs *my) {
+static void storeInfoStart(const char *n, time_t t, TheArgs * my)
+{
Param pS, *p = &pS;
int i;
char s[20];
desParam(p);
}
-static void storeInfoStop(const char *n, time_t t, Worker *w) {
+static void storeInfoStop(const char *n, time_t t, Worker *w)
+{
Param pS, *p = &pS;
int i;
char s[20];
conSetupParam(p, getenv("DAQ_SETUP"));
- for ( i = 0; i < 32 && strcmp(w->statistics[i].name, "") != 0; i++) {
+ for (i = 0; i < 32 && strcmp(w->statistics[i].name, "") != 0; i++) {
Param_storeInt(p, n, w->statistics[i].name, w->statistics[i].value);
}
strftime(s, 20, "%Y-%m-%dT%H:%M:%S", localtime(&t));
ourTime = time(NULL);
- openlog(argv[0], LOG_PID|LOG_PERROR, LOG_LOCAL0);
+ openlog(argv[0], LOG_PID | LOG_PERROR, LOG_LOCAL0);
setlogmask(LOG_UPTO(LOG_INFO));
usage(argv[0]);
exit(EXIT_FAILURE);
}
-
for (i = 0; prioritynames[i].c_name != NULL
- && 0 != strcmp(prioritynames[i].c_name, theArgs->verbosity); i++) {
+ && 0 != strcmp(prioritynames[i].c_name, theArgs->verbosity); i++) {
}
if (prioritynames[i].c_name == NULL) {
exit(EXIT_FAILURE);
syslog(LOG_ERR, "%s, %d: %s", __FILE__, __LINE__, strerror(errno));
exit(EXIT_FAILURE);
}
-
outTape = NULL;
outFile = NULL;
if (strcmp(theArgs->outDev, "null") == 0) {
syslog(LOG_WARNING, "unable to initialize online service");
}
if (theArgs->nrOfMsgs == 0) {
- /*
+ /*
no '-m' option was on command line, we assume that the
readout task (daq_readout) is running on the same node and
communicates directly via shared memory
for (i = 0; i < theArgs->nrOfMsgs && !evtIsBroken; i += step) {
uint32_t trigNr;
uint32_t trigTag;
-
+
if (hadTuQueue[i] == NULL) {
void *storage;
subEvt = HadTuQueue_front(hadTuQueue[i]);
#ifndef NDEBUG
syslog(LOG_DEBUG,
- "hadTuQueue[%d]: %p = subEvt: %s",
- i, subEvt, SubEvt_2charP(subEvt));
+ "hadTuQueue[%d]: %p = subEvt: %s",
+ i, subEvt, SubEvt_2charP(subEvt));
#endif
(*theStats->trigNr[i]) = SubEvt_trigNr(subEvt);
currTrigTag = SubEvt_trigNr(subEvt) & 0xff;
currId = SubEvt_pureId(subEvt);
#ifndef NDEBUG
- syslog(LOG_DEBUG,
- "currTrigNr: 0x%06x, currTrigTag 0x%02x, currId 0x%08x", currTrigNr, currTrigTag, currId);
+ syslog(LOG_DEBUG,
+ "currTrigNr: 0x%06x, currTrigTag 0x%02x, currId 0x%08x", currTrigNr, currTrigTag, currId);
#endif
}
-
trigNr = SubEvt_trigNr(subEvt) >> 8;
trigTag = SubEvt_trigNr(subEvt) & 0xff;
if (trigNr == currTrigNr) {
Evt_setDataError(evt);
(*theStats->evtsTagError)++;
}
-
(*theStats->triggerType[currId & (NTRIGTYPES - 1)])++;
Evt_setId(evt, currId & (NTRIGTYPES_IN_FILE - 1));