GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Prefer perf-events engine when record-cpu or target-cpu are selected by Baraa-Hasheesh · Pull Request #1654 · async-profiler/async-profiler

Conversation

@Baraa-Hasheesh

@Baraa-Hasheesh Baraa-Hasheesh commented Jan 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Description

While running recordCpuMultiEngine test in virtualized environments, event=cpu resulted in using ctimer which in turn caused the test to fail due to selecting record-cpu with a non perf event engine

However other tests that already use cpu-clock passed just fine, as perf events will automatically skip _kernel_stack if not supported

If a user selects event=cpu with record-cpu/target-cpu, the user intentions are clear, perf events are desired as such additional checks where added to prefer perf events if such cases are observed on the user inputs

Note: in worst case we will be replacing one error with another

  • Old error will be that the record-cpu/target-cpu are only supported on perf events
  • New error if perf events are not supported will be that perf events aren't supported/creating perf events failed

Related issues

N/A

Motivation and context

Better following of user intentions when using event=cpu

How has this been tested?

make test


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Baraa-Hasheesh
Explicit usage of cpu-clock for event
d83e302
apangin
apangin reviewed Jan 13, 2026
View reviewed changes
Comment thread test/test/jfr/JfrTests.java Outdated
}

@Test(mainClass = CpuLoad.class, agentArgs = "start,event=cpu,wall,record-cpu,file=%profile.jfr", os = Os.LINUX)
@Test(mainClass = CpuLoad.class, agentArgs = "start,event=cpu-clock,wall,record-cpu,file=%profile.jfr", os = Os.LINUX)

@apangin apangin Jan 13, 2026

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Does it make sense to choose perf_events in selectEngine if event=cpu and either of record-cpu or target-cpu options is specified?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Baraa-Hasheesh Baraa-Hasheesh Jan 13, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I mean it's either perf engine is not selected & you get an error or perf event isn't supported & you also get an error

So it does make sense to go with option 2 as it's less likely to error out as if kernel symbols aren't supported it will run in user mode, should I update this PR to add that change?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Baraa-Hasheesh Baraa-Hasheesh Jan 14, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I added the conditions for that 5878526

As a side effect of the change if the user selects these options with cpu on macOS it will fail due to unsupported perf events, which should be fine as it would have previously failed due not selecting perf events

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@apangin apangin Jan 14, 2026

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good, thanks. Shall we revert the test back to event=cpu to have this code path executed?
Please also update PR title/description to reflect new fix.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Baraa-Hasheesh Baraa-Hasheesh Jan 15, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Baraa-Hasheesh added 3 commits January 14, 2026 09:11
@Baraa-Hasheesh
use perf in case of event=cpu & perf specific options
5878526
@Baraa-Hasheesh
use -1
42874f0
@Baraa-Hasheesh
event=cpu
77fa961
@Baraa-Hasheesh Baraa-Hasheesh changed the title Update recordCpuMultiEngine test to use cpu-clock always Prefer perf-events engine when record-cpu or target-cpu are selected Jan 15, 2026
@apangin
apangin merged commit a89d7dd into async-profiler:master Jan 15, 2026
27 checks passed

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Jan 20, 2026
Event=cpu not switching alluser flag when kernel symbols are not available #1663
Closed
Fix test failures when restrictions exist on kernel symbols #1664
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@apangin apangin apangin left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Baraa-Hasheesh @apangin
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.