Newer
Older
AlgebraicDataflowArchitectureModel / AlgebraicDataflowArchitectureModel / src / experiment / PullExpriment.java
package experiment;

import experiment.pull.Main;

public class PullExpriment {
	public static void main(String[] args) {
		Main main = new Main();
		Long times = (long) 0;
		int num = 10000;
		
		for(int i = 0;i<num;i++) {
			long startTime = System.nanoTime();
			main.purchase(100);
			long endTime = System.nanoTime();
			main.getHistory().clear();
			times += endTime - startTime;
		}
		System.out.println("purchase:" + times / num);
		times = (long) 0;
		for(int i = 0;i<num;i++) {
			long startTime = System.nanoTime();
			main.getHistory();
			long endTime = System.nanoTime();
			times += endTime - startTime;
		}
		System.out.println("getHistory:" + times / num);
		times = (long) 0;
		for(int i = 0;i<num;i++) {
			long startTime = System.nanoTime();
			main.getPayment();
			long endTime = System.nanoTime();
			times += endTime - startTime;
		}
		System.out.println("getPayment:" + times / num);
		times = (long) 0;
		for(int i = 0;i<num;i++) {
			long startTime = System.nanoTime();
			main.getPoints();
			long endTime = System.nanoTime();
			times += endTime - startTime;
		}
		System.out.println("getPoints:" + times / num);
		times = (long) 0;
		for(int i = 0;i<num;i++) {
			long startTime = System.nanoTime();
			main.getTotal();
			long endTime = System.nanoTime();
			times += endTime - startTime;
		}
		System.out.println("getTotal:" + times / num);
	}
}