Changeset 15605 for trunk


Ignore:
Timestamp:
05/15/13 13:31:02 (12 years ago)
Author:
tbretz
Message:
Decoupled updating event number from writing data to ensure that a slow dim cannot block writing -- hope that won't give a problem with memory, but this should only happen when it blocks really for a long long time.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/EventBuilderWrapper.h

    r15514 r15605  
    8585    uint32_t fLastOpened;
    8686    uint32_t fLastClosed;
    87     uint32_t fNumEvts[4];
     87    array<uint32_t,4> fNumEvts;
    8888
    8989    DimWriteStatistics  fDimWriteStats;
     
    111111    Queue<pair<Time,GUI_STAT>> fDimQueue1;
    112112    Queue<tuple<Time,bool,FAD::EventHeader>> fDimQueue2;
     113    Queue<pair<Time,array<uint32_t,4>>> fDimQueue3;
    113114   
    114115    bool fDebugStream;
     
    269270        fDimQueue1(std::bind(&EventBuilderWrapper::factStatSend, this, placeholders::_1)),
    270271        fDimQueue2(std::bind(&EventBuilderWrapper::procHeader, this, placeholders::_1)),
     272        fDimQueue3(std::bind(&EventBuilderWrapper::updateEvents, this, placeholders::_1)),
    271273        fDebugStream(false), fDebugRead(false), fDebugLog(false), fNightAsInt(0)
    272274    {
     
    276278        This = this;
    277279
    278         memset(fNumEvts, 0, sizeof(fNumEvts));
     280        memset(fNumEvts.data(), 0, sizeof(fNumEvts));
    279281        fDimEvents.Update(fNumEvts);
    280282
     
    637639    vector<DataProcessorImp*> fFiles;
    638640
     641    void updateEvents(const pair<Time,array<uint32_t>,4>> &stat)
     642    {
     643        fDimEvents.setData(stat.second.data(), sizeof(uint32_t)*4);
     644        fDimEvents.Update(stat.first);
     645    }
     646
    639647    FileHandle_t runOpen(uint32_t runid, RUN_HEAD *h, size_t)
    640648    {
     
    710718
    711719        fNumEvts[kCurrent] = 0;
    712         fDimEvents.Update(fNumEvts);
     720        fDimQueue3.post(fNumEvts);
    713721        // fDimCurrentEvent.Update(uint32_t(0));
    714722
     
    736744        if (newt>oldt+boost::posix_time::seconds(1))
    737745        {
    738             fDimEvents.Update(fNumEvts);
     746            fDimQueue3.post(fNumEvts);
     747            //fDimEvents.Update(fNumEvts);
    739748            oldt = newt;
    740749        }
     
    796805        UpdateRuns();
    797806
    798         fDimEvents.Update(fNumEvts);
     807        fDimQueue3.post(fNumEvts);
     808        //fDimEvents.Update(fNumEvts);
    799809
    800810
Note: See TracChangeset for help on using the changeset viewer.