Search in sources :

Example 6 with InstrumentInfo

use of com.oracle.truffle.api.InstrumentInfo in project graal by oracle.

the class TruffleRuntime method enable.

@Override
public void enable() {
    if (contextListener == null) {
        contextListener = new ContextListener();
        context.addListener(contextListener);
        InstrumentInfo instrumentInfo = context.getEnv().getInstruments().get(OutputConsumerInstrument.ID);
        context.getEnv().lookup(instrumentInfo, Enabler.class).enable();
        OutputHandler oh = context.getEnv().lookup(instrumentInfo, OutputHandler.Provider.class).getOutputHandler();
        oh.setOutListener(new ConsoleOutputListener("log"));
        oh.setErrListener(new ConsoleOutputListener("error"));
    }
}
Also used : InstrumentInfo(com.oracle.truffle.api.InstrumentInfo) Enabler(com.oracle.truffle.tools.chromeinspector.instrument.Enabler)

Example 7 with InstrumentInfo

use of com.oracle.truffle.api.InstrumentInfo in project graal by oracle.

the class TruffleRuntime method disable.

@Override
public void disable() {
    if (contextListener != null) {
        InstrumentInfo instrumentInfo = context.getEnv().getInstruments().get(OutputConsumerInstrument.ID);
        context.getEnv().lookup(instrumentInfo, Enabler.class).disable();
        context.removeListener(contextListener);
        contextListener = null;
    }
}
Also used : InstrumentInfo(com.oracle.truffle.api.InstrumentInfo) Enabler(com.oracle.truffle.tools.chromeinspector.instrument.Enabler)

Aggregations

InstrumentInfo (com.oracle.truffle.api.InstrumentInfo)7 Enabler (com.oracle.truffle.tools.chromeinspector.instrument.Enabler)5 Test (org.junit.Test)2 TruffleLanguage (com.oracle.truffle.api.TruffleLanguage)1 TruffleInstrument (com.oracle.truffle.api.instrumentation.TruffleInstrument)1 LanguageInfo (com.oracle.truffle.api.nodes.LanguageInfo)1 CPUSampler (com.oracle.truffle.tools.profiler.CPUSampler)1 CPUTracer (com.oracle.truffle.tools.profiler.CPUTracer)1 IOException (java.io.IOException)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Instrument (org.graalvm.polyglot.Instrument)1 PolyglotException (org.graalvm.polyglot.PolyglotException)1