Search in sources :

Example 31 with SourceSectionFilter

use of com.oracle.truffle.api.instrumentation.SourceSectionFilter in project graal by oracle.

the class DebuggerSessionSnippets method createBinding.

private EventBinding<? extends ExecutionEventNodeFactory> createBinding(boolean includeInternalCode, Predicate<Source> sFilter, ExecutionEventNodeFactory factory, boolean onInput, Class<?>... tags) {
    Builder builder = SourceSectionFilter.newBuilder().tagIs(tags);
    builder.includeInternal(includeInternalCode);
    if (sFilter != null) {
        builder.sourceIs(new SourceSectionFilter.SourcePredicate() {

            @Override
            public boolean test(Source source) {
                return sFilter.test(source);
            }
        });
    }
    SourceSectionFilter ssf = builder.build();
    if (onInput) {
        return debugger.getInstrumenter().attachExecutionEventFactory(ssf, ssf, factory);
    } else {
        return debugger.getInstrumenter().attachExecutionEventFactory(ssf, factory);
    }
}
Also used : Builder(com.oracle.truffle.api.instrumentation.SourceSectionFilter.Builder) SourceSectionFilter(com.oracle.truffle.api.instrumentation.SourceSectionFilter) Source(com.oracle.truffle.api.source.Source)

Example 32 with SourceSectionFilter

use of com.oracle.truffle.api.instrumentation.SourceSectionFilter in project graal by oracle.

the class CPUTracerSnippets method resetTracer.

private synchronized void resetTracer() {
    assert Thread.holdsLock(this);
    if (activeBinding != null) {
        activeBinding.dispose();
        activeBinding = null;
    }
    if (!collecting || closed) {
        return;
    }
    SourceSectionFilter f = this.filter;
    if (f == null) {
        f = DEFAULT_FILTER;
    }
    this.activeBinding = env.getInstrumenter().attachExecutionEventFactory(f, new ExecutionEventNodeFactory() {

        @Override
        public ExecutionEventNode create(EventContext context) {
            return new CounterNode(getCounter(context));
        }
    });
}
Also used : EventContext(com.oracle.truffle.api.instrumentation.EventContext) ExecutionEventNodeFactory(com.oracle.truffle.api.instrumentation.ExecutionEventNodeFactory) SourceSectionFilter(com.oracle.truffle.api.instrumentation.SourceSectionFilter)

Aggregations

SourceSectionFilter (com.oracle.truffle.api.instrumentation.SourceSectionFilter)32 Test (org.junit.Test)21 StandardTags (com.oracle.truffle.api.instrumentation.StandardTags)7 Source (com.oracle.truffle.api.source.Source)7 ExpressionNode (com.oracle.truffle.api.instrumentation.test.InstrumentationTestLanguage.ExpressionNode)5 MaterializeChildExpressionNode (com.oracle.truffle.api.instrumentation.test.InstrumentationTestLanguage.MaterializeChildExpressionNode)5 MaterializedChildExpressionNode (com.oracle.truffle.api.instrumentation.test.InstrumentationTestLanguage.MaterializedChildExpressionNode)5 ExpressionTag (com.oracle.truffle.api.instrumentation.StandardTags.ExpressionTag)4 InstrumentableNode (com.oracle.truffle.api.instrumentation.InstrumentableNode)3 Node (com.oracle.truffle.api.nodes.Node)3 RootNode (com.oracle.truffle.api.nodes.RootNode)3 EventContext (com.oracle.truffle.api.instrumentation.EventContext)2 ExecutionEventNodeFactory (com.oracle.truffle.api.instrumentation.ExecutionEventNodeFactory)2 Instrumenter (com.oracle.truffle.api.instrumentation.Instrumenter)2 ProbeNode (com.oracle.truffle.api.instrumentation.ProbeNode)2 Builder (com.oracle.truffle.api.instrumentation.SourceSectionFilter.Builder)2 SourceSection (com.oracle.truffle.api.source.SourceSection)2 Source (org.graalvm.polyglot.Source)2 FrameDescriptor (com.oracle.truffle.api.frame.FrameDescriptor)1 AllocationListener (com.oracle.truffle.api.instrumentation.AllocationListener)1