]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
few changes in statistic. Sergey Yurevich.
authorhadaq <hadaq>
Tue, 3 Jun 2008 10:13:21 +0000 (10:13 +0000)
committerhadaq <hadaq>
Tue, 3 Jun 2008 10:13:21 +0000 (10:13 +0000)
hadaq/evtbuild.c

index 7093ecdef5946b1a6a7126441cf4bdf062d9ed97..cd71a0cd72ef8f50961fdea7158c9ef97592dc93 100644 (file)
@@ -1,5 +1,5 @@
 static char *rcsId =
-  "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.83 2008-05-28 14:54:22 hadaq Exp $";
+  "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.84 2008-06-03 10:13:21 hadaq Exp $";
 
 
 #define _POSIX_C_SOURCE 199309L
@@ -119,8 +119,9 @@ typedef struct TheStatsS
   unsigned long *evtbuildBuff[MAXINPATH];
   unsigned long *nrOfMsgs;
   unsigned long *runId;
-  unsigned long *evtsCompletePS;
-  unsigned long *bytesWrittenPS;
+  unsigned long *evtsCompleteRate;
+  unsigned long *bytesWrittenRate;
+  unsigned long *evtsDiscardedRate;
 } TheStats;
 
 static jmp_buf terminateJmp;
@@ -530,6 +531,7 @@ static void add2Stat( TheArgs * theArgs, TheStats * my, float interval, ShmTrans
 
   static unsigned long lastEvtsComplete;
   static unsigned long lastBytesWritten;
+  static unsigned long lastEvtsDisc;
   static time_t t_0 = 0;
   float buffSize, queueSize;
   time_t t, dT;
@@ -550,8 +552,24 @@ static void add2Stat( TheArgs * theArgs, TheStats * my, float interval, ShmTrans
     }
 
     /* Add more statistic for evtsComplete and bytesWritten per second */
-    (*my->evtsCompletePS) = (*my->evtsComplete - lastEvtsComplete) / dT;
-    (*my->bytesWrittenPS) = (*my->bytesWritten - lastBytesWritten) / dT;
+    if( (*my->evtsComplete) >= lastEvtsComplete ) 
+      (*my->evtsCompleteRate)  = (*my->evtsComplete - lastEvtsComplete) / dT;
+    else
+      (*my->evtsCompleteRate)  = (*my->evtsComplete);
+
+    if( (*my->bytesWritten) >= lastBytesWritten)
+      (*my->bytesWrittenRate)  = (*my->bytesWritten - lastBytesWritten) / dT;
+    else
+      (*my->bytesWrittenRate)  = (*my->bytesWritten);
+
+    if( (*my->evtsDiscarded) >= lastEvtsDisc)
+      (*my->evtsDiscardedRate) = (*my->evtsDiscarded - lastEvtsDisc) / dT;
+    else
+      (*my->evtsDiscardedRate) = (*my->evtsDiscarded);
+    
+    lastEvtsComplete = *my->evtsComplete;
+    lastBytesWritten = *my->bytesWritten;
+    lastEvtsDisc     = *my->evtsDiscarded;
   }
 
   t_0 = t;
@@ -1616,15 +1634,16 @@ int main (int argc, char *argv[])
       }
   }
 
-  theStats->evtsDiscarded    = Worker_addStatistic (worker, "evtsDiscarded");
-  theStats->evtsComplete     = Worker_addStatistic (worker, "evtsComplete");
-  theStats->evtsCompletePS   = Worker_addStatistic (worker, "evtsCompletePS");
-  theStats->evtsDataError    = Worker_addStatistic (worker, "evtsDataError");
-  theStats->evtsTagError     = Worker_addStatistic (worker, "evtsTagError");
-  theStats->bytesWritten     = Worker_addStatistic (worker, "bytesWritten");
-  theStats->bytesWrittenPS   = Worker_addStatistic (worker, "bytesWrittenPS");
-  theStats->runId            = Worker_addStatistic (worker, "runId");
-  (*theStats->runId)         = 0; /* initialize to zero */
+  theStats->evtsDiscarded     = Worker_addStatistic (worker, "evtsDiscarded");
+  theStats->evtsDiscardedRate = Worker_addStatistic (worker, "evtsDiscardedRate");
+  theStats->evtsComplete      = Worker_addStatistic (worker, "evtsComplete");
+  theStats->evtsCompleteRate  = Worker_addStatistic (worker, "evtsCompleteRate");
+  theStats->evtsDataError     = Worker_addStatistic (worker, "evtsDataError");
+  theStats->evtsTagError      = Worker_addStatistic (worker, "evtsTagError");
+  theStats->bytesWritten      = Worker_addStatistic (worker, "bytesWritten");
+  theStats->bytesWrittenRate  = Worker_addStatistic (worker, "bytesWrittenRate");
+  theStats->runId             = Worker_addStatistic (worker, "runId");
+  (*theStats->runId)          = 0; /* initialize to zero */
 
   unsigned long *retVal = NULL;
   theStats->evtsRes = (unsigned long *) &retVal;