Closed Pyrolistical closed 9 years ago
Thanks for the contrib !
Do you know why/when honest profiler does not output a Method section ? Have you notified Richard Warburton ? I am happy to add this option if it is helpful to you, but I believe that eventually we should try to fix the agent.
Regarding --skip-sleep I merged your code but I am not sure to understand how you got a Thread.sleep in the log file. It should be invisible. Could you provide me a test case ?
Why do you expect Thread.sleep to be invisible?
The profiler is SIGPROF based so asleep threads won't receive the signal.
I wrote a few test cases and never saw a single Thread.sleep in the profiler output so I am very interested by a test case.
Here is a the repo case for Thread.sleep.
package com.github.pyrolistical.profiler.bug;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.junit.Test;
import com.google.common.base.Charsets;
import com.google.common.hash.Hashing;
public class SIGPROFvsSleep {
@Test
public void willWeRecordThreadSleep() throws Exception {
Future work = Executors.newSingleThreadExecutor().submit(new Runnable() {
@Override
public void run() {
String hash = "hello world";
for (int i = 0; i < 1000000; i++) {
hash = Hashing.sha512().hashString(hash, Charsets.UTF_8).toString();
}
System.out.println(hash);
}
});
Thread.sleep(1000);
work.get();
}
}
I ran this with intellij with vm option of: -ea -agentpath:path/to/honest-profiler/build/liblagent.dylib
I generated the graph with:
stackcollapse_hpl.py --skip-trace-on-missing-frame log-5615-1417471907767.hpl | flamegraph.pl --width 1600 - > result.svg
I did have to use skip-trace-on-missing-frame, might use this as a repo case for the honest profiler as well.
I believe that the Thread.sleep issue is OS X related. Its SIGPROF implementation is a bit funky. I posted a message on the honest-profiler mailing list: https://groups.google.com/forum/#!topic/honest-profiler/W0FI_OEU75M
Sometimes Honest-profiler generates a broken hpl that contains missing frames within a trace.
--skip-trace-on-missing-frame
skips those frames instead of crashing.Also I did not like how much space
java.lang.Thread.sleep
methods were taking up, so I added--skip-sleep
to remove them.