-
Notifications
You must be signed in to change notification settings - Fork 937
Allow VMX to work on native applications #1354
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
Conversation
src/profiler.cpp
Outdated
| } else if (_cstack == CSTACK_LBR && _engine != &perf_events) { | ||
| return Error("Branch stack is supported only with PMU events"); | ||
| } else if (_cstack >= CSTACK_VM && !VMStructs::hasStackStructs()) { | ||
| } else if (_cstack == CSTACK_VM && !VMStructs::hasStackStructs()) { |
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.
This check should not be simply disabled. We should not let users select vmx mode if the target JVM does not really support it (e.g. Zing, OpenJ9), or if it is new version of HotSpot where some VM structures have been changed. Otherwise this may lead to JVM crash.
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.
updated check here 89f10a4
The check specifically check that libjvm is loaded & attached to the profiler now
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.
VM::loaded() is the canonical way to check JVM presence.
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.
It seems I forgot about that function, thanks for the catch
updated here d1a07f8
…resent within the profiler
src/profiler.cpp
Outdated
| } else if (args._cstack == CSTACK_LBR && _engine != &perf_events) { | ||
| return Error("Branch stack is supported only with PMU events"); | ||
| } else if (args._cstack >= CSTACK_VM && !VMStructs::hasStackStructs()) { | ||
| } else if (_cstack >= CSTACK_VM && VM::loaded() && !VMStructs::hasStackStructs()) { |
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.
args._cstack
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.
Sorry my bad in copy & paste,
handled here 4de1eb4
test/test/nonjava/NonjavaTests.java
Outdated
|
|
||
| // jvm is loaded before the profiling session is started | ||
| @Test(sh = "%testbin/non_java_app 1 %s.html", output = true) | ||
| @Test(sh = "%testbin/non_java_app 1 %s.jfr", output = true) |
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.
Why did you change it to use jfr format?
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.
2 main reasons,
- Most other tests use jfr so I changed it to be more inline
- JFR offers more debug information & is easier to debug in CLI compared to flame-graph
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.
This does not seem correct to me.
Originally, most of tests used collapsed format as it is easiest to parse and human readable at the same time.
Only those tests that require access to individual events used JFR, e.g. multi-event profiling and leak profiling.
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.
Should I revert this to html or convert it to collapsed?
IMO for this context I think collapsed makes more sense than the original html as I'm checking if the stack contains certain function calls
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.
Change it to collapsed
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.
changed here a03bba9
Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331) Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331)
Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331) Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331)
Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331) Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331)
Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331) Disable JFR OldObjectSample event in jfrsync mode (async-profiler#1350) Fix invalid alignment in mallocTracer and zero-init buf in getTotalCpuTime (async-profiler#1351) C++ linting via clang-tidy (async-profiler#1338) Allow cstack=vmx for native applications (async-profiler#1354) Correctly unwind stack for malloc events in VM stack walking mode (async-profiler#1357) Simplify location handling in OTLP (async-profiler#1361) Suppress javac warnings when compiling tests Do not include excess files in test.jar Fix nonjava test failure on Alpine Auto-generated clang-tidy review comments (async-profiler#1360) JFR to OTLP converter (async-profiler#1336) Cancel redundant in-progress GHA runs (async-profiler#1363) Ensure that only files under `src/` are checked in `cpp-lint-diff` (async-profiler#1365) Publish clang-tidy comments only for non-draft PRs (async-profiler#1367) Give tests unique suffix names (async-profiler#1371) Test OTLP output format (async-profiler#1331)
Description
Allow VMX stack walking to work on applications without checking if JVM is present or not.
Previously any continuous profiling agent on a native application would have to use other stack walking modes.
Those stack walking modes once a JVM is detected will start to use AsyncGetCallTrace method which is error prone.
The VMX makes sense for such native applications (applications that start a JVM instance) as they need both native stack & java stack unwinding
Related issues
N/A
Motivation and context
Allow continuous profiling on native application using VMX
How has this been tested?
test/test/nonjava/NonjavaTests.java was changed to use VMX
make testBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.