IgniteSqlQueryPutBenchmark: print number of puts and queries.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/900788b6 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/900788b6 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/900788b6 Branch: refs/heads/ignite-801 Commit: 900788b68c4e093606abd2f7820ca08d94763802 Parents: ce63637 Author: sboikov <[email protected]> Authored: Fri Nov 20 10:41:34 2015 +0300 Committer: sboikov <[email protected]> Committed: Fri Nov 20 10:41:34 2015 +0300 ---------------------------------------------------------------------- .../cache/IgniteSqlQueryPutBenchmark.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/900788b6/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java ---------------------------------------------------------------------- diff --git a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java index 1c258a4..99b2423 100644 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteSqlQueryPutBenchmark.java @@ -20,16 +20,25 @@ package org.apache.ignite.yardstick.cache; import java.util.Collection; import java.util.Map; import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.atomic.AtomicInteger; import javax.cache.Cache; import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.query.SqlQuery; import org.apache.ignite.yardstick.cache.model.Person; import org.yardstickframework.BenchmarkConfiguration; +import static org.yardstickframework.BenchmarkUtils.println; + /** * Ignite benchmark that performs put and query operations. */ public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> { + /** */ + private AtomicInteger putCnt = new AtomicInteger(); + + /** */ + private AtomicInteger qryCnt = new AtomicInteger(); + /** {@inheritDoc} */ @Override public void setUp(BenchmarkConfiguration cfg) throws Exception { super.setUp(cfg); @@ -53,11 +62,15 @@ public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark<Int throw new Exception("Invalid person retrieved [min=" + salary + ", max=" + maxSalary + ", person=" + p + ']'); } + + qryCnt.getAndIncrement(); } else { int i = rnd.nextInt(args.range()); cache.put(i, new Person(i, "firstName" + i, "lastName" + i, i * 1000)); + + putCnt.getAndIncrement(); } return true; @@ -81,4 +94,11 @@ public class IgniteSqlQueryPutBenchmark extends IgniteCacheAbstractBenchmark<Int @Override protected IgniteCache<Integer, Object> cache() { return ignite().cache("query"); } + + /** {@inheritDoc} */ + @Override public void tearDown() throws Exception { + println(cfg, "Finished sql query put benchmark [putCnt=" + putCnt.get() + ", qryCnt=" + qryCnt.get() + ']'); + + super.tearDown(); + } }
