Hacker News new | ask | show | jobs
by beothorn 952 days ago
I took a better look. This, as other profilers, work by sampling the process, getting the stack trace all at once.

This is either getting it from tooling baked on the kernel (that is why it doesn't work on windows) or getting the stack sample from the JVM (see the tiny-profiler from part-time nerd above)

Sampling makes sense if you want to be as much non intrusive as possible. That is not how JavaFlame works.

What I do is injecting byte code on every function that matches the filters. This code will update a custom stack that stores not only the function name, but also uses reflection to get the argument and their values. In exit, it also records the return value.

It does record the time the function took to run, but this includes the time to get the values from the arguments. It is not exact, but it is good enough to get an idea of the overall logic.

In short, I don't think you can have the argument values with sampling.