Skip to content

Commit 08aa94c

Browse files
committed
perf: reduce java-tracer E2E to single function for ~11 min target
Drop repeatString from the Workload fixture (2→1 function). computeSum alone exercises the full tracer→optimizer pipeline (trace → replay tests → optimize → evaluate → rank → explain → review). The second function added no additional pipeline coverage.
1 parent 46957e1 commit 08aa94c

2 files changed

Lines changed: 3 additions & 16 deletions

File tree

tests/test_languages/fixtures/java_tracer_e2e/src/main/java/com/example/Workload.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,15 @@ public static int computeSum(int n) {
1010
return sum;
1111
}
1212

13-
public static String repeatString(String s, int count) {
14-
String result = "";
15-
for (int i = 0; i < count; i++) {
16-
result = result + s;
17-
}
18-
return result;
19-
}
20-
2113
public static void main(String[] args) {
22-
// Run methods with large inputs so JFR can capture CPU samples.
14+
// Run with large inputs so JFR can capture CPU samples.
2315
// Small inputs finish too fast (<1ms) for JFR's 10ms sampling interval.
24-
// 100 rounds is enough for JFR to collect ~10 samples per function.
2516
for (int round = 0; round < 100; round++) {
2617
computeSum(100_000);
27-
repeatString("hello world ", 1000);
2818
}
2919

3020
// Also call with small inputs for variety in traced args
3121
System.out.println("computeSum(100) = " + computeSum(100));
32-
System.out.println("repeatString(\"ab\", 3) = " + repeatString("ab", 3));
3322

3423
System.out.println("Workload complete.");
3524
}

tests/test_languages/test_java/test_java_tracer_e2e.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,11 @@ def test_agent_captures_invocations(self, compiled_workload: Path, trace_db: Pat
8181
conn = sqlite3.connect(str(trace_db))
8282
try:
8383
rows = conn.execute("SELECT function, classname, descriptor, length(args) FROM function_calls").fetchall()
84-
assert len(rows) >= 3, f"Expected at least 3 captured invocations, got {len(rows)}"
84+
assert len(rows) >= 2, f"Expected at least 2 captured invocations, got {len(rows)}"
8585

8686
# Check that specific methods were captured
8787
functions = {row[0] for row in rows}
8888
assert "computeSum" in functions
89-
assert "repeatString" in functions
9089

9190
# Verify all rows have non-empty args blobs
9291
for row in rows:
@@ -95,7 +94,7 @@ def test_agent_captures_invocations(self, compiled_workload: Path, trace_db: Pat
9594
# Verify metadata
9695
metadata = dict(conn.execute("SELECT key, value FROM metadata").fetchall())
9796
assert "totalCaptures" in metadata
98-
assert int(metadata["totalCaptures"]) >= 3
97+
assert int(metadata["totalCaptures"]) >= 2
9998
finally:
10099
conn.close()
101100

@@ -294,7 +293,6 @@ def test_full_trace_and_replay_generation(self, compiled_workload: Path, tmp_pat
294293
assert len(workload_files) == 1
295294
content = workload_files[0].read_text(encoding="utf-8")
296295
assert "replay_computeSum" in content
297-
assert "replay_repeatString" in content
298296

299297
def test_package_detection(self) -> None:
300298
"""Test that package detection finds Java packages from source files."""

0 commit comments

Comments
 (0)