From 02e10db4782f93b49a212d26b54a5f30733ec113 Mon Sep 17 00:00:00 2001 From: lionsoul2014 Date: Mon, 29 Dec 2025 19:35:43 +0800 Subject: [PATCH] take the ip parse for costs stats --- .../src/main/java/org/lionsoul/ip2region/SearcherTest.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/binding/java/src/main/java/org/lionsoul/ip2region/SearcherTest.java b/binding/java/src/main/java/org/lionsoul/ip2region/SearcherTest.java index 33506f9..d0a28ce 100644 --- a/binding/java/src/main/java/org/lionsoul/ip2region/SearcherTest.java +++ b/binding/java/src/main/java/org/lionsoul/ip2region/SearcherTest.java @@ -239,6 +239,9 @@ public class SearcherTest { return; } + // mark the start time + long sTime = System.nanoTime(); + byte[] sip; try { sip = Util.parseIP(ps[0]); @@ -264,9 +267,7 @@ public class SearcherTest { } for (final byte[] ip : new byte[][]{sip, eip}) { - long sTime = System.nanoTime(); String region = searcher.search(ip); - costs += System.nanoTime() - sTime; // check the region info if (!ps[2].equals(region)) { @@ -277,6 +278,8 @@ public class SearcherTest { count++; } + + costs += System.nanoTime() - sTime; } reader.close();