GeezerVison is showing github.com — Initial loongarch port by xiangzhai · Pull Request #770 · async-profiler/async-profiler
Conversation
Hi,
I want to port the great async-profiler tool for LoongArch Architecture.
Passed test:
$ make test
test/smoke-test.sh
+ '[' -z /mnt/jdk-17.0.7 ']'
++ dirname test/smoke-test.sh
+ cd test
+ '[' Target.class -ot Target.java ']'
+ FILENAME=/tmp/java.trace
+ JAVAPID=7142
+ sleep 1
+ /mnt/jdk-17.0.7/bin/java Target
Starting...
+ ../build/bin/asprof -f /tmp/java.trace -o collapsed -d 5 7142
Profiling started
Profiling for 5 seconds
Done
+ kill 7142
+ assert_string 'Target.main;Target.method1 '
+ grep -q 'Target.main;Target.method1 ' /tmp/java.trace
+ assert_string 'Target.main;Target.method2 '
+ grep -q 'Target.main;Target.method2 ' /tmp/java.trace
+ assert_string 'Target.main;Target.method3;java/io/File'
+ grep -q 'Target.main;Target.method3;java/io/File' /tmp/java.trace
test/thread-smoke-test.sh
+ '[' -z /mnt/jdk-17.0.7 ']'
++ dirname test/thread-smoke-test.sh
+ cd test
+ '[' ThreadsTarget.class -ot ThreadsTarget.java ']'
+ FILENAME=/tmp/java.trace
++ ls ../build/lib/libasyncProfiler.so
+ /mnt/jdk-17.0.7/bin/java -agentpath:../build/lib/libasyncProfiler.so=start,event=cpu,collapsed,threads,file=/tmp/java.trace ThreadsTarget
Profiling started
+ assert_string '\[ThreadEarlyEnd tid=[0-9]\+\];.*ThreadsTarget.methodForThreadEarlyEnd;.*'
+ grep -q '\[ThreadEarlyEnd tid=[0-9]\+\];.*ThreadsTarget.methodForThreadEarlyEnd;.*' /tmp/java.trace
+ assert_string '\[RenamedThread tid=[0-9]\+\];.*ThreadsTarget.methodForRenamedThread;.*'
+ grep -q '\[RenamedThread tid=[0-9]\+\];.*ThreadsTarget.methodForRenamedThread;.*' /tmp/java.trace
test/alloc-smoke-test.sh
+ '[' -z /mnt/jdk-17.0.7 ']'
++ dirname test/alloc-smoke-test.sh
+ cd test
+ '[' AllocatingTarget.class -ot AllocatingTarget.java ']'
+ FILENAME=/tmp/java.trace
+ JAVAPID=7214
+ sleep 1
+ /mnt/jdk-17.0.7/bin/java AllocatingTarget
+ ../build/bin/asprof -f /tmp/java.trace -o collapsed -d 5 -e alloc -t 7214
Profiling started
Profiling for 5 seconds
Done
+ kill 7214
+ assert_string '\[AllocThread-1 tid=[0-9]\+\];.*AllocatingTarget.allocate;.*java.lang.Integer\[\]'
+ grep -q '\[AllocThread-1 tid=[0-9]\+\];.*AllocatingTarget.allocate;.*java.lang.Integer\[\]' /tmp/java.trace
+ assert_string '\[AllocThread-2 tid=[0-9]\+\];.*AllocatingTarget.allocate;.*int\[\]'
+ grep -q '\[AllocThread-2 tid=[0-9]\+\];.*AllocatingTarget.allocate;.*int\[\]' /tmp/java.trace
test/load-library-test.sh
+ '[' -z /mnt/jdk-17.0.7 ']'
++ dirname test/load-library-test.sh
+ cd test
+ '[' LoadLibraryTest.class -ot LoadLibraryTest.java ']'
+ FILENAME=/tmp/java.trace
+ JAVAPID=7249
+ sleep 1
++ ls ../build/lib/libasyncProfiler.so
+ /mnt/jdk-17.0.7/bin/java -agentpath:../build/lib/libasyncProfiler.so LoadLibraryTest
+ ../build/bin/asprof -f /tmp/java.trace -o collapsed -d 5 -i 1ms 7249
Profiling started
Profiling for 5 seconds
Done
+ kill 7249
+ assert_string Java_sun_management
+ grep -q Java_sun_management /tmp/java.trace
test/fdtransfer-smoke-test.sh
++ uname -s
+ UNAME_S=Linux
+ '[' Linux '!=' Linux ']'
+ '[' -z /mnt/jdk-17.0.7 ']'
++ dirname test/fdtransfer-smoke-test.sh
+ cd test
+ '[' Target.class -ot Target.java ']'
+ FILENAME=/tmp/java.trace
+ JAVAPID=7287
+ /mnt/jdk-17.0.7/bin/java Target
+ sleep 1
Starting...
+ sudo ../build/bin/asprof -f /tmp/java.trace -o collapsed -e cpu -i 1ms --fdtransfer -d 5 7287
Profiling started
Profiling for 5 seconds
Done
+ kill 7287
+ assert_string 'Target.main;Target.method1 '
+ grep -q 'Target.main;Target.method1 ' /tmp/java.trace
+ assert_string 'Target.main;Target.method2 '
+ grep -q 'Target.main;Target.method2 ' /tmp/java.trace
+ assert_string 'Target.main;Target.method3;java/io/File'
+ grep -q 'Target.main;Target.method3;java/io/File' /tmp/java.trace
+ assert_string sys_getdents
+ grep -q sys_getdents /tmp/java.trace
echo "All tests passed"
All tests passed
And profile the cpu event for SPECjvm2008 benchmark xml.validation:
/mnt/jdk-17.0.7/bin/java -agentpath:/mnt/repo/async-profiler/build/lib/libasyncProfiler.so=start,event=cpu,file=profile.html -jar SPECjvm2008.jar -ict -ikv -coe -crf false -ctf false -chf false xml.validation
The profile.html shown as below:

Thanks,
Leslie Zhai
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Would you like to update the PR according to the latest changes, so it could be considered for inclusion in the next release? Thanks.
|
theaoqi reacted with thumbs up emoji
xiangzhai reacted with heart emoji
All reactions
-
👍
1 reaction
-
❤️
1 reaction
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
xiangzhai
commented
Nov 30, 2023
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
Hi @apangin
I rebase my patch.
All tests passed:
$ make test
test/smoke-test.sh
+ '[' -z /usr/lib/jvm/java-11-openjdk-loongarch64 ']'
++ dirname test/smoke-test.sh
+ cd test
+ '[' Target.class -ot Target.java ']'
+ FILENAME=/tmp/java.trace
+ JAVAPID=7124
+ sleep 1
+ /usr/lib/jvm/java-11-openjdk-loongarch64/bin/java Target
Starting...
+ ../build/bin/asprof -f /tmp/java.trace -o collapsed -d 5 -L error 7124
Profiling for 5 seconds
Done
+ kill 7124
+ assert_string 'Target.main;Target.method1 '
+ grep -q 'Target.main;Target.method1 ' /tmp/java.trace
+ assert_string 'Target.main;Target.method2 '
+ grep -q 'Target.main;Target.method2 ' /tmp/java.trace
+ assert_string 'Target.main;Target.method3;java/io/File'
+ grep -q 'Target.main;Target.method3;java/io/File' /tmp/java.trace
test/thread-smoke-test.sh
Profiling started
+ '[' -z /usr/lib/jvm/java-11-openjdk-loongarch64 ']'
++ dirname test/thread-smoke-test.sh
+ cd test
+ '[' ThreadsTarget.class -ot ThreadsTarget.java ']'
+ FILENAME=/tmp/java.trace
++ ls ../build/lib/libasyncProfiler.so
+ /usr/lib/jvm/java-11-openjdk-loongarch64/bin/java -agentpath:../build/lib/libasyncProfiler.so=start,event=cpu,collapsed,threads,file=/tmp/java.trace,loglevel=error ThreadsTarget
Profiling started
+ assert_string '\[ThreadEarlyEnd tid=[0-9]\+\];.*ThreadsTarget.methodForThreadEarlyEnd;.*'
+ grep -q '\[ThreadEarlyEnd tid=[0-9]\+\];.*ThreadsTarget.methodForThreadEarlyEnd;.*' /tmp/java.trace
+ assert_string '\[RenamedThread tid=[0-9]\+\];.*ThreadsTarget.methodForRenamedThread;.*'
+ grep -q '\[RenamedThread tid=[0-9]\+\];.*ThreadsTarget.methodForRenamedThread;.*' /tmp/java.trace
test/alloc-smoke-test.sh
+ '[' -z /usr/lib/jvm/java-11-openjdk-loongarch64 ']'
++ dirname test/alloc-smoke-test.sh
+ cd test
+ '[' AllocatingTarget.class -ot AllocatingTarget.java ']'
+ FILENAME=/tmp/java.trace
+ /usr/lib/jvm/java-11-openjdk-loongarch64/bin/java AllocatingTarget
+ JAVAPID=7192
+ sleep 1
+ ../build/bin/asprof -f /tmp/java.trace -o collapsed -d 5 -e alloc -t 7192
[WARN] Install JVM debug symbols to improve profile accuracy
Profiling for 5 seconds
Done
+ kill 7192
+ assert_string '\[AllocThread-1 tid=[0-9]\+\];.*AllocatingTarget.allocate;.*java.lang.Integer\[\]'
+ grep -q '\[AllocThread-1 tid=[0-9]\+\];.*AllocatingTarget.allocate;.*java.lang.Integer\[\]' /tmp/java.trace
+ assert_string '\[AllocThread-2 tid=[0-9]\+\];.*AllocatingTarget.allocate;.*int\[\]'
+ grep -q '\[AllocThread-2 tid=[0-9]\+\];.*AllocatingTarget.allocate;.*int\[\]' /tmp/java.trace
Profiling started
test/load-library-test.sh
+ '[' -z /usr/lib/jvm/java-11-openjdk-loongarch64 ']'
++ dirname test/load-library-test.sh
+ cd test
+ '[' LoadLibraryTest.class -ot LoadLibraryTest.java ']'
+ FILENAME=/tmp/java.trace
+ JAVAPID=7225
+ sleep 2
++ ls ../build/lib/libasyncProfiler.so
+ /usr/lib/jvm/java-11-openjdk-loongarch64/bin/java -agentpath:../build/lib/libasyncProfiler.so LoadLibraryTest
+ ../build/bin/asprof -f /tmp/java.trace -o collapsed -d 5 -i 1ms -L error 7225
Profiling for 5 seconds
Done
+ kill 7225
+ assert_string Java_sun_management
+ grep -q Java_sun_management /tmp/java.trace
test/fdtransfer-smoke-test.sh
Profiling started
++ uname -s
+ UNAME_S=Linux
+ '[' Linux '!=' Linux ']'
+ '[' -z /usr/lib/jvm/java-11-openjdk-loongarch64 ']'
++ dirname test/fdtransfer-smoke-test.sh
+ cd test
+ '[' Target.class -ot Target.java ']'
+ FILENAME=/tmp/java.trace
+ /usr/lib/jvm/java-11-openjdk-loongarch64/bin/java Target
+ JAVAPID=7261
+ sleep 1
Starting...
+ sudo ../build/bin/asprof -f /tmp/java.trace -o collapsed -e cpu -i 1ms -L error --fdtransfer -d 5 7261
Profiling for 5 seconds
Done
+ kill 7261
+ assert_string 'Target.main;Target.method1 '
+ grep -q 'Target.main;Target.method1 ' /tmp/java.trace
+ assert_string 'Target.main;Target.method2 '
+ grep -q 'Target.main;Target.method2 ' /tmp/java.trace
+ assert_string 'Target.main;Target.method3;java/io/File'
+ grep -q 'Target.main;Target.method3;java/io/File' /tmp/java.trace
Profiling started
+ assert_string sys_getdents
+ grep -q sys_getdents /tmp/java.trace
echo "All tests passed"
All tests passed
Please review it.
Thanks,
Leslie Zhai
|
apangin reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
Thank for the contribution; PR has been merged.
|
theaoqi and xiangzhai reacted with hooray emoji
xiangzhai reacted with heart emoji
All reactions
-
🎉
2 reactions
-
❤️
1 reaction
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
apangin
Awaiting requested review from apangin
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
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.
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.
|