From: hadaq Date: Wed, 18 Aug 2004 09:58:28 +0000 (+0000) Subject: max file size as parameter X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=94970fbb03e76da72181c19abcf7d98ec89c5bdd;p=daqdata.git max file size as parameter --- diff --git a/hadaq/evtbuild.c b/hadaq/evtbuild.c index 3ed0b56..74cef43 100644 --- a/hadaq/evtbuild.c +++ b/hadaq/evtbuild.c @@ -1,4 +1,4 @@ -static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.70 2004-08-16 11:25:53 hadaq Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.71 2004-08-18 09:58:28 hadaq Exp $"; #define _POSIX_C_SOURCE 199309L @@ -54,6 +54,7 @@ typedef struct TheArgsS { unsigned long queueSize; char verbosity[PARAM_MAX_VALUE_LEN]; unsigned long evtId; + off_t maxFileSz; } TheArgs; typedef struct TheStatsS { @@ -118,7 +119,9 @@ static void usage(const char *progName) syslog(LOG_ERR, "Usage: %s [-x expId]", progName); syslog(LOG_ERR, "Usage: [-m nrOfMsgs] [-f slowCtrlFile ...]"); syslog(LOG_ERR, "Usage: [-o outPath] [-d null|tape|file|stdout]"); + syslog(LOG_ERR, "Usage: [-q queueSize] [-r runNumber]"); syslog(LOG_ERR, "Usage: [-a (agent)] [-p priority] [-I evtId]"); + syslog(LOG_ERR, "Usage: [-v debug|info|notice|warning|err|alert|crit|emerg]"); } static void argsDump(TheArgs *my) @@ -137,7 +140,8 @@ static void argsDump(TheArgs *my) syslog(LOG_DEBUG, "isStandalone: %d", my->isStandalone); syslog(LOG_DEBUG, "queueSize: %d", my->queueSize); syslog(LOG_DEBUG, "verbosity: %s", my->verbosity); - syslog(LOG_DEBUG, "evtId: %s", my->evtId); + syslog(LOG_DEBUG, "evtId: %ld", my->evtId); + syslog(LOG_DEBUG, "maxFileSz: %ld", my->maxFileSz); } static void argsDefault(TheArgs *my) @@ -157,6 +161,7 @@ static void argsDefault(TheArgs *my) my->queueSize = 1 * 1024 * 1024; strcpy(my->verbosity, "info"); my->evtId = 0; + my->maxFileSz = (2 * 1024 * 1024 * 1024UL); } static int argsFromCL(TheArgs *my, int argc, char *argv[]) @@ -164,7 +169,7 @@ static int argsFromCL(TheArgs *my, int argc, char *argv[]) extern char *optarg; int i; - while ((i = getopt(argc, argv, "am:f:s:r:o:d:q:p:v:x:I:")) != -1) { + while ((i = getopt(argc, argv, "am:f:s:r:o:d:q:p:v:x:I:S:")) != -1) { switch (i) { case 'm': my->nrOfMsgs = strtoul(optarg, NULL, 0); @@ -199,6 +204,9 @@ static int argsFromCL(TheArgs *my, int argc, char *argv[]) case 'I': my->evtId = strtoul(optarg, NULL, 0); break; + case 'S': + my->maxFileSz = strtoul(optarg, NULL, 0); + break; default: return -1; break; @@ -226,6 +234,7 @@ static int argsFromParam(TheArgs *my, int argc, char *argv[]) Param_getInt(param, name, "qsize", ¶mWasFound, &my->queueSize); Param_getString(param, name, "verb", ¶mWasFound, my->verbosity); Param_getInt(param, name, "evtid", ¶mWasFound, &my->evtId); + Param_getInt(param, name, "maxfilesz", ¶mWasFound, &my->maxFileSz); desParam(param); } @@ -463,7 +472,6 @@ int main(int argc, char *argv[]) ShmTrans **shmTrans; HadTuQueue **hadTuQueue; Worker *worker; - off_t maxFileSize; int scanWasSuccessful; uint32_t currTrigNr; @@ -549,7 +557,6 @@ int main(int argc, char *argv[]) Worker_initEnd(worker); currId = 0; - maxFileSize = (2 * 1024 * 1024 * 1024UL) - theArgs->queueSize; while (setjmp(terminateJmp) == 0) { void *evt; void *subEvt; @@ -655,7 +662,7 @@ int main(int argc, char *argv[]) (*theStats->evtsDiscarded)++; } deleteEvt(evt); - if (*theStats->bytesWritten >= maxFileSize) { + if (*theStats->bytesWritten >= theArgs->maxFileSz - theArgs->queueSize) { evt = newEvt(EvtDecoding_64bitAligned, EvtId_runStop); for (i = 0; i < theArgs->slowCtrlFileCnt; i++) { evt = appendFile(evt, theArgs->slowCtrlFiles[i]);