Changeset 10980


Ignore:
Timestamp:
06/10/11 13:17:04 (14 years ago)
Author:
ogrimm
Message:
DIM event service contains active boards only
Location:
fact/FADctrl
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • fact/FADctrl/FAD.cc

    r10969 r10980  
    6262  Datafile = -1;
    6363  EventUpdateDelay = atof(GetConfig("EventUpdateDelay", "0.5").c_str());
     64  TimeForDIMUpdate = 0;
    6465
    6566  // Create pipe for data exchange
     
    633634        else if (Mode == acalib) PrintMessage("Current mode is ACALIB (3x%d events, slowest board %d has %d events)\n", NumEventsRequested, SlowestBoard, MinCount);
    634635        else if (Mode == datarun) PrintMessage("Current mode is DATARUN (%d events requested, %d events taken)\n", NumEventsRequested, NumEvents);
    635 
     636        PrintMessage("Execution time of last DIM event update %d seconds\n", TimeForDIMUpdate);
    636637        return;
    637638  }   
     
    9991000        }
    10001001
    1001         // Check if DIM service should be updated
    1002         if ((Time.tv_sec-LastUpdate.tv_sec)*1e6 + Time.tv_usec-LastUpdate.tv_usec > EventUpdateDelay*1e6) {
     1002        // Check if DIM service should be updated (delay between updates at least 10xtime to update)
     1003        if ((Time.tv_sec-LastUpdate.tv_sec)*1e6 + Time.tv_usec-LastUpdate.tv_usec > max(10*TimeForDIMUpdate, EventUpdateDelay)*1e6) {
    10031004          gettimeofday(&LastUpdate, NULL);
     1005
    10041006          EventService.updateService(EventData, sizeof(RunHeader) + sizeof(EventHeader) + ActiveBoards.size()*(sizeof(BoardStructure) + NChips*NChannels*NBins*sizeof(short) + NChips*sizeof(int)));
    10051007          EventNumService.updateService();
     1008
     1009          TimeForDIMUpdate = time(NULL) - LastUpdate.tv_sec;
    10061010          if (Mode == datarun) FileSizeService.updateService();
    10071011        }
     
    10431047        NumEvents++;
    10441048
    1045         // Write event header to file
    1046         //if(write(Datafile, EHeader, sizeof(EventHeader)) != sizeof(EventHeader)) Error = true;
    1047 
    1048         // Write trigger cells
    1049         //for (unsigned int i=0; i<ActiveBoards.size(); i++) {
    1050           //if(write(Datafile, TriggerCell + i*NChips, NChips*sizeof(int)) != NChips*sizeof(int)) Error = true;
    1051         //}
    1052 
    1053         // Write ADC data
    1054         //unsigned int Bins = NChips*NChannels*NBins;
    1055         //for (unsigned int i=0; i<ActiveBoards.size(); i++) {
    1056           //if(write(Datafile, Data+i*Bins, Bins*sizeof(short)) != (ssize_t) (Bins*sizeof(short))) Error = true;
    1057         //}
    1058        
    10591049        // Update file size
    10601050        if (fstat(Datafile, &FileStat) == -1) Error = errno;
  • fact/FADctrl/FAD.h

    r10969 r10980  
    4646        static void LaunchEventThread(class FAD *);
    4747        pthread_t Thread;
     48        float TimeForDIMUpdate;
    4849
    4950    int Datafile;
  • fact/FADctrl/FADBoard.cc

    r10969 r10980  
    470470          while (!Continue) {
    471471                struct timespec Wakeup;
    472                 Wakeup.tv_sec = time(NULL)+5;
     472                Wakeup.tv_sec = time(NULL)+MAX_WAIT_FOR_CONDITION;
    473473                Wakeup.tv_nsec = 0;
    474474                if ((Ret = pthread_cond_timedwait(&CondVar, &Mutex, &Wakeup)) != 0) {
    475                   if (Ret == ETIMEDOUT) printf("Board %s timed out (5 s) waiting for condition\n", Name);
     475                  if (Ret == ETIMEDOUT) SetStatus("Board %s timed out (%d s) waiting for condition\n", Name, MAX_WAIT_FOR_CONDITION);
    476476                  else m->Message(m->ERROR, "pthread_cond_wait() failed (%s)", strerror(Ret));
    477477                }
  • fact/FADctrl/FADBoard.h

    r10813 r10980  
    2222const unsigned int READ_BUFFER_SIZE = 1000000;
    2323const unsigned int STATUS_SIZE = 200;
     24const int MAX_WAIT_FOR_CONDITION = 10;
    2425
    2526class FADBoard: public DimThread {
  • fact/FADctrl/History.txt

    r10913 r10980  
    313125/5/2011       dcm_lock and dcm_ready bits were incorrectly evaluated.
    32323/6/2011        Raw data files will only contain boards active at the start of the run.
     337/6/2011        DIM event service only contains active boards
Note: See TracChangeset for help on using the changeset viewer.