diff --git a/load/generator/src/main/java/com/emc/mongoose/load/generator/BasicLoadGenerator.java b/load/generator/src/main/java/com/emc/mongoose/load/generator/BasicLoadGenerator.java index b6a6cbcbb4..3057036107 100644 --- a/load/generator/src/main/java/com/emc/mongoose/load/generator/BasicLoadGenerator.java +++ b/load/generator/src/main/java/com/emc/mongoose/load/generator/BasicLoadGenerator.java @@ -1,5 +1,6 @@ package com.emc.mongoose.load.generator; +import com.emc.mongoose.common.api.SizeInBytes; import com.emc.mongoose.common.concurrent.DaemonBase; import com.emc.mongoose.common.concurrent.Throttle; import com.emc.mongoose.common.io.Output; @@ -7,6 +8,8 @@ import com.emc.mongoose.common.exception.UserShootHisFootException; import static com.emc.mongoose.common.Constants.BATCH_SIZE; import static com.emc.mongoose.model.io.task.IoTask.IoResult; + +import com.emc.mongoose.model.io.IoType; import com.emc.mongoose.ui.log.LogUtil; import com.emc.mongoose.ui.log.Markers; import com.emc.mongoose.common.io.Input; @@ -44,6 +47,7 @@ public class BasicLoadGenerator, R extend private volatile Output ioTaskOutput; private final Input itemInput; + private final SizeInBytes avgItemSize; private final Input dstPathInput; private final Thread worker; private final long countLimit; @@ -56,12 +60,13 @@ public class BasicLoadGenerator, R extend @SuppressWarnings("unchecked") public BasicLoadGenerator( - final Input itemInput, final Input dstPathInput, - final IoTaskBuilder ioTaskBuilder, final long countLimit, - final int maxItemQueueSize, final boolean isCircular + final Input itemInput, final SizeInBytes avgItemSize, + final Input dstPathInput, final IoTaskBuilder ioTaskBuilder, + final long countLimit, final int maxItemQueueSize, final boolean isCircular ) throws UserShootHisFootException { this.itemInput = itemInput; + this.avgItemSize = avgItemSize; this.dstPathInput = dstPathInput; this.ioTaskBuilder = ioTaskBuilder; this.countLimit = countLimit > 0 ? countLimit : Long.MAX_VALUE; @@ -98,6 +103,16 @@ public final long getGeneratedIoTasksCount() { return generatedIoTaskCount; } + @Override + public final SizeInBytes getAvgItemSize() { + return avgItemSize; + } + + @Override + public final IoType getIoType() { + return ioTaskBuilder.getIoType(); + } + private final class GeneratorTask implements Runnable { diff --git a/load/generator/src/main/java/com/emc/mongoose/load/generator/BasicLoadGeneratorBuilder.java b/load/generator/src/main/java/com/emc/mongoose/load/generator/BasicLoadGeneratorBuilder.java index b9764fab60..9dfa28c15c 100644 --- a/load/generator/src/main/java/com/emc/mongoose/load/generator/BasicLoadGeneratorBuilder.java +++ b/load/generator/src/main/java/com/emc/mongoose/load/generator/BasicLoadGeneratorBuilder.java @@ -174,7 +174,8 @@ public T build() dstPathInput = getDstPathInput(ioType); return (T) new BasicLoadGenerator<>( - itemInput, dstPathInput, ioTaskBuilder, countLimit, maxQueueSize, isCircular + itemInput, avgItemSize, dstPathInput, ioTaskBuilder, countLimit, maxQueueSize, + isCircular ); } diff --git a/load/monitor/src/main/java/com/emc/mongoose/load/monitor/BasicLoadMonitor.java b/load/monitor/src/main/java/com/emc/mongoose/load/monitor/BasicLoadMonitor.java index 09bba62d4e..6107e805e9 100644 --- a/load/monitor/src/main/java/com/emc/mongoose/load/monitor/BasicLoadMonitor.java +++ b/load/monitor/src/main/java/com/emc/mongoose/load/monitor/BasicLoadMonitor.java @@ -1,5 +1,6 @@ package com.emc.mongoose.load.monitor; +import com.emc.mongoose.common.api.SizeInBytes; import com.emc.mongoose.common.concurrent.DaemonBase; import com.emc.mongoose.common.concurrent.NamingThreadFactory; import com.emc.mongoose.common.concurrent.Throttle; @@ -77,6 +78,7 @@ public class BasicLoadMonitor, R extends private final Int2ObjectMap ioStats = new Int2ObjectOpenHashMap<>(); private final Int2ObjectMap medIoStats = new Int2ObjectOpenHashMap<>(); private volatile Int2ObjectMap lastStats = new Int2ObjectOpenHashMap<>(); + private final Int2ObjectMap itemSizeMap = new Int2ObjectOpenHashMap<>(); private final LongAdder counterResults = new LongAdder(); private volatile Output itemInfoOutput; private final Int2IntMap concurrencyMap; @@ -184,6 +186,7 @@ public BasicLoadMonitor( ioStats.put( ioTypeCode, new BasicIoStats(IoType.values()[ioTypeCode].name(), metricsPeriodSec) ); + itemSizeMap.put(nextGenerator.getIoType().ordinal(), nextGenerator.getAvgItemSize()); } this.isAnyCircular = anyCircularFlag; if(isAnyCircular) { @@ -641,7 +644,9 @@ protected final void doClose() ); LOG.info( Markers.METRICS_EXT_RESULTS, - new ExtResultsXmlLogMessage(name, lastStats, concurrencyMap, driversCountMap) + new ExtResultsXmlLogMessage( + name, lastStats, itemSizeMap, concurrencyMap, driversCountMap + ) ); } diff --git a/load/monitor/src/main/java/com/emc/mongoose/load/monitor/metrics/ExtResultsXmlLogMessage.java b/load/monitor/src/main/java/com/emc/mongoose/load/monitor/metrics/ExtResultsXmlLogMessage.java index 552a524a87..1fd6da958d 100644 --- a/load/monitor/src/main/java/com/emc/mongoose/load/monitor/metrics/ExtResultsXmlLogMessage.java +++ b/load/monitor/src/main/java/com/emc/mongoose/load/monitor/metrics/ExtResultsXmlLogMessage.java @@ -29,15 +29,18 @@ public final class ExtResultsXmlLogMessage private final String jobName; private final Int2ObjectMap snapshots; + private final Int2ObjectMap itemSizeMap; private final Int2IntMap concurrencyMap; private final Int2IntMap driversCountMap; public ExtResultsXmlLogMessage( final String jobName, final Int2ObjectMap snapshots, - final Int2IntMap concurrencyMap, final Int2IntMap driversCountMap + final Int2ObjectMap itemSizeMap, final Int2IntMap concurrencyMap, + final Int2IntMap driversCountMap ) { this.jobName = jobName; this.snapshots = snapshots; + this.itemSizeMap = itemSizeMap; this.concurrencyMap = concurrencyMap; this.driversCountMap = driversCountMap; } @@ -46,12 +49,14 @@ public ExtResultsXmlLogMessage( public final void formatTo(final StringBuilder buffer) { Snapshot snapshot; + SizeInBytes itemSize; int concurrency; int driversCount; for(final int ioTypeCode : snapshots.keySet()) { snapshot = snapshots.get(ioTypeCode); + itemSize = itemSizeMap.get(ioTypeCode); concurrency = concurrencyMap.get(ioTypeCode); driversCount = driversCountMap.get(ioTypeCode); @@ -71,10 +76,7 @@ public final void formatTo(final StringBuilder buffer) { buffer.append("clients=\"").append(driversCount).append("\" "); buffer.append("error=\"").append(snapshot.getFailCount()).append("\" "); buffer.append("runtime=\"").append(((float) elapsedTimeMillis) / 1000).append("\" "); - final long itemCount = snapshot.getSuccCount(); - final long byteCount = snapshot.getByteCount(); - final String avgSize = SizeInBytes.formatFixedSize(itemCount > 0 ? byteCount / itemCount : 0); - buffer.append("filesize=\"").append(avgSize).append("\" "); + buffer.append("filesize=\"").append(itemSize == null ? 0 : itemSize.toString()).append("\" "); buffer.append("tps=\"").append(snapshot.getSuccRateMean()).append("\" tps_unit=\"Fileps\" "); buffer.append("bw=\"").append(snapshot.getByteRateMean() / MIB).append("\" bw_unit=\"MBps\" "); buffer.append("latency=\"").append(snapshot.getLatencyAvg()).append("\" latency_unit=\"us\" "); diff --git a/model/src/main/java/com/emc/mongoose/model/load/LoadGenerator.java b/model/src/main/java/com/emc/mongoose/model/load/LoadGenerator.java index 30a7bfc459..46211ef719 100644 --- a/model/src/main/java/com/emc/mongoose/model/load/LoadGenerator.java +++ b/model/src/main/java/com/emc/mongoose/model/load/LoadGenerator.java @@ -1,8 +1,10 @@ package com.emc.mongoose.model.load; +import com.emc.mongoose.common.api.SizeInBytes; import com.emc.mongoose.common.concurrent.Daemon; import com.emc.mongoose.common.concurrent.Throttle; import com.emc.mongoose.common.io.Output; +import com.emc.mongoose.model.io.IoType; import com.emc.mongoose.model.io.task.IoTask; import static com.emc.mongoose.model.io.task.IoTask.IoResult; import com.emc.mongoose.model.item.Item; @@ -20,4 +22,8 @@ public interface LoadGenerator, R extends void setOutput(final Output ioTaskOutput); long getGeneratedIoTasksCount(); + + SizeInBytes getAvgItemSize(); + + IoType getIoType(); } diff --git a/storage/driver/base/src/main/java/com/emc/mongoose/storage/driver/base/StorageDriverBase.java b/storage/driver/base/src/main/java/com/emc/mongoose/storage/driver/base/StorageDriverBase.java index a31e226030..d43898e7b8 100644 --- a/storage/driver/base/src/main/java/com/emc/mongoose/storage/driver/base/StorageDriverBase.java +++ b/storage/driver/base/src/main/java/com/emc/mongoose/storage/driver/base/StorageDriverBase.java @@ -109,23 +109,11 @@ protected StorageDriverBase( useDataLatencyResult = traceConfig.getDataLatency(); useTransferSizeResult = traceConfig.getTransferSize(); - DISPATCH_INBOUND_TASKS.put(this, new IoTasksDispatch(metricsConfig.getPeriod())); + DISPATCH_INBOUND_TASKS.put(this, new IoTasksDispatch()); } private final class IoTasksDispatch implements Runnable { - - private final long metricsPeriodNanoSec; - - private IoTasksDispatch(final long metricsPeriodSec) { - this.metricsPeriodNanoSec = TimeUnit.SECONDS.toNanos( - metricsPeriodSec > 0 ? metricsPeriodSec : Long.MAX_VALUE - ); - } - - private long prevNanoTimeStamp = -1; - private long nextNanoTimeStamp; - @Override public final void run() { int n; @@ -147,12 +135,6 @@ public final void run() { toString() ); } - - nextNanoTimeStamp = System.nanoTime(); - if(nextNanoTimeStamp - prevNanoTimeStamp > metricsPeriodNanoSec) { - outputCurrentMetrics(); - prevNanoTimeStamp = nextNanoTimeStamp; - } } }