Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
d-kozak committed Jan 11, 2024
1 parent 7605ebd commit 1af9317
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1701,8 +1701,17 @@ protected int buildImage(List<String> javaArgs, LinkedHashSet<Path> cp, LinkedHa
try {
p = pb.inheritIO().start();
imageBuilderPid = p.pid();
System.out.println("Pid of the image builder is " + imageBuilderPid);
var prophetPluginHome = Objects.requireNonNull(System.getenv("PROPHET_PLUGIN_HOME"),"PROPHET_PLUGIN_HOME not set");
Path.of(prophetPluginHome,"graal-prophet-utils","measure_rss.sh")
var rssWatcher = new ProcessBuilder().command("/Users/dkozak/Projects/graal-prophet/measure_rss.sh", imageBuilderPid + "").inheritIO().start();
installImageBuilderCleanupHook(p);
return p.waitFor();
var before = System.currentTimeMillis();
int resCode = p.waitFor();
var duration = System.currentTimeMillis() - before;
System.out.println("Prophet Plugin took " + duration + " ms");
rssWatcher.waitFor();
return resCode;
} catch (IOException | InterruptedException e) {
throw showError(e.getMessage());
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public static void run(ImageClassLoader loader, AnalysisUniverse aUniverse, Anal
restDump.writeOutEndpoints(module.getEndpoints(), Options.ProphetEndpointOutputFile.getValue());

dumpModule(module);
logger.info("Final summary: " + module.shortSummary());
}

private static void dumpModule(Module module) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.oracle.svm.hosted.prophet.model;

import java.util.Set;
import java.util.List;

public class Module {

Expand All @@ -17,23 +16,36 @@ public Module(Name name, Set<Entity> entities, Set<RestCall> restCalls, Set<Endp
this.restCalls = restCalls;
this.endpoints = endpoints;
}


public String shortSummary() {
return "Module(name=" +
name +
",entities=" +
entities.size() +
",restcalls=" +
restCalls.size() +
",endpoints=" +
endpoints.size() +
')';
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("MODULE NAME = ").append(name).append("\n").append("\nENTITIES = \n").append(setToString(entities))
.append("\nREST_CALLS = \n").append(setToString(restCalls)).append("\nENDPOINTS = \n" ).append(setToString(endpoints))
.append('\n');
.append("\nREST_CALLS = \n").append(setToString(restCalls)).append("\nENDPOINTS = \n").append(setToString(endpoints))
.append('\n');
return sb.toString();
}

private String setToString(Set<?> l){
private String setToString(Set<?> l) {
StringBuilder sb = new StringBuilder();
for (var v : l){
for (var v : l) {
sb.append("\t").append(v.toString()).append("\n");
}
return sb.toString();
}

public Name getName() {
return name;
}
Expand Down

0 comments on commit 1af9317

Please sign in to comment.