mirror of
https://github.com/codeflash-ai/codeflash.git
synced 2026-05-04 18:25:17 +00:00
Remove debug timing instrumentation from tracer
Strip AtomicLong accumulators, System.nanoTime() timing, and getTimingSummary() that were added for profiling. No functional change.
This commit is contained in:
parent
01e22152c7
commit
bfe6f3a828
2 changed files with 0 additions and 41 deletions
|
|
@ -12,7 +12,6 @@ import java.util.concurrent.Future;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
public final class TraceRecorder {
|
||||
|
||||
|
|
@ -24,8 +23,6 @@ public final class TraceRecorder {
|
|||
private final TraceWriter writer;
|
||||
private final ConcurrentHashMap<String, AtomicInteger> functionCounts = new ConcurrentHashMap<>();
|
||||
private final AtomicInteger droppedCaptures = new AtomicInteger(0);
|
||||
private final AtomicLong totalOnEntryNs = new AtomicLong(0);
|
||||
private final AtomicLong totalSerializationNs = new AtomicLong(0);
|
||||
private final int maxFunctionCount;
|
||||
private final ExecutorService serializerExecutor;
|
||||
|
||||
|
|
@ -71,8 +68,6 @@ public final class TraceRecorder {
|
|||
|
||||
private void onEntryImpl(String className, String methodName, String descriptor,
|
||||
int lineNumber, String sourceFile, Object[] args) {
|
||||
long entryStart = System.nanoTime();
|
||||
|
||||
String qualifiedName = className + "." + methodName + descriptor;
|
||||
|
||||
// Check per-method count limit
|
||||
|
|
@ -83,7 +78,6 @@ public final class TraceRecorder {
|
|||
|
||||
// Serialize args — try inline fast path first, fall back to async with timeout
|
||||
byte[] argsBlob;
|
||||
long serStart = System.nanoTime();
|
||||
argsBlob = Serializer.serializeFast(args);
|
||||
if (argsBlob == null) {
|
||||
// Slow path: async serialization with timeout for complex/unknown types
|
||||
|
|
@ -104,15 +98,12 @@ public final class TraceRecorder {
|
|||
return;
|
||||
}
|
||||
}
|
||||
totalSerializationNs.addAndGet(System.nanoTime() - serStart);
|
||||
|
||||
long timeNs = System.nanoTime();
|
||||
count.incrementAndGet();
|
||||
|
||||
writer.recordFunctionCall("call", methodName, className, sourceFile,
|
||||
lineNumber, descriptor, timeNs, argsBlob);
|
||||
|
||||
totalOnEntryNs.addAndGet(System.nanoTime() - entryStart);
|
||||
}
|
||||
|
||||
public void flush() {
|
||||
|
|
@ -139,16 +130,5 @@ public final class TraceRecorder {
|
|||
System.err.println("[codeflash-tracer] Captured " + totalCaptures
|
||||
+ " invocations across " + functionCounts.size() + " methods"
|
||||
+ (dropped > 0 ? " (" + dropped + " dropped due to serialization timeout/failure)" : ""));
|
||||
|
||||
// Timing summary
|
||||
long onEntryMs = totalOnEntryNs.get() / 1_000_000;
|
||||
long serMs = totalSerializationNs.get() / 1_000_000;
|
||||
String writerSummary = writer.getTimingSummary();
|
||||
System.err.println("[codeflash-tracer] Timing: onEntry=" + onEntryMs + "ms"
|
||||
+ " (serialization=" + serMs + "ms)"
|
||||
+ (totalCaptures > 0
|
||||
? " avg=" + String.format("%.2f", (double) onEntryMs / totalCaptures) + "ms/capture"
|
||||
: "")
|
||||
+ " " + writerSummary);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ import java.util.concurrent.BlockingQueue;
|
|||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
public final class TraceWriter {
|
||||
|
||||
|
|
@ -28,10 +26,6 @@ public final class TraceWriter {
|
|||
private final BlockingQueue<WriteTask> writeQueue;
|
||||
private final Thread writerThread;
|
||||
private final AtomicBoolean running;
|
||||
private final AtomicLong totalWriteNs = new AtomicLong(0);
|
||||
private final AtomicInteger batchCount = new AtomicInteger(0);
|
||||
private final AtomicInteger taskCount = new AtomicInteger(0);
|
||||
private volatile long dumpToFileMs = 0;
|
||||
|
||||
private PreparedStatement insertFunctionCall;
|
||||
private PreparedStatement insertMetadata;
|
||||
|
|
@ -150,7 +144,6 @@ public final class TraceWriter {
|
|||
return;
|
||||
}
|
||||
|
||||
long writeStart = System.nanoTime();
|
||||
boolean hasFunctionCalls = false;
|
||||
try {
|
||||
for (WriteTask task : batch) {
|
||||
|
|
@ -176,9 +169,6 @@ public final class TraceWriter {
|
|||
System.err.println("[codeflash-tracer] Rollback failed: " + re.getMessage());
|
||||
}
|
||||
}
|
||||
totalWriteNs.addAndGet(System.nanoTime() - writeStart);
|
||||
batchCount.incrementAndGet();
|
||||
taskCount.addAndGet(batch.size());
|
||||
}
|
||||
|
||||
public void flush() {
|
||||
|
|
@ -192,15 +182,6 @@ public final class TraceWriter {
|
|||
}
|
||||
}
|
||||
|
||||
public String getTimingSummary() {
|
||||
long writeMs = totalWriteNs.get() / 1_000_000;
|
||||
int batches = batchCount.get();
|
||||
int tasks = taskCount.get();
|
||||
return "writes=" + writeMs + "ms (" + tasks + " tasks in " + batches + " batches"
|
||||
+ (batches > 0 ? ", avg=" + String.format("%.1f", (double) tasks / batches) + " tasks/batch" : "")
|
||||
+ ") dump=" + dumpToFileMs + "ms";
|
||||
}
|
||||
|
||||
public void close() {
|
||||
running.set(false);
|
||||
try {
|
||||
|
|
@ -218,7 +199,6 @@ public final class TraceWriter {
|
|||
}
|
||||
|
||||
if (inMemory) {
|
||||
long dumpStart = System.nanoTime();
|
||||
try {
|
||||
connection.commit();
|
||||
connection.setAutoCommit(true);
|
||||
|
|
@ -228,7 +208,6 @@ public final class TraceWriter {
|
|||
} catch (SQLException e) {
|
||||
System.err.println("[codeflash-tracer] Failed to write trace DB to disk: " + e.getMessage());
|
||||
}
|
||||
dumpToFileMs = (System.nanoTime() - dumpStart) / 1_000_000;
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in a new issue