Skip to content

Trace duration of classpath container updates#2374

Open
vogella wants to merge 1 commit into
eclipse-pde:masterfrom
vogella:pde-classpath-update-tracing
Open

Trace duration of classpath container updates#2374
vogella wants to merge 1 commit into
eclipse-pde:masterfrom
vogella:pde-classpath-update-tracing

Conversation

@vogella

@vogella vogella commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Adds duration tracing to the PDE classpath update job (UpdateClasspathsJob), gated behind the existing org.eclipse.pde.core/classpath debug option. When enabled, the job traces how long it spent computing the classpath entries, applying the containers to the Java model, and the overall run. This makes it possible to diagnose slow classpath updates from the trace output alone, without attaching a profiler. No behavior changes when tracing is off.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

Test Results

  129 files  ±0    129 suites  ±0   34m 34s ⏱️ - 3m 21s
3 527 tests ±0  3 473 ✅ ±0   54 💤 ±0  0 ❌ ±0 
9 384 runs  ±0  9 254 ✅ ±0  130 💤 ±0  0 ❌ ±0 

Results for commit 74949c2. ± Comparison against base commit dd790b2.

♻️ This comment has been updated with latest results.

@vogella

vogella commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

AFAICS neither the licence check nor the new maven warnings (None touch pde.core. These appear in PR builds but not in the stale reference build #215, so warnings-ng flags them as "new".) are related to this PR.

@vogella

vogella commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

/request-license-review

@github-actions

Copy link
Copy Markdown

/request-license-review

✔️ All licenses already successfully vetted.

Workflow run (with attached summary files):
https://github.com/eclipse-pde/eclipse.pde/actions/runs/27675906909

@vogella vogella force-pushed the pde-classpath-update-tracing branch from d22b77d to 8e988ef Compare June 18, 2026 15:17

@Override
protected IStatus run(IProgressMonitor jobMonitor) {
long startNanos = PDECore.DEBUG_CLASSPATH ? System.nanoTime() : 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the output is in milliseconds, wouldn't it be suitable to use milliseconds from the beginning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The traceRuntime helper keeps nanoTime() and only divides to ms at the end, so the durations stay monotonic (immune to wall-clock adjustments) while the output is in ms as before. Let me know if you'd still prefer currentTimeMillis().

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the durations stay monotonic (immune to wall-clock adjustments)

Have to admit that I haven’t considered that. I'd say that if one modifies a computer's clock it's acceptable to have wrong time recordings in tracing and System.currentTimeMillis() is sufficient (and a bit simpler).

But I'm also fine to keep it, no strict opposition from my side.

@HannesWell HannesWell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be useful to gather more performance data.
Besides the mentioned use of milliseconds I think the repeating tracing code can be unified.
Please see my comment below.
With that applied I'm fine with this.

Comment on lines +222 to +225
private static long elapsedMillis(long startNanos) {
return (System.nanoTime() - startNanos) / 1_000_000L;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The invocation of this uses a repeating pattern, which I suggest to unify to something

Suggested change
private static long elapsedMillis(long startNanos) {
return (System.nanoTime() - startNanos) / 1_000_000L;
}
private void traceRuntime(String msg, long start, Object... args) {
if (PDECore.DEBUG_CLASSPATH) {
long elapsedMillis = (System.nanoTime() - start) / 1_000_000L;
Object[] allArgs = Stream.concat(Stream.of(elapsedMillis), Stream.of(args)).toArray();
PDECore.TRACE.trace(PDECore.KEY_DEBUG_CLASSPATH, String.format(msg, allArgs));
}
}

Which can then be called with (almost) one-liners:

  • traceRuntime("Computed classpath of %2$d project(s) in %1$d ms.", computeNanos, count); //$NON-NLS-1$
  • traceRuntime("Applied classpath container of %2$d project(s) in %1$d ms.", applyNanos, n); //$NON-NLS-1$
  • traceRuntime("UpdateClasspathsJob finished in %d ms: %d request(s), %d updated, %d error(s).", startNanos, count, updateProjects.size(), errorsPerProject.size()); //$NON-NLS-1$

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied, thanks. Folded the three trace blocks into your traceRuntime helper and dropped the separate elapsedMillis method.

@vogella vogella force-pushed the pde-classpath-update-tracing branch from 8e988ef to 140b5a7 Compare June 18, 2026 16:39

@HannesWell HannesWell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks.

@vogella vogella force-pushed the pde-classpath-update-tracing branch from 140b5a7 to c4a1b2a Compare June 19, 2026 09:13
@vogella

vogella commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Build failure seem unrelated.

@HannesWell

HannesWell commented Jun 20, 2026

Copy link
Copy Markdown
Member

Build failure seem unrelated.

See #2380 (comment).
Ideally please hold off submitting this until we have a green build again.

Add duration tracing to the UpdateClasspathsJob, gated behind the
existing org.eclipse.pde.core/classpath debug option. The trace reports
the time spent computing the classpath entries, applying the containers
to the Java model, and the overall job, so slow classpath updates can be
diagnosed without a profiler.
@HannesWell HannesWell force-pushed the pde-classpath-update-tracing branch from c4a1b2a to 74949c2 Compare June 20, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants