Skip to content

Support --only-ticks-over with async-profiler #470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 13, 2025

Conversation

SirYwell
Copy link
Contributor

@SirYwell SirYwell commented Nov 5, 2024

The --only-ticks-over option is extremely useful, but currently causes the profiler to fall back to the Java implementation. This means some insightful information gets lost, e.g. samples during GC pauses or other native frame information.

Supporting the flag with async-profiler isn't exactly straightforward: By default, async-profiler tries to use a CPUs TSC, which makes it difficult to compare times in the JVM. We can force async-profiler to use the Linux monotonic clock, which is the same as the one used by System.nanoTime() (at least in HotSpot). This allows comparing times and filtering out events that occurred outside of a tick that exceeded the threshold.
As events are only processed later, we need to remember the ticks exceeding the threshold temporarily. As events are processed in order, using a queue makes that pretty simple.

This change also allows using the option together with --alloc.

I tried to make the changes as non-intrusive as possible, but maybe there are cleaner ways in some spots. Let me know if you want me to change something.

@lucko lucko force-pushed the feature/async-only-ticks-over branch from 074c142 to 7b49c40 Compare April 13, 2025 10:09
@lucko lucko merged commit fff2950 into lucko:master Apr 13, 2025
3 checks passed
fonnymunkey pushed a commit to fonnymunkey/SparkUnforged that referenced this pull request Jul 9, 2025
Fixed typo in Configuration.getInteger (lucko#353)

Fix parsing null async profiler segments (lucko#354)

Use a different websocket library

Clarify command timeout warning msg

Don't try to send statistics to a closed socket (lucko#357)

Bump adventure versions

Add note to /spark profiler open about expiry time

Bump common dependency versions

Tweak formatting of /spark profiler open note

Include server brand in viewer payloads

Add caveat to warning msg about Java agents

Ignore trailing sleeping samples for duration estimation (lucko#413)

Use WeakReference for command senders (lucko#417)

Refactor ClassFinder into interface

Add JVM information to viewer metadata

Redact username from vm args (lucko#423)

Add placeholder resolver API

Include gamerule settings in metadata (lucko#425)

Add some unit tests

Check for async command completion before sleeping (lucko#431)

Cleanup spark tmp dir on startup

Add more automated tests

Add missing license headers

Relocate net.kyori.option package (lucko#432)

Add uploadable health report (lucko#436)

Allow mod/plugin author field to be null (lucko#442)

Improve unit tests

Refactor sampler node export process

Include engine type in sampler proto

Include datapacks info in sampler proto

Include memory stats in ws updates

Fix activity log unit test

Improve error logging in various places

Tidy up NeoForge/Forge mod init

Support --ignore-sleeping with async-profiler (lucko#467)

Upgrade async-profiler to v3 (lucko#386)

Implement standalone profiling agent (lucko#480)

Fix standalone attach on Windows (lucko#484)

Add extra package relocations for standlone agent (lucko#488)

Support --only-ticks-over with async-profiler (lucko#470)

Upgrade async-profiler to v4

Fix name of temp directory (lucko#502)

Optimise WorldStatisticsProvider regionising (lucko#506)

Fix division by zero error in TPS calculation (lucko#507)
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