Changeset 16619 for trunk


Ignore:
Timestamp:
06/03/13 11:22:04 (11 years ago)
Author:
tbretz
Message:
The incompolete event timeout can now be set as configuration value
Location:
trunk/FACT++/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/EventBuilder.cc

    r16618 r16619  
    7474
    7575size_t g_maxMem;                //maximum memory allowed for buffer
     76
     77uint16_t g_evtTimeout;           // timeout (sec) for one event
    7678
    7779FACT_SOCK g_port[NBOARDS];      // .addr=string of IP-addr in dotted-decimal "ddd.ddd.ddd.ddd"
     
    13651367            // The first event is the oldest. If the first event within the
    13661368            // timeout window was received, we can stop searchinf further.
    1367             if (evt->time.tv_sec>=actTime - 30)
     1369            if (evt->time.tv_sec+g_evtTimeout>=actTime)
    13681370                break;
    13691371
  • trunk/FACT++/src/EventBuilder.h

    r16579 r16619  
    1919extern int  g_reset     ;  //>0 = reset different levels of eventbuilder
    2020extern size_t g_maxMem  ;  //maximum memory allowed for buffer
     21extern uint16_t g_evtTimeout;  //timeout (sec) for one event
    2122
    2223extern FACT_SOCK g_port[NBOARDS] ;  // .port = baseport, .addr=string of IP-addr in dotted-decimal "ddd.ddd.ddd.ddd"
  • trunk/FACT++/src/EventBuilderWrapper.h

    r16612 r16619  
    225225                                                           "|roi:Region of interest of secondary baseline"
    226226                                                           "|run:Run numbers of DRS runs (0=none)"),
    227         fDimStatistics1 ("FAD_CONTROL/STATISTICS1",        "I:5;X:3;I:1;I:2;C:40;I:40;X:40",
     227        fDimStatistics1 ("FAD_CONTROL/STATISTICS1",        "I:5;X:3;I:1;I:2;C:40;I:40;I:40",
    228228                                                           "Event Builder status for GUI display"
    229229                                                           "|bufferInfo[int]:Events in buffer, incomp., comp., write, proc., tot."
     
    232232                                                           "|rateNew[int]:Number of new start events received"
    233233                                                           "|numConn[int]:Number of connections per board"
    234                                                            "|rateBytes[int]:Bytes read this cycle"
    235                                                            "|totBytes[int]:Bytes read (counter)"),
     234                                                           "|rateBytes[int]:Bytes read during last cylce"
     235                                                           "|relBytes[int]:Relative number of total bytes received (received - released)"),
    236236        fDimFileFormat("FAD_CONTROL/FILE_FORMAT",          "S:1", "|format[int]:Current file format"),
    237237        fDimIncomplete("FAD_CONTROL/INCOMPLETE",           "X:1", "|incomplete[bits]:One bit per board"),
     
    307307    {
    308308        g_maxMem = size_t(mb)*1000000;
     309    }
     310    void SetEventTimeout(uint16_t to) const
     311    {
     312        g_evtTimeout = to;
    309313    }
    310314
  • trunk/FACT++/src/fadctrl.cc

    r16532 r16619  
    804804
    805805        SetMaxMemory(mem);
     806
     807        return T::GetCurrentState();
     808    }
     809
     810    int SetEventTimeoutSec(const EventImp &evt)
     811    {
     812        if (!CheckEventSize(evt.GetSize(), "SetEventTimeoutSec", 2))
     813            return T::kSM_FatalError;
     814
     815        const int16_t sec = evt.GetShort();
     816
     817        if (sec<=0)
     818        {
     819            ostringstream msg;
     820            msg << hex << "Value " << sec << " out of range.";
     821            T::Error(msg);
     822            return T::GetCurrentState();
     823        }
     824
     825        SetEventTimeout(sec);
    806826
    807827        return T::GetCurrentState();
     
    17491769             "|memory[short]:Buffer size in Mega-bytes.");
    17501770
     1771        T::AddEvent("SET_EVENT_TIMEOUT", "S:1")
     1772            (bind(&StateMachineFAD::SetEventTimeoutSec, this, placeholders::_1))
     1773            ("Set the timeout after which an event expires which was not completely received yet."
     1774             "|timeout[sec]:Timeout in seconds [1;32767]");
     1775
    17511776        T::AddEvent("SET_REGISTER", "I:2", FAD::State::kConnecting, FAD::State::kConnected, FAD::State::kRunInProgress)
    17521777            (bind(&StateMachineFAD::SetRegister, this, placeholders::_1))
     
    19782003        // ---------- Setup event builder ---------
    19792004        SetMaxMemory(conf.Get<unsigned int>("max-mem"));
     2005        SetEventTimeout(conf.Get<uint16_t>("event-timeout"));
    19802006
    19812007        if (!InitRunNumber(conf.Get<string>("destination-folder")))
     
    21632189    builder.add_options()
    21642190        ("max-mem,m",          var<unsigned int>(100), "Maximum memory the event builder thread is allowed to consume for its event buffer")
     2191        ("event-timeout",      var<uint16_t>(30),      "After how many seconds is an event considered to be timed out? (<=0: disabled)")
    21652192        ("destination-folder", var<string>(""),        "Destination folder (base folder) for the event builder binary data files.")
    21662193        ;
Note: See TracChangeset for help on using the changeset viewer.