-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backend self sampling #8309
Backend self sampling #8309
Conversation
engine/language-server/src/main/scala/org/enso/languageserver/profiling/ProfilingManager.scala
Outdated
Show resolved
Hide resolved
import java.util.concurrent.Executor; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
public interface MethodsSampler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sealed interface
is probably what you want with the two implementations being permits
listed.
public void start() {} | ||
|
||
@Override | ||
public void stop() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scheduleStop
could be no-op either.
* Gathers application performance statistics that can be visualised in Java VisualVM, and writes it | ||
* to the provided output. | ||
*/ | ||
public final class OutputStreamSampler implements MethodsSampler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To keep the API's conceptual surface smaller, I'd suggest to make these implementations package private and only expose MethodsSampler
.
} | ||
|
||
public static OutputStreamSampler ofFile(File file) throws FileNotFoundException { | ||
return new OutputStreamSampler(new FileOutputStream(file)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means the stream is open during the whole sampling rather than being opened and close just for the time of stop
ing and writing the data down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some code cleanup notes added. Functionality seems to be fine in spite of them, however.
Pull Request Description
close #8248
Changelog:
profiling/start
request starts the sampler and starts collecting runtime events to the log fileprofiling/stop
request stop the sampler and write the profiling data to the$ENSO_DATA_DIR/profiling
directoryImportant Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.