Search in sources :

Example 1 with Builder

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

the class Profiler method reset.

// Reconfigure what's being collected; does not affect collected data
private void reset() {
    if (binding != null) {
        binding.dispose();
        binding = null;
    }
    if (isCollecting) {
        final Builder filterBuilder = SourceSectionFilter.newBuilder();
        if (mimeTypes != null) {
            filterBuilder.mimeTypeIs(mimeTypes);
        }
        final SourceSectionFilter filter = filterBuilder.tagIs(StandardTags.RootTag.class).sourceIs(notInternal).build();
        binding = instrumenter.attachExecutionEventFactory(filter, new ExecutionEventNodeFactory() {

            public ExecutionEventNode create(EventContext context) {
                return createCountingNode(context);
            }
        });
    }
}
Also used : EventContext(com.oracle.truffle.api.instrumentation.EventContext) ExecutionEventNodeFactory(com.oracle.truffle.api.instrumentation.ExecutionEventNodeFactory) Builder(com.oracle.truffle.api.instrumentation.SourceSectionFilter.Builder) SourceSectionFilter(com.oracle.truffle.api.instrumentation.SourceSectionFilter) StandardTags(com.oracle.truffle.api.instrumentation.StandardTags)

Example 2 with Builder

use of com.oracle.truffle.api.instrumentation.SourceSectionFilter.Builder 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)

Aggregations

SourceSectionFilter (com.oracle.truffle.api.instrumentation.SourceSectionFilter)2 Builder (com.oracle.truffle.api.instrumentation.SourceSectionFilter.Builder)2 EventContext (com.oracle.truffle.api.instrumentation.EventContext)1 ExecutionEventNodeFactory (com.oracle.truffle.api.instrumentation.ExecutionEventNodeFactory)1 StandardTags (com.oracle.truffle.api.instrumentation.StandardTags)1 Source (com.oracle.truffle.api.source.Source)1