From 63ff271125fe851dbe44fa578a7bb0028d976bfd Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 1 May 2021 20:25:10 +0200 Subject: [PATCH] Userland: Improve how traceroute reports timing data for packets Previously we'd include the time required to do DNS resolution in the time we'd report for traceroute packets. This would skew the times reported. --- Userland/Utilities/traceroute.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Utilities/traceroute.cpp b/Userland/Utilities/traceroute.cpp index 6c4a40a7be..ed6a097c3f 100644 --- a/Userland/Utilities/traceroute.cpp +++ b/Userland/Utilities/traceroute.cpp @@ -116,6 +116,7 @@ int main(int argc, char** argv) return -1; continue; } + auto response_time = m_timer.elapsed(); if (response.header.type != ICMP_ECHOREPLY && response.header.type != ICMP_TIME_EXCEEDED) continue; @@ -129,7 +130,7 @@ int main(int argc, char** argv) char addr_buf[INET_ADDRSTRLEN]; peer_name = inet_ntop(AF_INET, &peer_address.sin_addr, addr_buf, sizeof(addr_buf)); } - outln("{:2}: {:50} {:4}ms", ttl, peer_name, m_timer.elapsed()); + outln("{:2}: {:50} {:4}ms", ttl, peer_name, response_time); if (response.header.type == ICMP_TIME_EXCEEDED) return 0;