这是我的代码,但我知道它不准确,因为它调用了函数,所以我怎样才能得到准确的响应时间,包括 tcp 握手、传输时间等。非常感谢。
long startTime = System.currentTimeMillis();
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
long endTime = System.currentTimeMillis();
System.out.println(endTime-startTime+"ms");