use of org.apache.cassandra.stress.report.Timer 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());
}
use of org.apache.cassandra.stress.report.Timer in project cassandra by apache.
the class SettingsCommandPreDefined method getFactory.
public OpDistributionFactory getFactory(final StressSettings settings) {
final SeedManager seeds = new SeedManager(settings);
return new OpDistributionFactory() {
public OpDistribution get(boolean isWarmup, MeasurementSink sink) {
final Timer timer1 = new Timer(type.toString(), sink);
final Timer timer = timer1;
return new FixedOpDistribution(PredefinedOperation.operation(type, timer, newGenerator(settings), seeds, settings, add));
}
public String desc() {
return type.toString();
}
public Iterable<OpDistributionFactory> each() {
return Collections.<OpDistributionFactory>singleton(this);
}
};
}
use of org.apache.cassandra.stress.report.Timer in project cassandra by apache.
the class SettingsCommandUser method getFactory.
public OpDistributionFactory getFactory(final StressSettings settings) {
final SeedManager seeds = new SeedManager(settings);
final TokenRangeIterator tokenRangeIterator = profile.tokenRangeQueries.isEmpty() ? null : new TokenRangeIterator(settings, profile.maybeLoadTokenRanges(settings));
return new SampledOpDistributionFactory<String>(ratios, clustering) {
protected List<? extends Operation> get(Timer timer, PartitionGenerator generator, String key, boolean isWarmup) {
if (key.equalsIgnoreCase("insert"))
return Collections.singletonList(profile.getInsert(timer, generator, seeds, settings));
if (key.equalsIgnoreCase("validate"))
return profile.getValidate(timer, generator, seeds, settings);
if (profile.tokenRangeQueries.containsKey(key))
return Collections.singletonList(profile.getBulkReadQueries(key, timer, settings, tokenRangeIterator, isWarmup));
return Collections.singletonList(profile.getQuery(key, timer, generator, seeds, settings, isWarmup));
}
protected PartitionGenerator newGenerator() {
return profile.newGenerator(settings);
}
};
}
Aggregations