mirror of
https://github.com/enso-org/enso.git
synced 2024-11-25 10:43:02 +03:00
DRAFT: profiling
This commit is contained in:
parent
ba199d796d
commit
f38c358441
@ -140,7 +140,7 @@ function gatewayServer(): Plugin {
|
||||
buildEnd() {
|
||||
if (ydocServer == null) return
|
||||
|
||||
ydocServer.kill(9)
|
||||
ydocServer.kill('SIGTERM')
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -1184,7 +1184,10 @@ lazy val `ydoc-server` = project
|
||||
shouldContainAll = true
|
||||
)
|
||||
},
|
||||
modulePath += (`syntax-rust-definition` / Compile / productDirectories).value.head,
|
||||
modulePath ++= Seq(
|
||||
(`syntax-rust-definition` / Compile / productDirectories).value.head,
|
||||
(`profiling-utils` / Compile / productDirectories).value.head
|
||||
),
|
||||
libraryDependencies ++= Seq(
|
||||
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion,
|
||||
"org.graalvm.polyglot" % "inspect" % graalMavenPackagesVersion % "runtime",
|
||||
@ -1198,6 +1201,7 @@ lazy val `ydoc-server` = project
|
||||
)
|
||||
.dependsOn(`syntax-rust-definition`)
|
||||
.dependsOn(`logging-service-logback`)
|
||||
.dependsOn(`profiling-utils`)
|
||||
|
||||
lazy val `persistance` = (project in file("lib/java/persistance"))
|
||||
.settings(
|
||||
|
@ -3,6 +3,7 @@ module org.enso.ydoc {
|
||||
requires io.helidon.webclient.websocket;
|
||||
requires io.helidon.webserver;
|
||||
requires io.helidon.webserver.websocket;
|
||||
requires org.enso.profiling;
|
||||
requires org.enso.syntax;
|
||||
requires org.graalvm.polyglot;
|
||||
requires org.slf4j;
|
||||
|
@ -1,7 +1,10 @@
|
||||
package org.enso.ydoc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executors;
|
||||
import org.enso.profiling.sampler.OutputStreamSampler;
|
||||
import org.enso.ydoc.polyfill.ParserPolyfill;
|
||||
import org.enso.ydoc.polyfill.web.WebEnvironment;
|
||||
import org.graalvm.polyglot.Source;
|
||||
@ -10,12 +13,25 @@ import org.graalvm.polyglot.io.IOAccess;
|
||||
public class Main {
|
||||
|
||||
private static final String YDOC_SERVER_PATH = "/dist/assets/ydocServer.js";
|
||||
private static final String SAMPLES_PATH = "/tmp/ydoc-server.out";
|
||||
|
||||
private Main() {}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
var ydoc = Main.class.getResource(YDOC_SERVER_PATH);
|
||||
var contextBuilder = WebEnvironment.createContext().allowIO(IOAccess.ALL);
|
||||
var sampler = OutputStreamSampler.ofFile(new File(SAMPLES_PATH));
|
||||
sampler.start();
|
||||
Runtime.getRuntime()
|
||||
.addShutdownHook(
|
||||
new Thread(
|
||||
() -> {
|
||||
try {
|
||||
sampler.stop();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}));
|
||||
|
||||
try (var executor = Executors.newSingleThreadExecutor();
|
||||
var parser = new ParserPolyfill()) {
|
||||
|
@ -249,6 +249,7 @@ public class WebSocketTest {
|
||||
session.send(buffer, last);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPing(WsSession session, BufferData buffer) {
|
||||
session.pong(buffer);
|
||||
}
|
||||
|
4
lib/scala/profiling-utils/src/main/java/module-info.java
Normal file
4
lib/scala/profiling-utils/src/main/java/module-info.java
Normal file
@ -0,0 +1,4 @@
|
||||
module org.enso.profiling {
|
||||
exports org.enso.profiling.sampler;
|
||||
exports org.enso.profiling.events;
|
||||
}
|
Loading…
Reference in New Issue
Block a user