@@ -57,7 +57,7 @@ public static void main(String[] args) throws Exception {
5757 // Try to report every 15 seconds. If nothing has changed, skip.
5858 do {
5959 //noinspection BusyWait
60- Thread .sleep (Duration .ofSeconds (15 ).toMillis ());
60+ Thread .sleep (Duration .ofSeconds (2 ).toMillis ());
6161
6262 // Cut down on noise if we are not running any requests.
6363 var snapshot = new Snapshot (instrumenter );
@@ -88,7 +88,10 @@ private static Path setupOutput() throws IOException {
8888 Files .createFile (outputFile );
8989 }
9090
91- System .out .println ("Server instrumentation output file. Watch this file for server statistics during your load test.\n - " + outputFile );
91+ System .out .println ("""
92+ Server instrumentation output file created. Watch this file for server statistics during your load test.
93+ > watch cat {outputFile}
94+ """ .replace ("{outputFile}" , outputFile .toString ()));
9295 return outputFile ;
9396 }
9497
@@ -98,24 +101,24 @@ private static void writeStatus(Path outputFile, Snapshot snapshot) throws IOExc
98101 -------------------------------------------
99102 - Servers started: [%,d]
100103 - Active workers: [%,d]
104+ - Total connections: [%,d]
101105 - Accepted requests: [%,d]
102106 - Bad requests: [%,d]
107+ - Closed connections: [%,d]
103108 - Chunked requests: [%,d]
104109 - Chunked responses: [%,d]
105- - Closed connections: [%,d]
106- - Total connections: [%,d]
107110 - Bytes read: [%,d]
108111 - Bytes written: [%,d]
109112 """ ,
110113 snapshot .now ,
111- snapshot .serversStarted ,
112- snapshot .activeWorkers ,
114+ snapshot .servers ,
115+ snapshot .workers ,
116+ snapshot .acceptedConnections ,
113117 snapshot .acceptedRequests ,
114118 snapshot .badRequests ,
119+ snapshot .closedConnections ,
115120 snapshot .chunkedRequests ,
116121 snapshot .chunkedResponses ,
117- snapshot .closedConnections ,
118- snapshot .totalConnections ,
119122 snapshot .bytesRead ,
120123 snapshot .bytesWritten );
121124
@@ -125,9 +128,9 @@ private static void writeStatus(Path outputFile, Snapshot snapshot) throws IOExc
125128 }
126129
127130 private static class Snapshot {
128- public long acceptedRequests ;
131+ public long acceptedConnections ;
129132
130- public long activeWorkers ;
133+ public long acceptedRequests ;
131134
132135 public long badRequests ;
133136
@@ -143,20 +146,20 @@ private static class Snapshot {
143146
144147 public long now ;
145148
146- public long serversStarted ;
149+ public long servers ;
147150
148- public long totalConnections ;
151+ public long workers ;
149152
150153 public Snapshot (ThreadSafeCountingInstrumenter instrumenter ) {
151154 now = System .currentTimeMillis ();
152- serversStarted = instrumenter .getStartedCount ();
153- activeWorkers = instrumenter .getThreadCount ();
155+ servers = instrumenter .getServers ();
156+ workers = instrumenter .getWorkers ();
157+ acceptedConnections = instrumenter .getAcceptedConnections ();
154158 acceptedRequests = instrumenter .getAcceptedRequests ();
155159 badRequests = instrumenter .getBadRequests ();
156160 chunkedRequests = instrumenter .getChunkedRequests ();
157161 chunkedResponses = instrumenter .getChunkedResponses ();
158162 closedConnections = instrumenter .getClosedConnections ();
159- totalConnections = instrumenter .getConnections ();
160163 bytesRead = instrumenter .getBytesRead ();
161164 bytesWritten = instrumenter .getBytesWritten ();
162165 }
@@ -167,12 +170,12 @@ public boolean equals(Object o) {
167170 return false ;
168171 }
169172 Snapshot snapshot = (Snapshot ) o ;
170- return now == snapshot .now && serversStarted == snapshot .serversStarted && activeWorkers == snapshot .activeWorkers && acceptedRequests == snapshot .acceptedRequests && badRequests == snapshot .badRequests && chunkedRequests == snapshot .chunkedRequests && chunkedResponses == snapshot .chunkedResponses && closedConnections == snapshot .closedConnections && totalConnections == snapshot .totalConnections && bytesRead == snapshot .bytesRead && bytesWritten == snapshot .bytesWritten ;
173+ return now == snapshot .now && servers == snapshot .servers && workers == snapshot .workers && acceptedRequests == snapshot .acceptedRequests && badRequests == snapshot .badRequests && chunkedRequests == snapshot .chunkedRequests && chunkedResponses == snapshot .chunkedResponses && closedConnections == snapshot .closedConnections && acceptedConnections == snapshot .acceptedConnections && bytesRead == snapshot .bytesRead && bytesWritten == snapshot .bytesWritten ;
171174 }
172175
173176 @ Override
174177 public int hashCode () {
175- return Objects .hash (now , serversStarted , activeWorkers , acceptedRequests , badRequests , chunkedRequests , chunkedResponses , closedConnections , totalConnections , bytesRead , bytesWritten );
178+ return Objects .hash (now , servers , workers , acceptedRequests , badRequests , chunkedRequests , chunkedResponses , closedConnections , acceptedConnections , bytesRead , bytesWritten );
176179 }
177180 }
178181}
0 commit comments