use of com.oracle.truffle.tools.chromeinspector.types.ProfileNode in project graal by oracle.
the class TruffleProfiler method getProfile.
private Params getProfile(Collection<ProfilerNode<CPUSampler.Payload>> rootProfilerNodes, long idleHitCount, long startTime, long endTime) {
Map<ProfilerNode<CPUSampler.Payload>, Integer> node2id = new HashMap<>();
List<ProfileNode> nodes = new ArrayList<>();
List<Profile.TimeLineItem> timeLine = new ArrayList<>();
int[] counter = { 1 };
ProfileNode root = new ProfileNode(counter[0]++, new RuntimeCallFrame("(root)", 0, "", 0, 0), idleHitCount);
nodes.add(root);
fillChildren(root, rootProfilerNodes, node2id, nodes, timeLine, counter);
Collections.sort(timeLine, (item1, item2) -> Long.compare(item1.getTimestamp(), item2.getTimestamp()));
JSONObject json = new JSONObject();
json.put("profile", new Profile(nodes.toArray(new ProfileNode[nodes.size()]), startTime, endTime, timeLine.toArray(new Profile.TimeLineItem[timeLine.size()])).toJSON());
return new Params(json);
}
Aggregations