GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add --nostop to always start profiler recording even when --ttsp or --start/--end are used by openorclose · Pull Request #1046 · async-profiler/async-profiler Conversation
|
| _mcache = value == NULL ? 1 : (unsigned char)strtol(value, NULL, 0); | ||
|
|
||
| CASE("recordonly") | ||
| _start_alongside_traps = true; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It's hard to search and follow the logic, when asprof argument, agent argument and the variable in the code are all named differently. Let's use the same name if possible.
My suggestion is nostop (similarly to nostop option for handling signals in gdb), but other suggestions are welcome.
Consequently, arguments and the variable name will be nostop, --nostop, _nostop.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| " --timebetween a b record when a is executed, and then when b is executed, and duration between\n" | ||
| " --onlyttsp only time-to-safepoint profiling \n" | ||
| " --includettsp profile as per normal, but include time-to-safepoint information\n" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I understand you wanted to shortcut certain use cases, but having many options to do the same thing causes unnecessary ambiguity or even confusion, considering that asprof arguments do not match agent arguments.
If we add just one new option (e.g. --nostop as mentioned above), this will be unambiguous, will match agent argument, and will cover all use cases relatively simply. Moreover, it will remain backward compatible.
IMO, --ttsp --nostop is not much worse than --includettsp.
I would probably agree with additional --window A B option to record profiler.Window event between execution of A and B, but this is a quite rare use cases, so it does not deserve a separate option, I think.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Will use nostop for now, anyone else feel free to suggest others
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| params << ",begin=SafepointSynchronize::begin,end=RuntimeService::record_safepoint_synchronized"; | ||
|
|
||
| } else if (arg == "--includettsp") { | ||
| fprintf(stderr, "ZZZZ"); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Debug leftover.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| public void includettsp(TestProcess p) throws Exception { | ||
| p.profile("-d 5 --includettsp -f %f.jfr"); | ||
| if (!containsSamplesOutsideWindow(p)) { | ||
| throw new RuntimeException("Expected to find samples outside of ttsp window, but did not find any"); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
| } | ||
|
|
||
| private boolean containsSamplesOutsideWindow(TestProcess p) throws Exception { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can be shortened and simplified a bit.
events list is redundant; we may collect profiler windows and execution samples in the first pass.TreeMap as startTime->endTime. This will provide sorting and lookup for the closest window out of the box.stream().anyMatch().
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| import java.io.BufferedOutputStream; | ||
| import java.io.FileOutputStream; | ||
|
|
||
| class Ttsp { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This example needs some comments. How does it expose long TTSP issue? Why getAllStackTraces() is called in a loop? Writing 1GB files in a loop may not be a good thing to do in a test - IO is not what we are testing here. Furthermore, not all systems may even have a spare gigabyte in /tmp volume.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I adapted this example from an online article regarding debugging ttsp issues, will rewrite with explanation
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thank you for the PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This reverts commit 6838f04.
Signed-off-by: Andrei Pangin <[email protected]>
| static private byte loop() { | ||
| byte[] byteArray = new byte[1024 * 1024 * 1024]; | ||
| for (int i = 0; i < 10000; i++) { | ||
| new Random().nextBytes(byteArray); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Random.nextBytes contains a loop with a safepoint check - it does not cause long time-to-safepoint pauses.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| public static void main(String[] args) throws Exception { | ||
| new Thread(() -> { | ||
| while (true) { | ||
| System.gc(); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
ThreadMXBean.dumpAllThreads is a much cheaper way to force global safepoint.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
| }).start(); | ||
|
|
||
| Thread.sleep(1000); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Relying on Thread.sleep in tests in error-prone.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| new Thread(() -> { | ||
| while (true) { | ||
| loop(); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
A loop in this example is not very useful. The only long ttsp pause happens the very first time when allocating new byte[1024 * 1024 * 1024] array; there are no ttsp pauses afterwards.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Changes look good, except for the test, which does not really demonstrate time-to-safepoint pauses. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.