Package org.jnode.util

Examples of org.jnode.util.StopWatch


public class InvokeInterfaceTest {

    public static void main(String[] args) {
        A a = new B();

        final StopWatch sw = new StopWatch();
        int a1 = 1;
        int a2 = 1;
        for (int i = 0; i < 10000; i++) {
            a1 = a.foo(a1);
            a2 = a.foo2(a1, a2);
View Full Code Here


    /**
     * Fire a deviceStarted event to all my listeners
     */
    protected final void fireStartedEvent() {
        final StopWatch sw = new StopWatch();
        for (DeviceListener l : listeners) {
            sw.start();
            l.deviceStarted(this);
            if (sw.isElapsedLongerThen(100)) {
                BootLogInstance.get()
                    .error("DeviceListener took " + sw + " in deviceStarted: " + l.getClass().getName());
            }
        }
        manager.fireStartedEvent(this);
View Full Code Here

    /**
     * Fire a deviceStop event to all my listeners
     */
    protected final void fireStopEvent() {
        manager.fireStopEvent(this);
        final StopWatch sw = new StopWatch();
        for (DeviceListener l : listeners) {
            sw.start();
            l.deviceStop(this);
            if (sw.isElapsedLongerThen(100)) {
                BootLogInstance.get().error("DeviceListener took " + sw + " in deviceStop: " + l.getClass().getName());
            }
        }
    }
View Full Code Here

        // Start it (if needed)
        if (!device.isStarted()) {
            try {
                BootLogInstance.get().debug("Starting " + device.getId());
                //new DeviceStarter(device).start(getDefaultStartTimeout());
                final StopWatch sw = new StopWatch();
                device.start();
                sw.stop();
                if (sw.isElapsedLongerThen(defaultStartTimeout)) {
                    BootLogInstance.get().error("Device startup took " + sw + ": "
                        + device.getId());
                } else if (sw.isElapsedLongerThen(fastStartTimeout)) {
                    BootLogInstance.get().info("Device startup took " + sw + ": "
                        + device.getId());
                }
                BootLogInstance.get().debug("Started " + device.getId());
            } catch (DriverException ex) {
View Full Code Here

    protected final void fireRegisteredEvent(Device device) {
        final List<DeviceManagerListener> list;
        synchronized (this.listeners) {
            list = new ArrayList<DeviceManagerListener>(this.listeners);
        }
        final StopWatch sw = new StopWatch();
        for (DeviceManagerListener l : list) {
            sw.start();
            l.deviceRegistered(device);
            if (sw.isElapsedLongerThen(100)) {
                BootLogInstance.get().error("DeviceManagerListener took " + sw
                    + " in deviceRegistered: " + l.getClass().getName());
            }
        }
    }
View Full Code Here

    protected final void fireUnregisterEvent(Device device) {
        final List<DeviceManagerListener> list;
        synchronized (this.listeners) {
            list = new ArrayList<DeviceManagerListener>(this.listeners);
        }
        final StopWatch sw = new StopWatch();
        for (DeviceManagerListener l : list) {
            sw.start();
            l.deviceUnregister(device);
            if (sw.isElapsedLongerThen(100)) {
                BootLogInstance.get().error("DeviceManagerListener took " + sw
                    + " in deviceUnregister: " + l.getClass().getName());
            }
        }
    }
View Full Code Here

    public final void fireStartedEvent(Device device) {
        final List<DeviceListener> list;
        synchronized (this.deviceListeners) {
            list = new ArrayList<DeviceListener>(this.deviceListeners);
        }
        final StopWatch sw = new StopWatch();
        for (DeviceListener l : list) {
            sw.start();
            l.deviceStarted(device);
            if (sw.isElapsedLongerThen(100)) {
                BootLogInstance.get().error("DeviceListener (in manager) took " + sw
                    + " in deviceStarted: " + l.getClass().getName());
            }
        }
    }
View Full Code Here

    /**
     * @param args
     */
    public static void main(String[] args) {
        final int cnt = (args.length > 0) ? Integer.parseInt(args[0]) : 1;
        final StopWatch sw = new StopWatch();
        int i = run();
        for (int x = 1; x < cnt; x++) {
            if (run() != i) {
                throw new RuntimeException("Result differs");
            }
        }
        sw.stop();
        System.out.println("Result : " + i + " took " + sw + " for " + cnt + " loops");
    }
View Full Code Here

    public final void fireStopEvent(Device device) {
        final List<DeviceListener> list;
        synchronized (this.deviceListeners) {
            list = new ArrayList<DeviceListener>(this.deviceListeners);
        }
        final StopWatch sw = new StopWatch();
        for (DeviceListener l : list) {
            sw.start();
            l.deviceStop(device);
            if (sw.isElapsedLongerThen(100)) {
                BootLogInstance.get().error("DeviceListener (in manager) took " + sw
                    + " in deviceStop: " + l.getClass().getName());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.jnode.util.StopWatch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.