package edu.hitsz.c102c.util;
/**
* ¼ÆÊ±µÄ²âÊÔ¹¤¾ß
*
* @author jiqunpeng
*
* ´´½¨Ê±¼ä£º2014-7-8 ÏÂÎç8:21:56
*/
public class TimedTest {
private int repeat;
private TestTask task;
public interface TestTask {
public void process();
}
public TimedTest(TestTask t, int repeat) {
this.repeat = repeat;
task = t;
}
public void test() {
long t = System.currentTimeMillis();
for (int i = 0; i < repeat; i++) {
task.process();
}
double cost = (System.currentTimeMillis() - t) / 1000.0;
Log.i("cost ", cost + "s");
}
}
Ads help maintain this website.