Skip to content

Commit fe86e50

Browse files
committed
Buffer status counters
1 parent 4f8ba14 commit fe86e50

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

doc/releaseNotes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,3 +451,6 @@ This file describes the main feature changes for each readout.exe released versi
451451
## v2.10.1 - 20/04/2022
452452
- Updated configuration parameters:
453453
- equipment-file-*.updateOrbits: when set to zero, RDH orbits are not updated in file loop replay. This is needed for some reconstruction tests. This however creates a stream of data with inconsistent orbit ids and mismatching timeframe information.
454+
455+
## v2.10.2 - 04/05/2022
456+
- Added some buffer monitoring counters. They are logged in console stats and in monitoring (readout.bufferUsage, one per buffer, from 0% to 100%).

src/MemoryBankManager.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,6 @@ void MemoryBankManager::reset()
142142
theLog.log(LogInfoDevel_(3008), "Releasing bank %s%s", it.name.c_str(), (useCount == 1) ? "" : "warning - still in use elsewhere !");
143143
}
144144
banks.clear();
145+
poolIndex = -1;
145146
}
146147

src/ReadoutStats.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ReadoutStats::~ReadoutStats() {
4646
zmqCleanup();
4747
}
4848

49-
void ReadoutStats::reset()
49+
void ReadoutStats::reset(bool lightReset)
5050
{
5151
counters.notify = 0;
5252

@@ -66,8 +66,10 @@ void ReadoutStats::reset()
6666

6767
counters.firstOrbit = undefinedOrbit;
6868

69-
for (unsigned int i = 0; i < ReadoutStatsMaxItems; i++) {
70-
counters.bufferUsage[i] = -1.0;
69+
if (!lightReset) {
70+
for (unsigned int i = 0; i < ReadoutStatsMaxItems; i++) {
71+
counters.bufferUsage[i] = -1.0;
72+
}
7173
}
7274
}
7375

src/ReadoutStats.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <zmq.h>
2525
#endif
2626

27-
const int ReadoutStatsMaxItems = 32;
27+
const int ReadoutStatsMaxItems = 25;
2828

2929
struct ReadoutStatsCounters {
3030
uint32_t version; // version number of this header
@@ -63,7 +63,7 @@ class ReadoutStats
6363
public:
6464
ReadoutStats();
6565
~ReadoutStats();
66-
void reset();
66+
void reset(bool lightReset=0); // light reset: to preserve the buffer counters
6767
void print();
6868

6969
ReadoutStatsCounters counters;

src/mainReadout.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ int Readout::start()
10391039
{
10401040
theLog.resetMessageCount();
10411041
theLog.log(LogInfoSupport_(3005), "Readout executing START");
1042-
gReadoutStats.reset();
1042+
gReadoutStats.reset(1);
10431043
gReadoutStats.counters.state = stringToUint64("> start");
10441044
gReadoutStats.counters.notify++;
10451045
gReadoutStats.publishNow();

src/readoutMonitor.cxx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,14 @@ int main(int argc, const char** argv)
288288
if (nRfmq) {
289289
avgTfmq = (counters->pagesPendingFairMQtime.load() / nRfmq) / (deltaT * 1000000.0);
290290
}
291+
std::string vBufferUsage;
292+
for (int i = 0; i < ReadoutStatsMaxItems; i++) {
293+
double r = counters->bufferUsage[i].load();
294+
vBufferUsage += ( (i==0) ? "" : ",") + ( (r<0) ? "" : std::to_string((int)(r*100)) );
295+
}
291296
char buf[1024];
292297
if (cfgRawBytes) {
293-
snprintf(buf, sizeof(buf), "%f\t%s\t%s\t%llu\t%llu\t%llu\t%llu\t%llu\t%.2lf\t%.6lf\t%d\n",
298+
snprintf(buf, sizeof(buf), "%f\t%s\t%s\t%llu\t%llu\t%llu\t%llu\t%llu\t%.2lf\t%.6lf\t%d\t%s\n",
294299
(double)t,
295300
counters->source,
296301
(char*)&state,
@@ -301,8 +306,9 @@ int main(int argc, const char** argv)
301306
(unsigned long long)counters->pagesPendingFairMQ.load(),
302307
nRfmq,
303308
avgTfmq,
304-
(int)counters->timeframeIdFairMQ.load());
305-
fflush(stdout);
309+
(int)counters->timeframeIdFairMQ.load(),
310+
vBufferUsage.c_str()
311+
);
306312
} else {
307313
snprintf(buf, sizeof(buf), "%s %s %s %8llu %s %s %s %6llu %7.2lf %6.4lf %8d\n",
308314
t ? getStringTime(t).c_str() : "-",
@@ -322,6 +328,7 @@ int main(int argc, const char** argv)
322328
broadcastSocket->broadcast(buf);
323329
} else {
324330
printf("%s",buf);
331+
fflush(stdout);
325332
}
326333

327334
if (metricsLogEnabled) {

0 commit comments

Comments
 (0)