@@ -57,7 +57,7 @@ public static void main(String[] args) throws Exception {
57
57
// Try to report every 15 seconds. If nothing has changed, skip.
58
58
do {
59
59
//noinspection BusyWait
60
- Thread .sleep (Duration .ofSeconds (15 ).toMillis ());
60
+ Thread .sleep (Duration .ofSeconds (2 ).toMillis ());
61
61
62
62
// Cut down on noise if we are not running any requests.
63
63
var snapshot = new Snapshot (instrumenter );
@@ -88,7 +88,10 @@ private static Path setupOutput() throws IOException {
88
88
Files .createFile (outputFile );
89
89
}
90
90
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 ()));
92
95
return outputFile ;
93
96
}
94
97
@@ -98,24 +101,24 @@ private static void writeStatus(Path outputFile, Snapshot snapshot) throws IOExc
98
101
-------------------------------------------
99
102
- Servers started: [%,d]
100
103
- Active workers: [%,d]
104
+ - Total connections: [%,d]
101
105
- Accepted requests: [%,d]
102
106
- Bad requests: [%,d]
107
+ - Closed connections: [%,d]
103
108
- Chunked requests: [%,d]
104
109
- Chunked responses: [%,d]
105
- - Closed connections: [%,d]
106
- - Total connections: [%,d]
107
110
- Bytes read: [%,d]
108
111
- Bytes written: [%,d]
109
112
""" ,
110
113
snapshot .now ,
111
- snapshot .serversStarted ,
112
- snapshot .activeWorkers ,
114
+ snapshot .servers ,
115
+ snapshot .workers ,
116
+ snapshot .acceptedConnections ,
113
117
snapshot .acceptedRequests ,
114
118
snapshot .badRequests ,
119
+ snapshot .closedConnections ,
115
120
snapshot .chunkedRequests ,
116
121
snapshot .chunkedResponses ,
117
- snapshot .closedConnections ,
118
- snapshot .totalConnections ,
119
122
snapshot .bytesRead ,
120
123
snapshot .bytesWritten );
121
124
@@ -125,9 +128,9 @@ private static void writeStatus(Path outputFile, Snapshot snapshot) throws IOExc
125
128
}
126
129
127
130
private static class Snapshot {
128
- public long acceptedRequests ;
131
+ public long acceptedConnections ;
129
132
130
- public long activeWorkers ;
133
+ public long acceptedRequests ;
131
134
132
135
public long badRequests ;
133
136
@@ -143,20 +146,20 @@ private static class Snapshot {
143
146
144
147
public long now ;
145
148
146
- public long serversStarted ;
149
+ public long servers ;
147
150
148
- public long totalConnections ;
151
+ public long workers ;
149
152
150
153
public Snapshot (ThreadSafeCountingInstrumenter instrumenter ) {
151
154
now = System .currentTimeMillis ();
152
- serversStarted = instrumenter .getStartedCount ();
153
- activeWorkers = instrumenter .getThreadCount ();
155
+ servers = instrumenter .getServers ();
156
+ workers = instrumenter .getWorkers ();
157
+ acceptedConnections = instrumenter .getAcceptedConnections ();
154
158
acceptedRequests = instrumenter .getAcceptedRequests ();
155
159
badRequests = instrumenter .getBadRequests ();
156
160
chunkedRequests = instrumenter .getChunkedRequests ();
157
161
chunkedResponses = instrumenter .getChunkedResponses ();
158
162
closedConnections = instrumenter .getClosedConnections ();
159
- totalConnections = instrumenter .getConnections ();
160
163
bytesRead = instrumenter .getBytesRead ();
161
164
bytesWritten = instrumenter .getBytesWritten ();
162
165
}
@@ -167,12 +170,12 @@ public boolean equals(Object o) {
167
170
return false ;
168
171
}
169
172
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 ;
171
174
}
172
175
173
176
@ Override
174
177
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 );
176
179
}
177
180
}
178
181
}
0 commit comments