]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
Fixed the output format for printf. Sergey.
authorhadaq <hadaq>
Mon, 14 Feb 2011 13:59:40 +0000 (13:59 +0000)
committerhadaq <hadaq>
Mon, 14 Feb 2011 13:59:40 +0000 (13:59 +0000)
hadaq/args.c
hadaq/args.h
hadaq/debug.c
hadaq/evtbuild.c
hadaq/logger.c
hadaq/netmem.c
hadaq/stats.c

index f031a3dd4f7017f76f889f9982d78650f2965d36..f426a71d431c57f662d714dfcc3b2b7d090defbc 100644 (file)
@@ -15,11 +15,11 @@ static int makeTrigType(TheArgs *my)
 {
        int retVal = 0;
 
-       if (0 == (sscanf(my->trigType, "%x:%x:%x", &my->subsysId, &my->wordNr, &my->bitMask))) {
+       if (0 == (sscanf(my->trigType, "%lx:%lx:%lx", &my->subsysId, &my->wordNr, &my->bitMask))) {
                syslog(LOG_ERR, "evtbuild.c: makeTrigType: %s", "trigtype option is wrong.");
                retVal = -1;
        }
-       printf("TrigType: 0x%x 0x%x 0x%x\n", my->subsysId, my->wordNr, my->bitMask);
+       printf("TrigType: 0x%lx 0x%lx 0x%lx\n", my->subsysId, my->wordNr, my->bitMask);
 
        /* 
         * Count trailing zeros in the bit mask
index d2afb0e52d170707c04e089acc0c7362830a9af8..d7f976b84eacf995fbe499b99c11f5bf71044ece 100644 (file)
@@ -62,7 +62,6 @@ typedef struct TheArgsS {
        unsigned short rfio_iMaxFile;
        unsigned short rfio_iPathConv;
        char lustrePath[PARAM_MAX_VALUE_LEN];
-       unsigned short buffStat;
        unsigned short epicsCtrl;
        unsigned short ignore;          /* ignore all trigger mismatch conditions */
        char shmname[PARAM_MAX_VALUE_LEN];
index a0db7a67f2cd91b01455376264282e50efda7238..21409cb61103e1213d0360dc528938883b58cbcc 100644 (file)
@@ -89,7 +89,7 @@ void Debug_print(TheArgs *theArgs, TheStats *theStats, TheDebug * theDebug)
        if (theArgs->debug_trignr) {
                printf("%7s", "trigNr");
                for (i = 0; i < theArgs->nrOfMsgs; i++) {
-                       printf(" %08x", theDebug->evtsLastBuilt[i]);
+                       printf(" %08lx", theDebug->evtsLastBuilt[i]);
                }
                printf("\n");
        }
@@ -108,7 +108,7 @@ void Debug_print(TheArgs *theArgs, TheStats *theStats, TheDebug * theDebug)
                        printf("%7s", "trigNr");
                        for (i = 0; i < theArgs->nrOfMsgs; i++) {
                                if (j < theDebug->evtsBrokenCnt[i]) {
-                                       printf(" %08x", theDebug->evtsBroken[i][j]);
+                                       printf(" %08lx", theDebug->evtsBroken[i][j]);
                                } else {
                                        printf("%9s", "-");
                                }
@@ -121,7 +121,7 @@ void Debug_print(TheArgs *theArgs, TheStats *theStats, TheDebug * theDebug)
                        printf("%7s", "size");
                        for (i = 0; i < theArgs->nrOfMsgs; i++) {
                                if (j < theDebug->debugSizesCnt[i]) {
-                                       printf(" %08x", theDebug->debugSizes[i][j]);
+                                       printf(" %08lx", theDebug->debugSizes[i][j]);
                                } else {
                                        printf("%9s", "-");
                                }
@@ -134,7 +134,7 @@ void Debug_print(TheArgs *theArgs, TheStats *theStats, TheDebug * theDebug)
                        printf("%7s", "errBit");
                        for (i = 0; i < theArgs->nrOfMsgs; i++) {
                                if (j < theDebug->errBitsCnt[i]) {
-                                       printf(" %08x", theDebug->errBits[i][j]);
+                                       printf(" %08lx", theDebug->errBits[i][j]);
                                } else {
                                        printf("%9s", "-");
                                }
@@ -147,7 +147,7 @@ void Debug_print(TheArgs *theArgs, TheStats *theStats, TheDebug * theDebug)
                        printf("%7s", "debug");
                        for (i = 0; i < theArgs->nrOfMsgs; i++) {
                                if (j < theDebug->debugWordsCnt[i] && theDebug->debugWords[i][j] != 0) {
-                                       printf(" %08x", theDebug->debugWords[i][j]);
+                                       printf(" %08lx", theDebug->debugWords[i][j]);
                                } else {
                                        printf("%9s", "-");
                                }
@@ -160,7 +160,7 @@ void Debug_print(TheArgs *theArgs, TheStats *theStats, TheDebug * theDebug)
        if (theArgs->debug_trignr) {
                printf("%7s", "trigNr");
                for (i = 0; i < theArgs->nrOfMsgs; i++) {
-                       printf(" %08x", *theStats->trigNr[i]);
+                       printf(" %08lx", *theStats->trigNr[i]);
                }
                printf("\n");
        }
@@ -169,7 +169,7 @@ void Debug_print(TheArgs *theArgs, TheStats *theStats, TheDebug * theDebug)
        if (theArgs->debug_size) {
                printf("%7s", "size");
                for (i = 0; i < theArgs->nrOfMsgs; i++) {
-                       printf(" %08x", *theStats->debugSize[i]);
+                       printf(" %08lx", *theStats->debugSize[i]);
                }
                printf("\n");
        }
@@ -211,7 +211,7 @@ void Debug_printPopTrigMismatch(TheArgs *theArgs, TheStats *theStats, TheDebug *
                if (theArgs->debug_trignr) {
                        printf("%7s", "trigNr");
                        for (i = 0; i < theArgs->nrOfMsgs; i++) {
-                               printf(" %08x", theDebug->evtsLastBuilt[i]);
+                               printf(" %08lx", theDebug->evtsLastBuilt[i]);
                        }
                        printf("\n");
                }
@@ -229,7 +229,7 @@ void Debug_printPopTrigMismatch(TheArgs *theArgs, TheStats *theStats, TheDebug *
                                printf("%7s", "trigNr");
                                for (i = 0; i < theArgs->nrOfMsgs; i++) {
                                        if (j < theDebug->evtsBrokenCnt[i]) {
-                                               printf(" %08x", theDebug->evtsBroken[i][j]);
+                                               printf(" %08lx", theDebug->evtsBroken[i][j]);
                                        } else {
                                                printf("%9s", "-");
                                        }
@@ -242,7 +242,7 @@ void Debug_printPopTrigMismatch(TheArgs *theArgs, TheStats *theStats, TheDebug *
        printf("%7s", "lastNr");
        for (i = 0; i < theArgs->nrOfMsgs; i++) {
                if (i <= qi) {
-                       printf(" %08x", (*theStats->trigNr[i]));
+                       printf(" %08lx", (*theStats->trigNr[i]));
                } else {
                        printf("%9s", "-");
                }
@@ -274,7 +274,7 @@ void Debug_printBrokenTrigMismatch(TheArgs *theArgs, TheStats *theStats)
 
        printf("%7s", "lastNr");
        for (i = 0; i < theArgs->nrOfMsgs; i++) {
-               printf(" %08x", (*theStats->trigNr[i]));
+               printf(" %08lx", (*theStats->trigNr[i]));
        }
 
        printf("\n\n");
index 7d5c45cf0942cf53ccd17cedf6ac8ce3c59a69d4..623318c2e364d750e5db51ac8a3de253a97919f2 100644 (file)
@@ -1,8 +1,8 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.144 2010-12-07 17:33:16 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.145 2011-02-14 13:59:40 hadaq Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #define SYSLOG_NAMES
-#define RFIO
+/* #define RFIO */
 
 #include <unistd.h>
 #include <getopt.h>
@@ -462,7 +462,7 @@ static void changeDisk(int once, TheArgs *theArgs, TheStats *theStats)
                        } else {
                                (*theStats->diskNrEB) = diskNr;
 
-                               sprintf(newOutPath, "/data%02d", diskNr);
+                               sprintf(newOutPath, "/data%02lu", diskNr);
 
                                tmpstr = strReplace(theArgs->outPath, ebOutPath, newOutPath);
                                strcpy(theArgs->outPath, tmpstr);
index 5afd0c32bdbc4bc2661783f6f86070e147fc642e..b7e01fefee6fc9d4ad6a4accc54e303fda21393b 100644 (file)
@@ -15,7 +15,7 @@ static char *unit(unsigned long v)
 
        for (i = 0; v >= 10000 && i < sizeof(u) - 2; v /= 1000, i++) {
        }
-       sprintf(retVal, "%4d%c", v, u[i]);
+       sprintf(retVal, "%4lu%c", v, u[i]);
 
        return retVal;
 }
@@ -45,7 +45,7 @@ void storeRunInfoStart(time_t t, TheArgs *myArgs)
        strftime(ltime, 20, "%Y-%m-%d %H:%M:%S", localtime(&t));
 
        fp = fopen(myArgs->runinfo2ora, "a+");
-       fprintf(fp, "start %d %d %s %s\n", myArgs->runNr, myArgs->ebnum, myArgs->fileName, ltime);
+       fprintf(fp, "start %lu %d %s %s\n", myArgs->runNr, myArgs->ebnum, myArgs->fileName, ltime);
        fclose(fp);
 }
 
@@ -61,7 +61,7 @@ void storeRunInfoStop(time_t t, TheArgs *myArgs, TheStats *myStats)
        strftime(ltime, 20, "%Y-%m-%d %H:%M:%S", localtime(&t));
 
        fp = fopen(myArgs->runinfo2ora, "a+");
-       fprintf(fp, "stop %d %d %s %s %s ", myArgs->runNr, myArgs->ebnum, myArgs->fileName, ltime, unit(*myStats->evtsComplete));
+       fprintf(fp, "stop %lu %d %s %s %s ", myArgs->runNr, myArgs->ebnum, myArgs->fileName, ltime, unit(*myStats->evtsComplete));
        fprintf(fp, "%s\n", unit(*myStats->bytesWritten));
        fclose(fp);
 }
index 1527a391d7c1ab51f707477cf12ee06090dde77e..83eb9ea4b745c952c5e318b438a8a5fcebe27804 100644 (file)
@@ -1,4 +1,4 @@
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/netmem.c,v 6.49 2010-10-08 13:55:17 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/netmem.c,v 6.50 2011-02-14 13:59:40 hadaq Exp $";
 
 #define _POSIX_C_SOURCE 199309L
 #define SYSLOG_NAMES
@@ -274,7 +274,7 @@ static char *unit(unsigned long v)
 
        for (i = 0; v >= 10000 && i < sizeof(u) - 2; v /= 1000, i++) {
        }
-       sprintf(retVal, "%4d%c", v, u[i]);
+       sprintf(retVal, "%4lu%c", v, u[i]);
 
        return retVal;
 }
@@ -327,7 +327,7 @@ static int checkDataSources(TheArgs *theArgs, TheStats *theStats)
                if (ready2check) {
                        for (i = 0; i < theArgs->nrOfMsgs; i++) {
                                if (dataSources[i] == 0) {
-                                       sprintf(msglog, "<E> daq_netmem: source %d, port %d: no data received.", i, theArgs->portNr[i]);
+                                       sprintf(msglog, "<E> daq_netmem: source %d, port %lu: no data received.", i, theArgs->portNr[i]);
                                        fprintf(stderr, "%s\n", msglog);
                                        storeLogInfo(theArgs, msglog);
 
@@ -466,7 +466,7 @@ static void add2Stat(TheArgs *theArgs, TheStats *my, float interval, ShmTrans **
                        fillLevel = (unsigned long) (100 * queueSize + 0.5) / buffSize;
                        (*my->netmemBuff[i]) = fillLevel;
 
-                       printf("%3d", fillLevel);
+                       printf("%3lu", fillLevel);
 
                        /* Add more statistic for recv bytes per second */
                        if (*nettr[i]->bytesReceived - lastBytesRecv[i] > 0) {
@@ -515,7 +515,7 @@ static void statsDump(TheArgs *theArgs, NetTrans **my, int interval)
 
                fputs("==============================================================================\n", stderr);
                for (i = 0; i < theArgs->nrOfMsgs; i++) {
-                       printf("port:%6d ------------------------------------------------------------------\n", theArgs->portNr[i]);
+                       printf("port:%6lu ------------------------------------------------------------------\n", theArgs->portNr[i]);
                        fprintf(stderr, "%17s%02d:%6s", "pktsReceived", i, unit(*my[i]->pktsReceived));
                        fprintf(stderr, "%17s%02d:%6s", "pktsDiscarded", i, unit(*my[i]->pktsDiscarded));
                        fprintf(stderr, "%15s%02d  :%6s", "bytesReceived", i, unit(*my[i]->bytesReceived));
index 66db001662f139111e2e83bdcf4716fa25568a76..a38b1a7abdde9a7f20a6b8c97fb61787df1ef0e7 100644 (file)
@@ -14,7 +14,7 @@ static char *unit(unsigned long v)
 
        for (i = 0; v >= 10000 && i < sizeof(u) - 2; v /= 1000, i++) {
        }
-       sprintf(retVal, "%4d%c", v, u[i]);
+       sprintf(retVal, "%4lu%c", v, u[i]);
 
        return retVal;
 }
@@ -85,7 +85,7 @@ void Stats_buffFillLvls(TheArgs *theArgs, TheStats *my, float interval, ShmTrans
                        fillLevel = (unsigned long) (100. * queueSize + 0.5) / buffSize;
                        (*my->evtbuildBuff[i]) = fillLevel;
 
-                       printf("%3d", fillLevel);
+                       printf("%3lu", fillLevel);
                }
                t_0 = t;
 
@@ -112,13 +112,14 @@ void Stats_dump(TheArgs *theArgs, TheStats *my, int interval)
 
        char msglog[300];
 
-       if (theArgs->isStandalone && strcmp(theArgs->verbosity, "info") == 0 && !(theArgs->buffStat)) {
+       if (theArgs->isStandalone && strcmp(theArgs->verbosity, "info") == 0) {
                t = time(NULL);
                dT = t - t0;
+
                if (dT >= interval) {
 
                        if (theArgs->multiDisks)
-                               printf("Write data to disk nr %d\n", *my->diskNrEB);
+                               printf("Write data to disk nr %lu\n", *my->diskNrEB);
 
                        int col = 0;
 
@@ -154,7 +155,7 @@ void Stats_dump(TheArgs *theArgs, TheStats *my, int interval)
                        }
 
                        if ((long) (*my->evtsDiscarded) - (long) lastED > 0) {
-                               sprintf(msglog, "<W> discarded events: %d", (long) (*my->evtsDiscarded) - (long) lastED);
+                               sprintf(msglog, "<W> discarded events: %lu", (long) (*my->evtsDiscarded) - (long) lastED);
                                storeLogInfo(theArgs, msglog);
                        }
 
@@ -186,7 +187,7 @@ void Stats_dump(TheArgs *theArgs, TheStats *my, int interval)
                                 stderr);
                        col = 0;
                        for (i = 0; i < theArgs->nrOfMsgs; i++) {
-                               fprintf(stderr, "%2d: 0x%08x ", i, *my->trigNr[i]);
+                               fprintf(stderr, "%2d: 0x%08lx ", i, *my->trigNr[i]);
                                if (++col == 8) {
                                        fputc('\n', stderr);
                                        col = 0;
@@ -201,7 +202,7 @@ void Stats_dump(TheArgs *theArgs, TheStats *my, int interval)
                                 stderr);
                        col = 0;
                        for (i = 0; i < theArgs->nrOfMsgs; i++) {
-                               fprintf(stderr, "%2d: 0x%08x ", i, *my->errBit[i]);
+                               fprintf(stderr, "%2d: 0x%08lx ", i, *my->errBit[i]);
                                if (++col == 8) {
                                        fputc('\n', stderr);
                                        col = 0;