From 1c8941e8f1ae00f1b48522bf00214a4d2f36c543 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 24 Nov 2019 21:45:52 -0500 Subject: [PATCH] PTrace process? --- java_console/models/src/com/rusefi/tracing/Entry.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/java_console/models/src/com/rusefi/tracing/Entry.java b/java_console/models/src/com/rusefi/tracing/Entry.java index 37956ad70d..d99dcd1204 100644 --- a/java_console/models/src/com/rusefi/tracing/Entry.java +++ b/java_console/models/src/com/rusefi/tracing/Entry.java @@ -57,6 +57,7 @@ public class Entry { try { DataInputStream is = new DataInputStream(new ByteArrayInputStream(packet)); is.readByte(); // skip TS result code + int firstTimeStamp = 0; for (int i = 0; i < packet.length - 1; i += 8) { byte type = is.readByte(); byte phase = is.readByte(); @@ -64,6 +65,15 @@ public class Entry { byte thread = is.readByte(); int timestampNt = readInt(is); + if (i == 0) { + firstTimeStamp = timestampNt; + } else { + if (timestampNt < firstTimeStamp) { + System.out.println("Dropping the remainder of the packet at " + i + " due to " + + timestampNt + " below " + firstTimeStamp); + break; + } + } double timestampSeconds = timestampNt / 1000000.0;