@Test
	public void runBenchmarks() throws IOException {
		StopWatch stopWatch = new StopWatch("Tuple ser/deser - Iterations:" + ITERATIONS + " number of fields:" +
				NUM_FIELDS);

		Tuple[] primitiveTuples = generateSamples(false);
		Tuple[] nestedTuples = generateSamples(true);

		//warm up
		long endTime = System.currentTimeMillis() + 5000;
		int i = 0;
		do {
			runBenchmark(stopWatch, "warmup  " + i, primitiveTuples, serializer, deserializer);
			i++;
		} while (System.currentTimeMillis() < endTime);


		runBenchmark(stopWatch, "primitives", primitiveTuples, serializer, deserializer);
		runBenchmark(stopWatch, "nested", nestedTuples, serializer, deserializer);
		System.out.println(stopWatch.prettyPrint());
		for (StopWatch.TaskInfo taskInfo : stopWatch.getTaskInfo()) {
			if (taskInfo.getTaskName().equals("primitives") || taskInfo.getTaskName().equals("nested")) {
				double nanosecs = taskInfo.getTimeMillis() * 1000000.0;
				double averagens = nanosecs / ITERATIONS;
				System.out.println(taskInfo.getTaskName() + ": avg time (ns) " + averagens);
			}
		}

	}
@author David Turanski
@author Gary Russell
spring-xd-benchmark/src/test/java/org/springframework/xd/tuple/serializer/kryo/TupleCodecBenchmarkTests.java