Package net.yacy.visualization

Examples of net.yacy.visualization.ChartPlotter


        final int anotscale = 1000;
        final int bottomscale = 60;
        final int vspace = height - topborder - bottomborder;
        final int hspace = width - leftborder - rightborder;
        final int maxtime = 600;
        ChartPlotter chart = new ChartPlotter(width, height, "FFFFFF", "000000", "AAAAAA", leftborder, rightborder, topborder, bottomborder, "YACY PEER PERFORMANCE: MAIN MEMORY, WORD CACHE AND PAGES/MINUTE (PPM)", subline);
        chart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, bottomscale, hspace / (maxtime / bottomscale), -maxtime, "000000", "CCCCCC", "TIME/SECONDS");
        chart.declareDimension(ChartPlotter.DIMENSION_LEFT, leftscale, vspace * leftscale / maxwords, 0, "008800", null , "INDEXING, WORDS IN CACHE");
        chart.declareDimension(ChartPlotter.DIMENSION_RIGHT, rightscale, vspace * rightscale / maxmbytes, 0, "0000FF", "CCCCCC", "MEMORY/MEGABYTE");
        chart.declareDimension(ChartPlotter.DIMENSION_ANOT0, anotscale, vspace * anotscale / maxppm, 0, "008800", null , "PPM [PAGES/MINUTE]");
        chart.declareDimension(ChartPlotter.DIMENSION_ANOT1, vspace / 6, vspace / 6, 0, "888800", null , "URL");
       
        // draw chart
        long time;
        final long now = System.currentTimeMillis();
        long bytes;
        int x0, x1, y0, y1, ppm, words;
        try {
            // draw urls
            /*
            Iterator<Event> i = serverProfiling.history("indexed");
            x0 = 1; y0 = 0;
            while (i.hasNext()) {
                event = i.next();
                time = event.time - now;
                x1 = (int) (time/1000);
                y1 = ppm;
                chart.setColor("AA8888");
                if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT0, x0, y0, x1, y1);
                chart.setColor("AA2222");
                chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT0, x1, y1, 2, ((String) event.payload), 315);
                x0 = x1; y0 = y1;
            }
            */
            // draw memory
            Iterator<Event> events = EventTracker.getHistory(EventTracker.EClass.MEMORY);
            x0 = 1; y0 = 0;
            if (events != null) {
                EventTracker.Event event;
                while (events.hasNext()) {
                    event = events.next();
                    time = event.time - now;
                    bytes = ((Long) event.payload).longValue();
                    x1 = (int) (time/1000);
                    y1 = (int) (bytes / 1024 / 1024);
                    chart.setColor("AAAAFF");
                    chart.chartDot(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_RIGHT, x1, y1, 2, null, 0);
                    chart.setColor("0000FF");
                    if (x0 < 0) chart.chartLine(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_RIGHT, x0, y0, x1, y1);
                    x0 = x1; y0 = y1;
                }
            }
           
            // draw wordcache
            events = EventTracker.getHistory(EventTracker.EClass.WORDCACHE);
            x0 = 1; y0 = 0;
            if (events != null) {
                EventTracker.Event event;
                while (events.hasNext()) {
                    event = events.next();
                    time = event.time - now;
                    words = (int) ((Long) event.payload).longValue();
                    x1 = (int) (time/1000);
                    y1 = words;
                    chart.setColor("228822");
                    chart.chartDot(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_LEFT, x1, y1, 2, null, 315);
                    chart.setColor("008800");
                    if (x0 < 0) chart.chartLine(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_LEFT, x0, y0, x1, y1);
                    x0 = x1; y0 = y1;
                }
            }
           
            // draw ppm
            events = EventTracker.getHistory(EventTracker.EClass.PPM);
            x0 = 1; y0 = 0;
            if (events != null) {
                EventTracker.Event event;
                while (events.hasNext()) {
                    event = events.next();
                    time = event.time - now;
                    ppm = (int) ((Long) event.payload).longValue();
                    x1 = (int) (time/1000);
                    y1 = ppm;
                    chart.setColor("AA8888");
                    if (x0 < 0) chart.chartLine(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_ANOT0, x0, y0, x1, y1);
                    chart.setColor("AA2222");
                    chart.chartDot(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_ANOT0, x1, y1, 2, ppm + " PPM", 0);
                    x0 = x1; y0 = y1;
                }
            }
           
            bufferChart = chart;
View Full Code Here


    long start;
   
    public memprofiler(final int width, final int height, final int expectedTimeSeconds, final File outputFile) {
        this.outputFile = outputFile;
        final int expectedKilobytes = 20 * 1024;//(Runtime.getRuntime().totalMemory() / 1024);
        memChart = new ChartPlotter(width, height, "FFFFFF", "000000", "000000", 50, 20, 20, 20, "MEMORY CHART FROM EXECUTION AT " + new Date(), null);
        final int timescale = 10; // steps with each 10 seconds
        final int memscale = 1024;
        memChart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, timescale, (width - 40) * timescale / expectedTimeSeconds, 0, "FFFFFF", "555555", "SECONDS");
        memChart.declareDimension(ChartPlotter.DIMENSION_LEFT, memscale, (height - 40) * memscale / expectedKilobytes, 0, "FFFFFF", "555555", "KILOBYTES");
        run = true;
View Full Code Here

    long start;

    public memprofiler(final int width, final int height, final int expectedTimeSeconds, final File outputFile) {
        this.outputFile = outputFile;
        final int expectedKilobytes = 20 * 1024;//(Runtime.getRuntime().totalMemory() / 1024);
        this.memChart = new ChartPlotter(width, height, "FFFFFF", "000000", "000000", 50, 20, 20, 20, "MEMORY CHART FROM EXECUTION AT " + new Date(), null);
        final int timescale = 10; // steps with each 10 seconds
        final int memscale = 1024;
        this.memChart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, timescale, (width - 40) * timescale / expectedTimeSeconds, 0, "FFFFFF", "555555", "SECONDS");
        this.memChart.declareDimension(ChartPlotter.DIMENSION_LEFT, memscale, (height - 40) * memscale / expectedKilobytes, 0, "FFFFFF", "555555", "KILOBYTES");
        this.run = true;
View Full Code Here

        final int anotscale = 1000;
        final int bottomscale = 60;
        final int vspace = height - topborder - bottomborder;
        final int hspace = width - leftborder - rightborder;
        final int maxtime = 600;
        ChartPlotter chart = new ChartPlotter(width, height, "FFFFFF", "000000", "AAAAAA", leftborder, rightborder, topborder, bottomborder, "YACY PEER PERFORMANCE: MAIN MEMORY, WORD CACHE AND PAGES/MINUTE (PPM)", subline);
        chart.declareDimension(ChartPlotter.DIMENSION_BOTTOM, bottomscale, hspace / (maxtime / bottomscale), -maxtime, "000000", "CCCCCC", "TIME/SECONDS");
        chart.declareDimension(ChartPlotter.DIMENSION_LEFT, leftscale, vspace * leftscale / maxwords, 0, "008800", null , "WORDS IN INDEXING CACHE");
        if (showMemory) {
            chart.declareDimension(ChartPlotter.DIMENSION_RIGHT, rightscale, vspace * rightscale / maxmbytes, 0, "0000FF", "CCCCCC", "MEMORY/MEGABYTE");
        } else {
            chart.declareDimension(ChartPlotter.DIMENSION_RIGHT, rightscale, vspace * rightscale / Math.max(1, maxppm), 0, "FF0000", "CCCCCC", "INDEXING SPEED/PAGES PER MINUTE");
        }
        chart.declareDimension(ChartPlotter.DIMENSION_ANOT0, anotscale, vspace * anotscale / maxppm, 0, "008800", null , "PPM [PAGES/MINUTE]");
        chart.declareDimension(ChartPlotter.DIMENSION_ANOT1, vspace / 6, vspace / 6, 0, "888800", null , "URL");
        chart.declareDimension(ChartPlotter.DIMENSION_ANOT2, 1, 1, 0, "888800", null , "PING");

        // draw chart
        long time;
        final long now = System.currentTimeMillis();
        long bytes;
        int x0, x1, y0, y1;
        try {
            // draw urls
            /*
            Iterator<Event> i = serverProfiling.history("indexed");
            x0 = 1; y0 = 0;
            while (i.hasNext()) {
                event = i.next();
                time = event.time - now;
                x1 = (int) (time/1000);
                y1 = ppm;
                chart.setColor("AA8888");
                if (x0 < 0) chart.chartLine(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT0, x0, y0, x1, y1);
                chart.setColor("AA2222");
                chart.chartDot(ymageChart.DIMENSION_BOTTOM, ymageChart.DIMENSION_ANOT0, x1, y1, 2, ((String) event.payload), 315);
                x0 = x1; y0 = y1;
            }
            */
            Iterator<Event> events;
            // draw memory
            if (showMemory) {
                events = EventTracker.getHistory(EventTracker.EClass.MEMORY);
                x0 = 1; y0 = 0;
                if (events != null) {
                    EventTracker.Event event;
                    while (events.hasNext()) {
                        event = events.next();
                        time = event.time - now;
                        bytes = ((Long) event.payload).longValue();
                        x1 = (int) (time/1000);
                        y1 = (int) (bytes / 1024 / 1024);
                        chart.setColor("AAAAFF");
                        chart.chartDot(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_RIGHT, x1, y1, 2, null, 0);
                        chart.setColor("0000FF");
                        if (x0 < 0) chart.chartLine(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_RIGHT, x0, y0, x1, y1);
                        x0 = x1; y0 = y1;
                    }
                }
            }

            // draw wordcache
            events = EventTracker.getHistory(EventTracker.EClass.WORDCACHE);
            x0 = 1; y0 = 0;
            if (events != null) {
                EventTracker.Event event;
                int words;
                while (events.hasNext()) {
                    event = events.next();
                    time = event.time - now;
                    words = (int) ((Long) event.payload).longValue();
                    x1 = (int) (time/1000);
                    y1 = words;
                    chart.setColor("228822");
                    chart.chartDot(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_LEFT, x1, y1, 2, null, 315);
                    chart.setColor("008800");
                    if (x0 < 0) chart.chartLine(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_LEFT, x0, y0, x1, y1);
                    x0 = x1; y0 = y1;
                }
            }

            // draw ppm
            events = EventTracker.getHistory(EventTracker.EClass.PPM);
            x0 = 1; y0 = 0;
            if (events != null) {
                EventTracker.Event event;
                int ppm;
                while (events.hasNext()) {
                    event = events.next();
                    time = event.time - now;
                    ppm = (int) ((Long) event.payload).longValue();
                    x1 = (int) (time/1000);
                    y1 = ppm;
                    chart.setColor("AA8888");
                    if (x0 < 0) chart.chartLine(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_ANOT0, x0, y0, x1, y1);
                    chart.setColor("AA2222");
                    chart.chartDot(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_ANOT0, x1, y1, 2, ppm + " PPM", 0);
                    x0 = x1; y0 = y1;
                }
            }

            // draw peer ping
            events = EventTracker.getHistory(EventTracker.EClass.PEERPING);
            x0 = 1; y0 = 0;
            if (events != null) {
                EventTracker.Event event;
                EventPing ping;
                String pingPeer;
                while (events.hasNext()) {
                    event = events.next();
                    time = event.time - now;
                    ping = (EventPing) event.payload;
                    x1 = (int) (time/1000);
                    y1 = Math.abs((ping.outgoing ? ping.toPeer : ping.fromPeer).hashCode()) % vspace;
                    pingPeer = ping.outgoing ? "-> " + ping.toPeer.toUpperCase() : "<- " + ping.fromPeer.toUpperCase();
                    chart.setColor("444444");
                    chart.chartDot(ChartPlotter.DIMENSION_BOTTOM, ChartPlotter.DIMENSION_ANOT2, x1, y1, 2, pingPeer + (ping.newPeers > 0 ? "(+" + ping.newPeers + ")" : ""), 0);
                    x0 = x1; y0 = y1;
                }
            }

            bufferChart = chart;
View Full Code Here

TOP

Related Classes of net.yacy.visualization.ChartPlotter

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.