我已经使用 java.net 库制作了一个应用程序来捕获网页打开所花费的时间..示例代码
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
for(int i=0; i<20; i++ )
{
conn.disconnect();
conn.connect();
long starTime = System.currentTimeMillis();
JEditorPane editorPane = new JEditorPane();
editorPane.setPage(new URL());
long elasedTime = System.currentTimeMillis() - starTime;
System.out.println(elasedTime);
}
但我面临一个问题,缓存!如果我反复打开网页,那么在某些情况下它会显示 time=0 mills ......这当然是不可能的,请任何人帮助我!