Search in sources :

Example 1 with Rectangle

use of org.pentaho.di.core.gui.Rectangle in project pentaho-kettle by pentaho.

the class MetricsPainter method drawDurations.

private void drawDurations(List<MetricsDuration> durations, List<MetricsDrawArea> areas, double pixelsPerMs) {
    // set top indent
    int y = 20;
    for (MetricsDuration duration : durations) {
        Long realDuration = duration.getEndDate().getTime() - duration.getDate().getTime();
        // How many pixels does it take to drawn this duration?
        // 
        int durationWidth = (int) (realDuration * pixelsPerMs);
        int x = 2 + (int) ((duration.getDate().getTime() - periodStart) * pixelsPerMs);
        getGc().setBackground(EColor.BACKGROUND);
        getGc().setForeground(EColor.LIGHTBLUE);
        getGc().fillGradientRectangle(x, y, durationWidth, barHeight, false);
        getGc().setForeground(EColor.BLACK);
        getGc().drawRectangle(x, y, durationWidth, barHeight);
        areas.add(new MetricsDrawArea(new Rectangle(x, y, durationWidth, barHeight), duration));
        LoggingObjectInterface loggingObject = LoggingRegistry.getInstance().getLoggingObject(duration.getLogChannelId());
        String message = duration.getDescription() + " - " + loggingObject.getObjectName() + " : " + duration.getDuration() + "ms";
        if (duration.getCount() > 1) {
            message += " " + duration.getCount() + " calls, avg=" + (duration.getDuration() / duration.getCount());
        }
        getGc().setFont(EFont.GRAPH);
        getGc().textExtent(message);
        getGc().drawText(message, x + 3, y + 4, true);
        y += barHeight + 5;
    }
}
Also used : Rectangle(org.pentaho.di.core.gui.Rectangle) MetricsDuration(org.pentaho.di.core.metrics.MetricsDuration) Point(org.pentaho.di.core.gui.Point)

Aggregations

Point (org.pentaho.di.core.gui.Point)1 Rectangle (org.pentaho.di.core.gui.Rectangle)1 MetricsDuration (org.pentaho.di.core.metrics.MetricsDuration)1