读书人

计算调用速度的步骤

发布时间: 2012-10-16 09:57:37 作者: rapoo

计算调用速度的方法
一个计算调用速度的方法

private static int speedCount = 0;private static long lastTime = 0;private static synchronized void countSpeed() {if (lastTime == 0) {lastTime = System.currentTimeMillis();} else {long now = System.currentTimeMillis();if (now - lastTime >= 5000) {lastTime = now;speedCount = 0;} else {speedCount++;}}}

读书人网 >编程

热点推荐