日期:2014-05-18 浏览次数:20677 次
public class Test implements Runnable {
Go go;
private String currentTime;
private Date now = new Date();
private SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyy/MM/dd HH:mm:ss");
public void run() {
go = new Go();
/**
* 8s=10ms*800 我让它休眠10ms,再给count+1,
* 忽略调用函数和count++的时间也就是说当count==800时就刚好运行了8秒
*/
int count = 0;
while (true && count < 850) {
try {
go.go_R(653, 546);// 模拟鼠标点击函数
Thread.sleep(10);
count++;
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public static void main(String[] args) {
Thread t = new Thread(new Test());
t.start();
}
}
while (true && count < 850) {
try {
long start = System.currentTimeMillis();
go.go_R(653, 546);// 模拟鼠标点击函
Thread.sleep(10);
count++;
long end = System.currentTimeMillis();
System.out.println(end - start);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}