mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
add concurrency to status indicator
This commit is contained in:
parent
a8bbd9f923
commit
f249d49f26
@ -17,12 +17,15 @@
|
||||
package io.nosqlbench.engine.api.activityapi.core.progress;
|
||||
|
||||
import io.nosqlbench.engine.api.activityimpl.uniform.Activity;
|
||||
import io.nosqlbench.nb.api.engine.activityimpl.CyclesSpec;
|
||||
import io.nosqlbench.nb.api.engine.metrics.instruments.NBMetricTimer;
|
||||
import io.nosqlbench.nb.api.engine.util.Unit;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
public class ActivityMetricProgressMeter implements ProgressMeterDisplay, CompletedMeter, RemainingMeter, ActiveMeter {
|
||||
public class ActivityMetricProgressMeter
|
||||
implements ProgressMeterDisplay, CompletedMeter, RemainingMeter, ActiveMeter, ConcurrentMeter
|
||||
{
|
||||
|
||||
private final Activity activity;
|
||||
private final Instant startInstant;
|
||||
@ -49,12 +52,10 @@ public class ActivityMetricProgressMeter implements ProgressMeterDisplay, Comple
|
||||
|
||||
@Override
|
||||
public double getMaxValue() {
|
||||
double totalRecycles = 1.0d + activity.getActivityDef()
|
||||
.getParams()
|
||||
.getOptionalString("recycles")
|
||||
.flatMap(Unit::longCountFor)
|
||||
.orElse(0L);
|
||||
double totalCycles = activity.getActivityDef().getCycleCount() * totalRecycles;
|
||||
double total_recycles = CyclesSpec.parse(activity.getConfig().get("recycles"))
|
||||
.cycle_count();
|
||||
double total_cycles = CyclesSpec.parse(activity.getConfig().get("cycles")).cycle_count();
|
||||
double totalCycles = total_recycles * total_cycles;
|
||||
return totalCycles;
|
||||
}
|
||||
|
||||
@ -65,12 +66,12 @@ public class ActivityMetricProgressMeter implements ProgressMeterDisplay, Comple
|
||||
|
||||
@Override
|
||||
public double getRemainingCount() {
|
||||
return getMaxValue()- getCurrentValue();
|
||||
return getMaxValue() - getCurrentValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getActiveOps() {
|
||||
return bindTimer.getCount()-cyclesTimer.getCount();
|
||||
return bindTimer.getCount() - cyclesTimer.getCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -84,4 +85,8 @@ public class ActivityMetricProgressMeter implements ProgressMeterDisplay, Comple
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getConcurrency() {
|
||||
return activity.getConfig().getThreads();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
package io.nosqlbench.engine.api.activityapi.core.progress;
|
||||
|
||||
public interface ConcurrentMeter {
|
||||
int getConcurrency();
|
||||
}
|
@ -27,6 +27,7 @@ public interface ProgressMeterDisplay {
|
||||
default double getMinValue() {
|
||||
return 0.0d;
|
||||
}
|
||||
|
||||
double getMaxValue();
|
||||
|
||||
double getCurrentValue();
|
||||
@ -50,10 +51,10 @@ public interface ProgressMeterDisplay {
|
||||
|
||||
default ProgressSummary getSummary() {
|
||||
return new ProgressSummary(
|
||||
getProgressName(),
|
||||
(this instanceof RemainingMeter rm) ? rm.getRemainingCount() : -1.0,
|
||||
(this instanceof ActiveMeter am) ? am.getActiveOps() : -1.0,
|
||||
(this instanceof CompletedMeter cm) ? cm.getCompletedCount() : -1.0);
|
||||
getProgressName(), (this instanceof RemainingMeter rm) ? rm.getRemainingCount() : -1.0,
|
||||
(this instanceof ActiveMeter am) ? am.getActiveOps() : -1.0,
|
||||
(this instanceof ConcurrentMeter conc) ? conc.getConcurrency() : -1,
|
||||
(this instanceof CompletedMeter cm) ? cm.getCompletedCount() : -1.0);
|
||||
}
|
||||
|
||||
default long getProgressETAMillis() {
|
||||
@ -70,7 +71,7 @@ public interface ProgressMeterDisplay {
|
||||
}
|
||||
|
||||
default Instant getETAInstant() {
|
||||
return Instant.ofEpochMilli(System.currentTimeMillis()+getProgressETAMillis());
|
||||
return Instant.ofEpochMilli(System.currentTimeMillis() + getProgressETAMillis());
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,6 +22,7 @@ public record ProgressSummary(
|
||||
String name,
|
||||
double pending,
|
||||
double current,
|
||||
double concurrency,
|
||||
double complete
|
||||
) {
|
||||
|
||||
@ -39,8 +40,8 @@ public record ProgressSummary(
|
||||
|
||||
legend.append("pending,");
|
||||
values.append(String.format("%.0f,",pending));
|
||||
legend.append("current,");
|
||||
values.append(String.format("%.0f,", current));
|
||||
legend.append("current/max,");
|
||||
values.append(String.format("%.0f/%.0f,", current, concurrency));
|
||||
legend.append("complete,");
|
||||
values.append(String.format("%.0f,",complete));
|
||||
legend.setLength(legend.length()-1);
|
||||
|
Loading…
Reference in New Issue
Block a user