@@ -78,7 +78,7 @@ ProcessExecutor::ProcessExecutor(const std::list<FileWithDetails> &files, const
7878namespace {
7979 class PipeWriter : public ErrorLogger {
8080 public:
81- enum PipeSignal : std::uint8_t {REPORT_OUT=' 1' ,REPORT_ERROR=' 2' ,REPORT_SUPPR_INLINE=' 3' ,REPORT_SUPPR=' 4' ,CHILD_END=' 5' };
81+ enum PipeSignal : std::uint8_t {REPORT_OUT=' 1' ,REPORT_ERROR=' 2' ,REPORT_SUPPR_INLINE=' 3' ,REPORT_SUPPR=' 4' ,CHILD_END=' 5' ,REPORT_METRIC= ' 6 ' };
8282
8383 explicit PipeWriter (int pipe) : mWpipe(pipe) {}
8484
@@ -100,6 +100,10 @@ namespace {
100100 }
101101 }
102102
103+ void reportMetric (const std::string &metric) override {
104+ writeToPipe (REPORT_METRIC, metric);
105+ }
106+
103107 void writeEnd (const std::string& str) const {
104108 writeToPipe (CHILD_END, str);
105109 }
@@ -179,7 +183,8 @@ bool ProcessExecutor::handleRead(int rpipe, unsigned int &result, const std::str
179183 type != PipeWriter::REPORT_ERROR &&
180184 type != PipeWriter::REPORT_SUPPR_INLINE &&
181185 type != PipeWriter::REPORT_SUPPR &&
182- type != PipeWriter::CHILD_END) {
186+ type != PipeWriter::CHILD_END &&
187+ type != PipeWriter::REPORT_METRIC) {
183188 std::cerr << " #### ThreadExecutor::handleRead(" << filename << " ) invalid type " << int (type) << std::endl;
184189 std::exit (EXIT_FAILURE);
185190 }
@@ -256,6 +261,8 @@ bool ProcessExecutor::handleRead(int rpipe, unsigned int &result, const std::str
256261 } else if (type == PipeWriter::CHILD_END) {
257262 result += std::stoi (buf);
258263 res = false ;
264+ } else if (type == PipeWriter::REPORT_METRIC) {
265+ mErrorLogger .reportMetric (buf);
259266 }
260267
261268 return res;
0 commit comments