Search in sources :

Example 1 with AllocationCounter

use of com.oracle.svm.core.allocationprofile.AllocationCounter in project graal by oracle.

the class AllocationSnippets method addCounterArgs.

public static void addCounterArgs(Arguments args, ValueNode node, ResolvedJavaType type) {
    AllocationCounter counter = null;
    if (AllocationSite.Options.AllocationProfiling.getValue()) {
        String siteName = "[others]";
        if (node.getNodeSourcePosition() != null) {
            siteName = node.getNodeSourcePosition().getMethod().asStackTraceElement(node.getNodeSourcePosition().getBCI()).toString();
        }
        String className = "[dynamic]";
        if (type != null) {
            className = type.toJavaName(true);
        }
        AllocationSite allocationSite = AllocationSite.lookup(siteName, className);
        String counterName = node.graph().name;
        if (counterName == null) {
            counterName = node.graph().method().format("%H.%n(%p)");
        }
        counter = allocationSite.createCounter(counterName);
    }
    args.add("counter", counter);
}
Also used : AllocationCounter(com.oracle.svm.core.allocationprofile.AllocationCounter) AllocationSite(com.oracle.svm.core.allocationprofile.AllocationSite)

Aggregations

AllocationCounter (com.oracle.svm.core.allocationprofile.AllocationCounter)1 AllocationSite (com.oracle.svm.core.allocationprofile.AllocationSite)1