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 — Initial loongarch port by xiangzhai · Pull Request #770 · async-profiler/async-profiler

Conversation

@xiangzhai

@xiangzhai xiangzhai commented Jul 13, 2023

Copy link
Copy Markdown
Contributor

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:

2023-07-13 17 08 47

Thanks,
Leslie Zhai

Sorry, something went wrong.

Uh oh!

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

All reactions
@apangin

apangin commented Nov 29, 2023

Copy link
Copy Markdown
Collaborator

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 Leslie Zhai
Initial loongarch64 port
2fe7c4d
@xiangzhai

xiangzhai commented Nov 30, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

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
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@xiangzhai Leslie Zhai
Update StackFrame for loongarch
e198f3a
apangin
apangin reviewed Nov 30, 2023
View reviewed changes
Comment thread src/arch.h Resolved

Uh oh!

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

Comment thread src/stackFrame_loongarch64.cpp Resolved

Uh oh!

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

Comment thread Makefile Resolved

Uh oh!

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

@xiangzhai Leslie Zhai
Remove no longer used ADJUST_RET and rewrite ARCH_TAG with findstring…
5aa5d10
… function
@xiangzhai
xiangzhai requested a review from apangin December 1, 2023 01:20
apangin
apangin approved these changes Dec 1, 2023
View reviewed changes
@xiangzhai Leslie Zhai
Fix Rmethod and Rsender according to loongson jdk11u register_loongarch
09cb604
@xiangzhai
xiangzhai requested a review from apangin December 1, 2023 02:05
xiangzhai added 2 commits December 1, 2023 10:14
@xiangzhai Leslie Zhai
Fix c_rarg0 according to loongson jdk11u register_loongarch
aae540b
@xiangzhai Leslie Zhai
Fix jarg0 typo
012b885
@apangin
apangin merged commit 104b7bd into async-profiler:master Dec 1, 2023
@apangin

apangin commented Dec 1, 2023

Copy link
Copy Markdown
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@apangin apangin Awaiting requested review from apangin

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

@xiangzhai @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.