Search in sources :

Example 1 with Operation

use of org.apache.cassandra.stress.Operation in project cassandra by apache.

the class SampledOpDistributionFactory method get.

public OpDistribution get(boolean isWarmup, MeasurementSink sink) {
    PartitionGenerator generator = newGenerator();
    List<Pair<Operation, Double>> operations = new ArrayList<>();
    for (Map.Entry<T, Double> ratio : ratios.entrySet()) {
        List<? extends Operation> ops = get(new Timer(ratio.getKey().toString(), sink), generator, ratio.getKey(), isWarmup);
        for (Operation op : ops) operations.add(new Pair<>(op, ratio.getValue() / ops.size()));
    }
    return new SampledOpDistribution(new EnumeratedDistribution<>(operations), clustering.get());
}
Also used : PartitionGenerator(org.apache.cassandra.stress.generate.PartitionGenerator) ArrayList(java.util.ArrayList) Operation(org.apache.cassandra.stress.Operation) Timer(org.apache.cassandra.stress.report.Timer) Map(java.util.Map) Pair(org.apache.commons.math3.util.Pair)

Aggregations

ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Operation (org.apache.cassandra.stress.Operation)1 PartitionGenerator (org.apache.cassandra.stress.generate.PartitionGenerator)1 Timer (org.apache.cassandra.stress.report.Timer)1 Pair (org.apache.commons.math3.util.Pair)1