2828#include " Framework/ParallelContext.h"
2929#include " Framework/RawDeviceService.h"
3030#include " Framework/SimpleRawDeviceService.h"
31+ #include " Framework/Signpost.h"
3132#include " Framework/TextControlService.h"
3233#include " Framework/CallbackService.h"
3334#include " Framework/WorkflowSpec.h"
3435
36+ #include " DataProcessingStatus.h"
3537#include " DDSConfigHelpers.h"
3638#include " O2ControlHelpers.h"
3739#include " DeviceSpecHelpers.h"
@@ -131,12 +133,13 @@ std::ostream& operator<<(std::ostream& out, const enum TerminationPolicy& policy
131133// FIXME: We should really print full lines.
132134bool getChildData (int infd, DeviceInfo& outinfo)
133135{
134- char buffer[1024 ];
136+ char buffer[1024 * 16 ];
135137 int bytes_read;
136138 // NOTE: do not quite understand read ends up blocking if I read more than
137139 // once. Oh well... Good enough for now.
140+ O2_SIGNPOST_START (DriverStatus::ID , DriverStatus::BYTES_READ , outinfo.pid , infd, 0 );
138141 // do {
139- bytes_read = read (infd, buffer, 1024 );
142+ bytes_read = read (infd, buffer, 1024 * 16 );
140143 if (bytes_read == 0 ) {
141144 return false ;
142145 }
@@ -150,7 +153,8 @@ bool getChildData(int infd, DeviceInfo& outinfo)
150153 }
151154 assert (bytes_read > 0 );
152155 outinfo.unprinted += std::string (buffer, bytes_read);
153- // } while (bytes_read != 0);
156+ // } while (bytes_read != 0);
157+ O2_SIGNPOST_END (DriverStatus::ID , DriverStatus::BYTES_READ , bytes_read, 0 , 0 );
154158 return true ;
155159}
156160
@@ -372,7 +376,6 @@ void processChildrenOutput(DriverInfo& driverInfo, DeviceInfos& infos, DeviceSpe
372376 assert (infos.size () == controls.size ());
373377 std::smatch match;
374378 ParsedMetricMatch metricMatch;
375- std::string token;
376379 const std::string delimiter (" \n " );
377380 bool hasNewMetric = false ;
378381 for (size_t di = 0 , de = infos.size (); di < de; ++di) {
@@ -384,7 +387,9 @@ void processChildrenOutput(DriverInfo& driverInfo, DeviceInfos& infos, DeviceSpe
384387 continue ;
385388 }
386389
387- auto s = info.unprinted ;
390+ O2_SIGNPOST_START (DriverStatus::ID , DriverStatus::BYTES_PROCESSED , info.pid , 0 , 0 );
391+
392+ std::string_view s = info.unprinted ;
388393 size_t pos = 0 ;
389394 info.history .resize (info.historySize );
390395 info.historyLevel .resize (info.historySize );
@@ -400,7 +405,7 @@ void processChildrenOutput(DriverInfo& driverInfo, DeviceInfos& infos, DeviceSpe
400405 };
401406
402407 while ((pos = s.find (delimiter)) != std::string::npos) {
403- token = s.substr (0 , pos);
408+ std::string token{ s.substr (0 , pos) } ;
404409 auto logLevel = LogParsingHelpers::parseTokenLevel (token);
405410
406411 // Check if the token is a metric from SimpleMetricsService
@@ -431,7 +436,7 @@ void processChildrenOutput(DriverInfo& driverInfo, DeviceInfos& infos, DeviceSpe
431436 }
432437 }
433438 }
434- } else if (!control.quiet && (strstr ( token.c_str (), control.logFilter ) != nullptr ) &&
439+ } else if (!control.quiet && (token.find ( control.logFilter ) != std::string::npos ) &&
435440 logLevel >= control.logLevel ) {
436441 assert (info.historyPos >= 0 );
437442 assert (info.historyPos < info.history .size ());
@@ -449,9 +454,11 @@ void processChildrenOutput(DriverInfo& driverInfo, DeviceInfos& infos, DeviceSpe
449454 if (logLevel == LogParsingHelpers::LogLevel::Error) {
450455 info.lastError = token;
451456 }
452- s.erase ( 0 , pos + delimiter.length ());
457+ s.remove_prefix ( pos + delimiter.length ());
453458 }
459+ size_t oldSize = info.unprinted .size ();
454460 info.unprinted = s;
461+ O2_SIGNPOST_END (DriverStatus::ID , DriverStatus::BYTES_PROCESSED , oldSize - info.unprinted .size (), 0 , 0 );
455462 }
456463 if (hasNewMetric) {
457464 hasNewMetric = false ;
0 commit comments