Search in sources :

Example 1 with FopStats

use of org.ovirt.engine.core.common.businessentities.gluster.FopStats in project ovirt-engine by oVirt.

the class GetGlusterVolumeProfileInfoQueryTest method getFopStats.

private List<FopStats> getFopStats() {
    FopStats fopStats = new FopStats();
    fopStats.setAvgLatency(78.12500);
    fopStats.setAvgLatencyFormatted(new Pair<>(78.12500, TimeUnit.MICROSECONDS.toString()));
    fopStats.setName("STATFS");
    fopStats.setHits(2);
    fopStats.setMinLatency(39.00000);
    fopStats.setMinLatencyFormatted(new Pair<>(39.00000, TimeUnit.MICROSECONDS.toString()));
    fopStats.setMaxLatency(143.00000);
    fopStats.setMaxLatencyFormatted(new Pair<>(143.00000, TimeUnit.MICROSECONDS.toString()));
    return Collections.singletonList(fopStats);
}
Also used : FopStats(org.ovirt.engine.core.common.businessentities.gluster.FopStats)

Example 2 with FopStats

use of org.ovirt.engine.core.common.businessentities.gluster.FopStats in project ovirt-engine by oVirt.

the class GlusterVolumeProfileInfoReturn method getFopStats.

private List<FopStats> getFopStats(Object[] fopStatsObjects) {
    List<FopStats> fopStatsList = new ArrayList<>();
    for (Object fopStatsObj : fopStatsObjects) {
        FopStats fopStats = new FopStats();
        Map<String, Object> fopStatsMap = (Map<String, Object>) fopStatsObj;
        fopStats.setHits(Integer.parseInt((String) fopStatsMap.get(HITS)));
        fopStats.setName((String) fopStatsMap.get(NAME));
        Double minLatency = Double.valueOf((String) fopStatsMap.get(LATENCY_MIN));
        fopStats.setMinLatency(minLatency);
        Pair<Long, TimeUnit> minLatencyConverted = TimeConverter.autoConvert(minLatency.longValue(), TimeUnit.MICROSECONDS);
        fopStats.setMinLatencyFormatted(new Pair<>(minLatencyConverted.getFirst().doubleValue(), minLatencyConverted.getSecond().toString()));
        Double maxLatency = Double.valueOf((String) fopStatsMap.get(LATENCY_MAX));
        fopStats.setMaxLatency(maxLatency);
        Pair<Long, TimeUnit> maxLatencyConverted = TimeConverter.autoConvert(maxLatency.longValue(), TimeUnit.MICROSECONDS);
        fopStats.setMaxLatencyFormatted(new Pair<>(maxLatencyConverted.getFirst().doubleValue(), maxLatencyConverted.getSecond().toString()));
        Double avgLatency = Double.valueOf((String) fopStatsMap.get(LATENCY_AVG));
        fopStats.setAvgLatency(avgLatency);
        Pair<Long, TimeUnit> avgLatencyConverted = TimeConverter.autoConvert(avgLatency.longValue(), TimeUnit.MICROSECONDS);
        fopStats.setAvgLatencyFormatted(new Pair<>(avgLatencyConverted.getFirst().doubleValue(), avgLatencyConverted.getSecond().toString()));
        fopStatsList.add(fopStats);
    }
    return fopStatsList;
}
Also used : FopStats(org.ovirt.engine.core.common.businessentities.gluster.FopStats) ArrayList(java.util.ArrayList) TimeUnit(java.util.concurrent.TimeUnit) Map(java.util.Map)

Example 3 with FopStats

use of org.ovirt.engine.core.common.businessentities.gluster.FopStats in project ovirt-engine by oVirt.

the class GlusterVolumeProfileInfoMapper method mapFopStats.

private static void mapFopStats(ProfileDetail profileDetail, StatsInfo statsInfo) {
    for (FopStats fopStat : statsInfo.getFopStats()) {
        FopStatistic fStat = new FopStatistic();
        fStat.setName(fopStat.getName());
        fStat.setStatistics(new Statistics());
        fStat.getStatistics().getStatistics().add(StatisticResourceUtils.setDatum(clone(MIN_LATENCY), fopStat.getMinLatency()));
        fStat.getStatistics().getStatistics().add(StatisticResourceUtils.setDatum(clone(MAX_LATENCY), fopStat.getMaxLatency()));
        fStat.getStatistics().getStatistics().add(StatisticResourceUtils.setDatum(clone(AVG_LATENCY), fopStat.getAvgLatency()));
        fStat.getStatistics().getStatistics().add(StatisticResourceUtils.setDatum(clone(HITS), fopStat.getHits()));
        profileDetail.setFopStatistics(new FopStatistics());
        profileDetail.getFopStatistics().getFopStatistics().add(fStat);
    }
}
Also used : FopStats(org.ovirt.engine.core.common.businessentities.gluster.FopStats) FopStatistic(org.ovirt.engine.api.model.FopStatistic) BlockStatistics(org.ovirt.engine.api.model.BlockStatistics) Statistics(org.ovirt.engine.api.model.Statistics) FopStatistics(org.ovirt.engine.api.model.FopStatistics) FopStatistics(org.ovirt.engine.api.model.FopStatistics)

Example 4 with FopStats

use of org.ovirt.engine.core.common.businessentities.gluster.FopStats in project ovirt-engine by oVirt.

the class VolumeProfileStatisticsPopupView method initEditors.

private void initEditors() {
    nfsRefreshIcon = new RefreshActionIcon(SafeHtmlUtils.EMPTY_SAFE_HTML);
    brickRefreshIcon = new RefreshActionIcon(SafeHtmlUtils.EMPTY_SAFE_HTML);
    bricks = new ListModelListBoxEditor<>(new NameRenderer<BrickProfileDetails>());
    nfsServers = new ListModelListBoxEditor<>(new NameRenderer<GlusterVolumeProfileStats>());
    volumeProfileStats = new EntityModelCellTable<>(false, true);
    volumeProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            return entity.getName();
        }
    }, constants.fileOperation());
    volumeProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            return entity.getHits() + "";
        }
    }, constants.fOpInvocationCount());
    volumeProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            // $NON-NLS-1$
            return entity.getMaxLatencyFormatted().getFirst() + " " + entity.getMaxLatencyFormatted().getSecond();
        }
    }, constants.fOpMaxLatency());
    volumeProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            // $NON-NLS-1$
            return entity.getMinLatencyFormatted().getFirst() + " " + entity.getMinLatencyFormatted().getSecond();
        }
    }, constants.fOpMinLatency());
    volumeProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            // $NON-NLS-1$
            return entity.getAvgLatencyFormatted().getFirst() + " " + entity.getAvgLatencyFormatted().getSecond();
        }
    }, constants.fOpAvgLatency());
    nfsServerProfileStats = new EntityModelCellTable<>(false, true);
    nfsServerProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            return entity.getName();
        }
    }, constants.fileOperation());
    nfsServerProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            return entity.getHits() + "";
        }
    }, constants.fOpInvocationCount());
    nfsServerProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            // $NON-NLS-1$
            return entity.getMaxLatencyFormatted().getFirst() + " " + entity.getMaxLatencyFormatted().getSecond();
        }
    }, constants.fOpMaxLatency());
    nfsServerProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            // $NON-NLS-1$
            return entity.getMinLatencyFormatted().getFirst() + " " + entity.getMinLatencyFormatted().getSecond();
        }
    }, constants.fOpMinLatency());
    nfsServerProfileStats.addColumn(new AbstractEntityModelTextColumn<FopStats>() {

        @Override
        protected String getText(FopStats entity) {
            // $NON-NLS-1$
            return entity.getAvgLatencyFormatted().getFirst() + " " + entity.getAvgLatencyFormatted().getSecond();
        }
    }, constants.fOpAvgLatency());
}
Also used : RefreshActionIcon(org.ovirt.engine.ui.common.widget.dialog.RefreshActionIcon) FopStats(org.ovirt.engine.core.common.businessentities.gluster.FopStats) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer)

Aggregations

FopStats (org.ovirt.engine.core.common.businessentities.gluster.FopStats)4 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 TimeUnit (java.util.concurrent.TimeUnit)1 BlockStatistics (org.ovirt.engine.api.model.BlockStatistics)1 FopStatistic (org.ovirt.engine.api.model.FopStatistic)1 FopStatistics (org.ovirt.engine.api.model.FopStatistics)1 Statistics (org.ovirt.engine.api.model.Statistics)1 RefreshActionIcon (org.ovirt.engine.ui.common.widget.dialog.RefreshActionIcon)1 NameRenderer (org.ovirt.engine.ui.common.widget.renderer.NameRenderer)1