From: hadaq Date: Wed, 16 Jun 2010 16:11:18 +0000 (+0000) Subject: Usage updated. Sergey. X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=87c27e877fda90ea242883aec9ad8c22c2fbb8f7;p=daqdata.git Usage updated. Sergey. --- diff --git a/hadaq/evtbuild.c b/hadaq/evtbuild.c index d31bd13..5a72626 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.109 2010-06-16 14:44:15 hadaq Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.110 2010-06-16 16:11:18 hadaq Exp $"; #define _POSIX_C_SOURCE 199309L #define SYSLOG_NAMES @@ -209,38 +209,58 @@ static void *appendFile(void *my, const char *path) 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: [--shmname shmem_name] extension of shared memory name to be opened"); - syslog(LOG_ERR, "Usage: [-a (agent)] [-p priority] [-I evtId]"); - syslog(LOG_ERR, "Usage: [-v debug|info|notice|warning|err|alert|crit|emerg]"); - syslog(LOG_ERR, "Usage: [--online] switch on online service (default off)"); - syslog(LOG_ERR, "Usage: [--filesize max_size] maximum size of output file in MB"); - syslog(LOG_ERR, "Usage: [--resdownscale downscale_factor] downscale factor for the res events"); - syslog(LOG_ERR, "Usage: [--resnumevents evt_num] maximum number of events in a resfile"); - syslog(LOG_ERR, "Usage: [--respath path] path for the res directory"); - syslog(LOG_ERR, "Usage: [--secsizelimit max_size] maximum size of second directory with the mirrored data [in MB]"); - syslog(LOG_ERR, "Usage: [--ressizelimit max_file_num] maximum number of files in res dir"); - syslog(LOG_ERR, "Usage: [--write_data path] path to the directory with mirrored data"); + syslog(LOG_ERR, " [-m nrOfMsgs] Number of data streams."); + syslog(LOG_ERR, " [-f slowCtrlFile ...]"); + syslog(LOG_ERR, " [-o outPath] Output path for writing data on the local hard disk."); + syslog(LOG_ERR, " [-d null|tape|file|stdout] Type of data output."); + syslog(LOG_ERR, " [-q queueSize] Size of the queue (shared memory segments) in Bytes."); + syslog(LOG_ERR, " [-Q queueNr:queueSize] Set different queue sizes for different queue numbers,"); + syslog(LOG_ERR, " example: -Q 2:1000000 -Q 4:4000000 -Q 5:12000000"); + syslog(LOG_ERR, " [-r runNumber]"); + syslog(LOG_ERR, " [--shmname shmem_name] Extension of shared memory segment name."); + syslog(LOG_ERR, " [-a (agent)] [-p priority]"); + syslog(LOG_ERR, " [-I evtId] Event Id can be set by Event Builder."); + syslog(LOG_ERR, " [--online] Switch on online service (default off)."); + syslog(LOG_ERR, " [--lustre path_to_lustre] Output path for writing data on the Lustre cluster (if mounted)."); + syslog(LOG_ERR, " [--orapath path] Path to eb_runinfo2ora.txt for writing data to Oracle."); + syslog(LOG_ERR, " [--ignore] Ignore trigger mismatch conditions."); + syslog(LOG_ERR, ""); + syslog(LOG_ERR, "Options for debugging:"); + syslog(LOG_ERR, " [-v debug|info|notice|warning|err|alert|crit|emerg]"); + syslog(LOG_ERR, " [--debug trignr] Print trigger numbers of discarded events."); + syslog(LOG_ERR, " [--debug errbit] Print error bits from the discarded events."); + syslog(LOG_ERR, " [--debug word] Print debug words from the discarded events."); + syslog(LOG_ERR, ""); + syslog(LOG_ERR, "Options for second data stream with a fraction of the data:"); + syslog(LOG_ERR, " [--filesize max_size] Maximum size of output file in MB."); + syslog(LOG_ERR, " [--resnumevents evt_num] Maximum number of events in a resfile"); + syslog(LOG_ERR, " [--respath path] Path for the res directory."); + syslog(LOG_ERR, " [--secsizelimit max_size] Maximum size of second directory with the mirrored data [in MB]."); + syslog(LOG_ERR, " [--ressizelimit max_file_num] Maximum number of files in res dir"); + syslog(LOG_ERR, " [--write_data path] Path to the directory with mirrored data."); + syslog(LOG_ERR, " [--resdownscale downscale_factor] downscale factor for the res events"); + syslog(LOG_ERR, ""); #ifdef RFIO - syslog(LOG_ERR, "Usage: [--rfio path_to_tape_archive] example: --rfio rfiodaq:gstore:/hadaqtest/test002"); - syslog(LOG_ERR, "Usage: [--rfiolustre path] example: --rfiolustre /lustre/hades/daq"); - syslog(LOG_ERR, "Usage: [--rfio_pcoption option] internal RFIO options (do not set anything if not sure)"); - syslog(LOG_ERR, - "Usage: [--rfio_icopymode mode] 0 : standard RFIO, ignore following arguments, 1 : copy the data to Lustre path after the file is written to a write cache (this is for the high data rates), 2 : for lustre only"); - syslog(LOG_ERR, - "Usage: [--rfio_icopyfrac frac] 0 : write only to a tape, i (>0) : copy each i-th file to lustre (pcCopyPath). If migration to a tape fails, ignore iCopyFraction and copy each file to lustre."); - syslog(LOG_ERR, - "Usage: [--rfio_imaxfile maxnum] 0 : no file number limit, i (>0) : maximum number of files to be written to a directory"); - syslog(LOG_ERR, "Usage: [--rfio_ipathconv conv] # 0 : default convention, 1 : HADES convention"); + syslog(LOG_ERR, "Options for writing to tape via RFIO:"); + syslog(LOG_ERR, " [--rfio pathToTapeArchive] Example: --rfio rfiodaq:gstore:/hadaqtest/test002"); + syslog(LOG_ERR, " [--rfiolustre path] Example: --rfiolustre /lustre/hades/daq"); + syslog(LOG_ERR, " [--rfio_pcoption option] Internal RFIO options (do not set anything if not sure)."); + syslog(LOG_ERR, " [--rfio_icopymode mode] 0 : Standard RFIO, ignore following arguments,"); + syslog(LOG_ERR, " 1 : copy the data to Lustre path after the file is written"); + syslog(LOG_ERR, " to a write cache (this is for the high data rates),"); + syslog(LOG_ERR, " 2 : for lustre only."); + syslog(LOG_ERR, " "); + syslog(LOG_ERR, " [--rfio_icopyfrac frac] 0 : Write only to a tape,"); + syslog(LOG_ERR, " i (>0) : copy each i-th file to lustre (pcCopyPath). If migration to"); + syslog(LOG_ERR, " a tape fails, ignore iCopyFraction and copy each file to lustre."); + syslog(LOG_ERR, " [--rfio_imaxfile maxnum] 0 : No file number limit,"); + syslog(LOG_ERR, " i (>0) : maximum number of files to be written to a directory."); + syslog(LOG_ERR, " [--rfio_ipathconv conv] 0 : default convention, 1 : HADES convention."); + syslog(LOG_ERR, ""); #endif - syslog(LOG_ERR, "Usage: [--buffstat] show fill levels of buffers"); - syslog(LOG_ERR, "Usage: [--epicsctrl] enable synch and distribution of RUN Id by Epics for parallel event builders"); - syslog(LOG_ERR, "Usage: [--lustre path_to_lustre] path to the file on the Lustre cluster"); - syslog(LOG_ERR, "Usage: [--ebnum] number of the event builder"); - syslog(LOG_ERR, "Usage: [--orapath path] path to eb_runinfo2ora.txt"); - syslog(LOG_ERR, "Usage: [--ignore] ignore trigger mismatch conditions"); + syslog(LOG_ERR, "Options for parallel EB:"); + syslog(LOG_ERR, " [--epicsctrl] Enable synch and distribution of RUN Id by Epics IOCsfor parallel EBs."); + syslog(LOG_ERR, " [--ebnum num] Number of the event builder."); } static int makeQueues(TheArgs *my) @@ -383,7 +403,6 @@ static void argsDefault(TheArgs *my) my->rfio_iMaxFile = 200; my->rfio_iPathConv = 0; strcpy(my->lustrePath, ""); - my->buffStat = 0; my->epicsCtrl = 0; my->ebnum = 0; my->ignore = 0; @@ -428,7 +447,6 @@ static int argsFromCL(TheArgs *my, int argc, char *argv[]) {"rfio_icopyfrac", 1, 0, 'F'}, {"rfio_imaxfile", 1, 0, 'X'}, {"rfio_ipathconv", 1, 0, 'C'}, - {"buffstat", 0, 0, 'b'}, {"epicsctrl", 0, 0, 'E'}, {"lustre", 1, 0, 'L'}, {"shmname", 1, 0, 'S'}, @@ -533,9 +551,6 @@ static int argsFromCL(TheArgs *my, int argc, char *argv[]) case 'S': strcpy(my->shmname, optarg); break; - case 'b': - my->buffStat = 1; - break; case 'E': my->epicsCtrl = 1; break; @@ -635,7 +650,7 @@ static int argsCheck(TheArgs *my) my->debug_trignr = 1; } else if (strcmp(my->debugOpts[i], "errbit") == 0) { my->debug_errbit = 1; - } else if (strcmp(my->debugOpts[i], "debugword") == 0) { + } else if (strcmp(my->debugOpts[i], "word") == 0) { my->debug_word = 1; } else { printf("Error: wrong argument is given in the option -D|--debug.\n"); @@ -884,139 +899,6 @@ static void add2Stat(TheArgs *theArgs, TheStats *my, float interval, ShmTrans ** } } -static void statsBufferDump(TheArgs *theArgs, TheStats *my, float interval, HadTuQueue **htuq, ShmTrans **shmtr, char *progName) -{ - static unsigned long lastEC2; - static unsigned long lastBW2; - - static time_t t0 = 0; - time_t t, dT; - int i, j; - int col = 0; - char emptybuffer[] = "-"; - int outputGraph = 1; - int outputNum = 0; - - if (theArgs->isStandalone && theArgs->buffStat) { - - t = time(NULL); - dT = t - t0; - - if (dT >= interval) { - - if (outputNum == 1) { - fputs("==============================================================================\n\n", stderr); - - for (i = 0; i < theArgs->nrOfMsgs; i++) { - - fprintf(stderr, "q[%2d]: ", i); - if (!HadTuQueue_empty(shmtr[i]->rdQueue)) - fprintf(stderr, "%8d ", HadTuQueue_size(shmtr[i]->rdQueue)); - else - fprintf(stderr, "%8s ", emptybuffer); - - col++; - if (col == 6) { - fputc('\n', stderr); - col = 0; - } - } - } - if (outputGraph == 1) { - fputs("------------------ buffer fill levels ----------------------------------------\n", stderr); - - float buffSize, queueSize; - int maxnorm = 10.; - - for (j = 0; j < maxnorm; j++) { - fprintf(stderr, "%1d ", maxnorm - j - 1); - for (i = 0; i < theArgs->nrOfMsgs; i++) { - buffSize = 2 * theArgs->queueSize[i]; - queueSize = HadTuQueue_size(shmtr[i]->rdQueue); - - if (maxnorm - maxnorm * queueSize / buffSize < j) { - if (!HadTuQueue_empty(shmtr[i]->rdQueue)) - fputc('|', stderr); - else - fputc('-', stderr); - - } else { - fputc(' ', stderr); - } - } - fputc('\n', stderr); - } - - /* The following is just to print the numbers of buffers */ - int factor, mod; - - fputs("q:", stderr); - factor = 0; - for (i = 0; i < theArgs->nrOfMsgs; i++) { - mod = i % 10; - fprintf(stderr, "%1d", mod); - } - fputc('\n', stderr); - - fputs(" ", stderr); - for (i = 0; i < theArgs->nrOfMsgs; i++) { - mod = i % 10; - if (mod == 0) - fprintf(stderr, "%1d", i / 10); - else - fputc(' ', stderr); - } - fputc('\n', stderr); - fputs("------------------------------------------------------------------------------\n", stderr); - - /* Print Trigger Numbers for all queues */ - char trigNum[theArgs->nrOfMsgs][10]; - - for (i = 0; i < theArgs->nrOfMsgs; i++) { - sprintf(trigNum[i], "%08x", *my->trigNr[i]); - } - - for (j = 0; j < 8; j++) { - fputc(' ', stderr); - fputc(' ', stderr); - for (i = 0; i < theArgs->nrOfMsgs; i++) { - fprintf(stderr, "%c", trigNum[i][j]); - } - fputc('\n', stderr); - } - fputs("------------------------------------------------------------------------------\n", stderr); - - fprintf(stderr, "%7s:%6s", "evtComp", unit(*my->evtsComplete)); - if (dT > 0) - fprintf(stderr, "%10s:%6s", " evtComp/s", unit((*my->evtsComplete - lastEC2) / dT)); - fprintf(stderr, "%10s:%6s", " bytesWrit", unit(*my->bytesWritten)); - if (dT > 0) - fprintf(stderr, "%12s:%6s", " bytesWrit/s", unit((*my->bytesWritten - lastBW2) / dT)); - fputc('\n', stderr); - fprintf(stderr, "%7s:%6s", "evtDisc", unit(*my->evtsDiscarded)); - fprintf(stderr, "%10s:%6s", " evtDatErr", unit(*my->evtsDataError)); - fprintf(stderr, "%10s:%6s", " evtTagErr", unit(*my->evtsTagError)); - - fputc('\n', stderr); - - lastEC2 = *my->evtsComplete; - lastBW2 = *my->bytesWritten; - - /* get wall-clock time */ - printTime(); - - unsigned long runId2print; - char buf[_POSIX_PATH_MAX]; - sprintf(buf, "%s%s", "daq_evtbuild", theArgs->shmname); - Worker_getStatistic(buf, "runId", &runId2print); - printf("ioc: RUN Id = %lu RUN Nr = %lu\n", runId2print, runNr); - } - } - - t0 = t; - } -} - unsigned long getRunId(TheArgs *my) { unsigned long myRunId = 0; @@ -1089,7 +971,7 @@ static void statsDump(TheArgs *theArgs, TheStats *my, int interval) fprintf(stderr, "%17s:%6s", "evtsComplete/s", unit((*my->evtsComplete - lastEC) / dT)); fprintf(stderr, "%17s:%6s", "evtsDiscarded", unit(*my->evtsDiscarded)); fprintf(stderr, "%17s:%6s", "evtsDiscarded/s", unit((*my->evtsDiscarded - lastED) / dT)); - fprintf(stderr, "%17s:%7s", "bytesWritten", unit(*my->bytesWritten)); + fprintf(stderr, "%17s:%6s", "bytesWritten", unit(*my->bytesWritten)); fputc('\n', stderr); fprintf(stderr, "%13s:%6s", "evtsDataError", unit(*my->evtsDataError)); fprintf(stderr, "%17s:%6s", "evtsDataError/s", unit((*my->evtsDataError - lastEE) / dT)); @@ -1102,7 +984,7 @@ static void statsDump(TheArgs *theArgs, TheStats *my, int interval) fprintf(stderr, "%17s:%6s", "evtsComplete/s", "0"); fprintf(stderr, "%17s:%6s", "evtsDiscarded", unit(*my->evtsDiscarded)); fprintf(stderr, "%17s:%6s", "evtsDiscarded/s", "0"); - fprintf(stderr, "%17s:%7s", "bytesWritten", unit(*my->bytesWritten)); + fprintf(stderr, "%17s:%6s", "bytesWritten", unit(*my->bytesWritten)); fputc('\n', stderr); fprintf(stderr, "%13s:%6s", "evtsDataError", unit(*my->evtsDataError)); fprintf(stderr, "%17s:%6s", "evtsDataError/s", "0"); @@ -2029,7 +1911,6 @@ int main(int argc, char *argv[]) int tagError = 0; add2Stat(theArgs, theStats, 1, shmTrans); - statsBufferDump(theArgs, theStats, 1, hadTuQueue, shmTrans, argv[0]); statsDump(theArgs, theStats, 1); if (*theStats->bytesWritten == 0) {