Skip to content

Commit 79ccfd2

Browse files
committed
Use current time in hadaq BuildEvent
1 parent 0c842ae commit 79ccfd2

File tree

4 files changed

+21
-27
lines changed

4 files changed

+21
-27
lines changed

plugins/dogma/dogma/CombinerModule.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ namespace dogma {
6666
bool fDataError{false}; ///< indicates if subevent has data error bit set in header id
6767
bool fEmpty{true}; ///< indicates if input has empty data
6868
void *fInfo{nullptr}; ///< Direct pointer on transport info, used only for debugging
69-
int fQueueCapacity{0}; ///< capacity of input queue
7069
int fNumCanRecv{0}; ///< Number buffers can be received
7170
uint64_t fTotalDataSize{0}; ///< total amount of data received
7271
unsigned fLostTrig{0}; ///< number of lost triggers (never received by the combiner)
@@ -276,8 +275,6 @@ namespace dogma {
276275

277276
bool FlushOutputBuffer();
278277

279-
void DoInputSnapshot(unsigned ninp);
280-
281278
void BeforeModuleStart() override;
282279

283280
void AfterModuleStop() override;

plugins/dogma/src/CombinerModule.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ void dogma::CombinerModule::BeforeModuleStart()
399399

400400
// direct addon pointers can be used for terminal printout
401401
for (unsigned ninp = 0; ninp < fCfg.size(); ninp++) {
402-
fCfg[ninp].fQueueCapacity = InputQueueCapacity(ninp);
403402
if (fBNETrecv)
404403
continue;
405404
dabc::Command cmd("GetDogmaTransportInfo");

plugins/hadaq/hadaq/CombinerModule.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ namespace hadaq {
6767
bool fDataError{false}; ///< indicates if subevent has data error bit set in header id
6868
bool fEmpty{true}; ///< indicates if input has empty data
6969
void *fInfo{nullptr}; ///< Direct pointer on transport info, used only for debugging
70-
int fQueueCapacity{0}; ///< capacity of input queue
7170
int fNumCanRecv{0}; ///< Number buffers can be received
7271
unsigned fLostTrig{0}; ///< number of lost triggers (never received by the combiner)
7372
unsigned fDroppedTrig{0}; ///< number of dropped triggers (received but dropped by the combiner)

plugins/hadaq/src/CombinerModule.cxx

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,7 @@ void hadaq::CombinerModule::BeforeModuleStart()
306306
fCheckBNETProblems = chkActive;
307307

308308
// direct addon pointers can be used for terminal printout
309-
for (unsigned ninp=0;ninp<fCfg.size();ninp++) {
310-
fCfg[ninp].fQueueCapacity = InputQueueCapacity(ninp);
309+
for (unsigned ninp = 0; ninp < fCfg.size(); ninp++) {
311310
if (fBNETrecv) continue;
312311
dabc::Command cmd("GetHadaqTransportInfo");
313312
cmd.SetInt("id", ninp);
@@ -960,9 +959,9 @@ bool hadaq::CombinerModule::BuildEvent()
960959
if (!ShiftToNextSubEvent(ninp)) {
961960
// could not get subevent data on any channel.
962961
// let framework do something before next try
963-
if (fExtraDebug && fLastDebugTm.Expired(2.)) {
962+
if (fExtraDebug && fLastDebugTm.Expired(currTm, 2.)) {
964963
DOUT1("Fail to build event while input %u is not ready numcanrecv %u maxtm = %5.3f ", ninp, NumCanRecv(ninp), fMaxProcDist);
965-
fLastDebugTm.GetNow();
964+
fLastDebugTm = currTm;
966965
fMaxProcDist = 0;
967966
}
968967

@@ -999,7 +998,7 @@ bool hadaq::CombinerModule::BuildEvent()
999998

1000999
// check potential error
10011000

1002-
if (((fCheckBNETProblems == chkActive) || (fCheckBNETProblems == chkOk)) && (fEventBuildTimeout > 0.) && fLastBuildTm.Expired(fEventBuildTimeout*0.5)) {
1001+
if (((fCheckBNETProblems == chkActive) || (fCheckBNETProblems == chkOk)) && (fEventBuildTimeout > 0.) && fLastBuildTm.Expired(currTm, fEventBuildTimeout*0.5)) {
10031002

10041003
if (missing_inp >= 0)
10051004
fBNETProblem = "no_data_" + std::to_string(missing_inp); // no data at input
@@ -1012,8 +1011,8 @@ bool hadaq::CombinerModule::BuildEvent()
10121011
///////////////////////////////////////////////////////////////////////////////
10131012
// check too large triggertag difference on input channels or very long delay in building,
10141013
// to repair situation, try to flush all input buffers
1015-
if (fLastDropTm.Expired((fEventBuildTimeout > 0) ? 1.5*fEventBuildTimeout : 5.))
1016-
if (((fTriggerNrTolerance > 0) && (diff0 > fTriggerNrTolerance)) || ((fEventBuildTimeout > 0) && fLastBuildTm.Expired(fEventBuildTimeout) && any_data && (fCfg.size() > 1))) {
1014+
if (fLastDropTm.Expired(currTm, (fEventBuildTimeout > 0) ? 1.5*fEventBuildTimeout : 5.))
1015+
if (((fTriggerNrTolerance > 0) && (diff0 > fTriggerNrTolerance)) || ((fEventBuildTimeout > 0) && fLastBuildTm.Expired(currTm, fEventBuildTimeout) && any_data && (fCfg.size() > 1))) {
10171016

10181017
std::string msg;
10191018
if ((fTriggerNrTolerance > 0) && (diff0 > fTriggerNrTolerance)) {
@@ -1038,9 +1037,9 @@ bool hadaq::CombinerModule::BuildEvent()
10381037

10391038
DropAllInputBuffers();
10401039

1041-
if (fExtraDebug && fLastDebugTm.Expired(1.)) {
1040+
if (fExtraDebug && fLastDebugTm.Expired(currTm, 1.)) {
10421041
DOUT1("Drop all buffers");
1043-
fLastDebugTm.GetNow();
1042+
fLastDebugTm = currTm;
10441043
}
10451044

10461045
return false; // retry on next set of buffers
@@ -1100,9 +1099,9 @@ bool hadaq::CombinerModule::BuildEvent()
11001099
fAllDroppedData += droppedsize;
11011100

11021101
if(!ShiftToNextSubEvent(ninp, false, true)) {
1103-
if (fExtraDebug && fLastDebugTm.Expired(2.)) {
1102+
if (fExtraDebug && fLastDebugTm.Expired(currTm, 2.)) {
11041103
DOUT1("Cannot shift data from input %d", ninp);
1105-
fLastDebugTm.GetNow();
1104+
fLastDebugTm = currTm;
11061105
}
11071106

11081107
return false;
@@ -1148,13 +1147,13 @@ bool hadaq::CombinerModule::BuildEvent()
11481147
if (fOut.IsBuffer() && (!fOut.IsPlaceForEvent(subeventssize) || !CheckDestination(buildevid))) {
11491148
// first we close current buffer
11501149
if (!FlushOutputBuffer()) {
1151-
if (fExtraDebug && fLastDebugTm.Expired(1.)) {
1150+
if (fExtraDebug && fLastDebugTm.Expired(currTm, 1.)) {
11521151
std::string sendmask;
11531152
for (unsigned n=0;n<NumOutputs();n++)
11541153
sendmask.append(CanSend(n) ? "o" : "x");
11551154

11561155
DOUT0("FlushOutputBuffer can't send to all %u outputs sendmask = %s", NumOutputs(), sendmask.c_str());
1157-
fLastDebugTm.GetNow();
1156+
fLastDebugTm = currTm;
11581157
}
11591158
return false;
11601159
}
@@ -1164,9 +1163,9 @@ bool hadaq::CombinerModule::BuildEvent()
11641163
dabc::Buffer buf = TakeBuffer();
11651164
if (buf.null()) {
11661165

1167-
if (fExtraDebug && fLastDebugTm.Expired(1.)) {
1166+
if (fExtraDebug && fLastDebugTm.Expired(currTm, 1.)) {
11681167
DOUT0("did not have new buffer - wait for it");
1169-
fLastDebugTm.GetNow();
1168+
fLastDebugTm = currTm;
11701169
}
11711170

11721171
return false;
@@ -1175,9 +1174,9 @@ bool hadaq::CombinerModule::BuildEvent()
11751174
SetInfo("Cannot use buffer for output - hard error!!!!", true);
11761175
buf.Release();
11771176
dabc::mgr.StopApplication();
1178-
if (fExtraDebug && fLastDebugTm.Expired(1.)) {
1177+
if (fExtraDebug && fLastDebugTm.Expired(currTm, 1.)) {
11791178
DOUT0("Abort application completely");
1180-
fLastDebugTm.GetNow();
1179+
fLastDebugTm = currTm;
11811180
}
11821181
return false;
11831182
}
@@ -1272,9 +1271,9 @@ bool hadaq::CombinerModule::BuildEvent()
12721271

12731272
if (fEvnumDiffStatistics && (diff > 1)) {
12741273

1275-
if (fExtraDebug && fLastDebugTm.Expired(1.)) {
1274+
if (fExtraDebug && fLastDebugTm.Expired(currTm, 1.)) {
12761275
DOUT1("Events gap %d", diff-1);
1277-
fLastDebugTm.GetNow();
1276+
fLastDebugTm = currTm;
12781277
}
12791278

12801279
fLostEventRateCnt += (diff-1);
@@ -1296,7 +1295,7 @@ bool hadaq::CombinerModule::BuildEvent()
12961295
fCheckBNETProblems = chkOk; // no problems, event build normally, now wait for error, timeout relative to build time
12971296
}
12981297

1299-
fLastBuildTm.GetNow();
1298+
fLastBuildTm = currTm;
13001299
} else {
13011300
PROFILER_BLOCKN("lostl", 14)
13021301
fLostEventRateCnt += 1;
@@ -1319,9 +1318,9 @@ bool hadaq::CombinerModule::BuildEvent()
13191318
debugmask[ninp] = 'x';
13201319
}
13211320

1322-
if (fExtraDebug && fLastDebugTm.Expired(1.)) {
1321+
if (fExtraDebug && fLastDebugTm.Expired(currTm, 1.)) {
13231322
DOUT1("Did building as usual mask %s complete = %5s maxdist = %5.3f s", debugmask.c_str(), DBOOL(hasCompleteEvent), fMaxProcDist);
1324-
fLastDebugTm.GetNow();
1323+
fLastDebugTm = currTm;
13251324
fMaxProcDist = 0;
13261325
// put here update of tid
13271326
// fPID= syscall(SYS_gettid);

0 commit comments

Comments
 (0)