protected void processMessage(CharSequence methodName, MessageHistory history) { CharSequence extraHistoId = histosByMethod ? ("_" + methodName) : ""; long lastTime = 0; // if the tailer has recordHistory(true) then the MessageHistory will be // written with a single timing and nothing else. This is then carried through int firstWriteOffset = history.timings() - (history.sources() * 2); if (!(firstWriteOffset == 0 || firstWriteOffset == 1)) // don't know how this can happen, but there is at least one CQ that exhibits it return; for (int sourceIndex = 0; sourceIndex < history.sources(); sourceIndex++) { String histoId = Integer.toString(history.sourceId(sourceIndex)) + extraHistoId; Histogram histo = histos.computeIfAbsent(histoId, s -> histogram()); long receivedByThisComponent = history.timing((2 * sourceIndex) + firstWriteOffset); long processedByThisComponent = history.timing((2 * sourceIndex) + firstWriteOffset + 1); histo.sample(processedByThisComponent - receivedByThisComponent); if (lastTime == 0 && firstWriteOffset > 0) { Histogram histo1 = histos.computeIfAbsent("startTo" + histoId, s -> histogram()); histo1.sample(receivedByThisComponent - history.timing(0)); } else if (lastTime != 0) { Histogram histo1 = histos.computeIfAbsent(Integer.toString(history.sourceId(sourceIndex - 1)) + "to" + histoId, s -> histogram()); // here we are comparing System.nanoTime across processes. YMMV histo1.sample(receivedByThisComponent - lastTime); } lastTime = processedByThisComponent; } if (history.sources() > 1) { Histogram histoE2E = histos.computeIfAbsent("endToEnd", s -> histogram()); histoE2E.sample(history.timing(history.timings() - 1) - history.timing(0)); } }
if (i < 0) continue; if (veh.sourceId(i) != this.sourceId()) continue;
protected void processMessage(CharSequence methodName, MessageHistory history) { CharSequence extraHistoId = histosByMethod ? ("_" + methodName) : ""; long lastTime = 0; // if the tailer has recordHistory(true) then the MessageHistory will be // written with a single timing and nothing else. This is then carried through int firstWriteOffset = history.timings() - (history.sources() * 2); if (!(firstWriteOffset == 0 || firstWriteOffset == 1)) // don't know how this can happen, but there is at least one CQ that exhibits it return; for (int sourceIndex = 0; sourceIndex < history.sources(); sourceIndex++) { String histoId = Integer.toString(history.sourceId(sourceIndex)) + extraHistoId; Histogram histo = histos.computeIfAbsent(histoId, s -> histogram()); long receivedByThisComponent = history.timing((2 * sourceIndex) + firstWriteOffset); long processedByThisComponent = history.timing((2 * sourceIndex) + firstWriteOffset + 1); histo.sample(processedByThisComponent - receivedByThisComponent); if (lastTime == 0 && firstWriteOffset > 0) { Histogram histo1 = histos.computeIfAbsent("startTo" + histoId, s -> histogram()); histo1.sample(receivedByThisComponent - history.timing(0)); } else if (lastTime != 0) { Histogram histo1 = histos.computeIfAbsent(Integer.toString(history.sourceId(sourceIndex - 1)) + "to" + histoId, s -> histogram()); // here we are comparing System.nanoTime across processes. YMMV histo1.sample(receivedByThisComponent - lastTime); } lastTime = processedByThisComponent; } if (history.sources() > 1) { Histogram histoE2E = histos.computeIfAbsent("endToEnd", s -> histogram()); histoE2E.sample(history.timing(history.timings() - 1) - history.timing(0)); } }
if (i < 0) continue; if (veh.sourceId(i) != this.sourceId()) continue;