Skip to content
Daan van Yperen edited this page Sep 29, 2015 · 11 revisions

Profile EntitySystems with user-specified profiler class.

Injects conditional profiler call at start of begin() and before any exit point in end().

Setup

See Weave Automation.

Minimal example

###What you type:

@Profile(using=MyProfiler.class, enabled=true)
public class VoidSystem extends VoidEntitySystem {
    public VoidSystem() {
        super();
    }
    
    @Override
    protected void processSystem() {
        // process system
    }
}

###What the JVM gets:

public class VoidSystem extends VoidEntitySystem {
    private MyProfiler $profiler;
    
    public VoidSystem() {
        super();
    }
    
    @Override
    protected void initialize() {
        $profiler = new MyProfiler();
        $profiler.initialize(this, world);
    }
    
    @Override
    protected void begin() {
        $profiler.start();
    }
    
    @Override
    protected void end() {
        $profiler.stop();
    }
    
    @Override
    protected void processSystem() {
        // process system
    }
}
Clone this wiki locally