使用resttemplate时如何获得响应时间

问题描述 投票:0回答:0

这是我的代码,但我知道它不准确,因为它调用了函数,所以我怎样才能得到准确的响应时间,包括 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");
java rest tcp resttemplate
© www.soinside.com 2019 - 2024. All rights reserved.