diff options
Diffstat (limited to 'src/main/java/com/it_jaros/jscanner/Scan.java')
| -rw-r--r-- | src/main/java/com/it_jaros/jscanner/Scan.java | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/main/java/com/it_jaros/jscanner/Scan.java b/src/main/java/com/it_jaros/jscanner/Scan.java index dc109c6..9b3bf5e 100644 --- a/src/main/java/com/it_jaros/jscanner/Scan.java +++ b/src/main/java/com/it_jaros/jscanner/Scan.java @@ -96,27 +96,11 @@ public class Scan { onDone.run(); } - public Counter getThreadCounter() { - return threadCounter; - } - - public Counter getHostCounter() { - return hostCounter; - } - - public Counter getSocketCounter() { - return socketCounter; - } - - public Counter getHostTotalCounter() { - return hostTotalCounter; - } - public void start() { start = System.currentTimeMillis(); } - public long getDurationMillis() { + private long getDurationMillis() { if (stop == 0) { if (start == 0) { return 0; @@ -162,7 +146,29 @@ public class Scan { this.threadCounter.dec(); } - public int portTotal() { - return this.portTotalCounter.current(); + public Statistics getStatistics() { + return new Statistics( + this.getDurationMillis(), + this.hostTotalCounter.current(), + this.hostCounter.current(), + this.hostCounter.max(), + this.portTotalCounter.current(), + this.threadCounter.current(), + this.threadCounter.max(), + this.socketCounter.current(), + this.socketCounter.max() + ); } + + public record Statistics( + long durationInMillis, + int hostTotal, + int hostCurrent, + int hostMaxConcurrent, + int portTotal, + int threadCurrent, + int threadMaxConcurrent, + int socketCurrent, + int socketMaxConcurrent + ) {} } |
