Skip to content

Commit 8699597

Browse files
yuukiclaude
andauthored
docs: clarify CNT field meaning in help output (#44)
* docs: clarify CNT field meaning in help output - Update --rate flag description to explain CNT calculation formula - Add "Output Format" section explaining CNT represents total messages sent - Include formulas for persistent (rate × duration × connections) and ephemeral (rate × duration) modes - Add example showing how to send exactly 1 message Fixes confusion where users expect CNT to represent number of connections rather than total messages/requests sent. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * docs: update README to clarify CNT field meaning - Add explanation that CNT represents total messages sent, not connections - Include CNT calculation formulas for persistent and ephemeral modes - Update help output example to match current implementation - Clarify JSON Lines count field corresponds to CNT column 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7109825 commit 8699597

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Options:
124124
--duration duration [client mode] measurement period (default 10s)
125125
--enable-pprof [client mode] enable pprof profiling
126126
--flavor string [client mode] connect behavior type 'persistent' or 'ephemeral' (default "persistent")
127+
-h, --help show help information
127128
--interval duration [client mode] interval for printing stats (default 5s)
128129
--jsonlines [client mode] output results in JSON Lines format
129130
--listen-addrs-file string [server mode] enable to pass a file including a pair of addresses and ports
@@ -132,16 +133,22 @@ Options:
132133
--pprof-addr string [client mode] pprof listening address:port (default "localhost:6060")
133134
--proto string [client mode] protocol (tcp or udp) (default "tcp")
134135
--protocol string [server mode] listening protocol ('tcp' or 'udp') (default "all")
135-
--rate int32 [client mode] New connections throughput (/s) (only for 'ephemeral') (default 100)
136+
--rate int32 [client mode] Message throughput per connection (/s) (for 'persistent' and UDP) or new connections throughput (/s) (for 'ephemeral'). Total messages (CNT) = rate * duration * connections (for 'persistent') or rate * duration (for 'ephemeral') (default 100)
136137
-s, --server run in server mode
137138
--show-only-results [client mode] print only results of measurement stats
138139
--version show version information
139140
141+
Output Format (Client Mode):
142+
CNT: Total number of messages/requests sent (not connections)
143+
For persistent mode: CNT = rate × duration × connections
144+
For ephemeral mode: CNT = rate × duration
145+
140146
Examples:
141147
tcpulse -s # Start server on default port 9100
142148
tcpulse -s 0.0.0.0:8080 # Start server on port 8080
143149
tcpulse -c localhost:9100 # Connect to server as client
144150
tcpulse -c --connections 50 host:port # Connect with 50 connections
151+
tcpulse -c --connections 1 --rate 1 --duration 1s host:port # Send exactly 1 message
145152
```
146153

147154
## Examples
@@ -181,6 +188,11 @@ $ tcpulse -c --jsonlines --rate 1000 --duration 10s 127.0.0.1:9100
181188

182189
#### Standard Output Format
183190

191+
The standard output format includes the following columns:
192+
- `CNT`: Total number of messages/requests sent (not connections)
193+
- For persistent mode: CNT = rate × duration × connections
194+
- For ephemeral mode: CNT = rate × duration
195+
184196
```shell-session
185197
$ tcpulse -c --proto tcp --flavor ephemeral --rate 1000 --duration 15s 10.0.150.2:9200 10.0.150.2:9300
186198
PEER CNT LAT_MAX(µs) LAT_MIN(µs) LAT_MEAN(µs) LAT_90p(µs) LAT_95p(µs) LAT_99p(µs) RATE(/s)
@@ -205,7 +217,7 @@ $ tcpulse -c --jsonlines --proto tcp --flavor ephemeral --rate 1000 --duration 1
205217

206218
The JSON Lines format includes the following fields:
207219
- `peer`: Target server address
208-
- `count`: Total number of successful connections/requests
220+
- `count`: Total number of messages/requests sent (CNT in standard output)
209221
- `latency_max_us`: Maximum latency in microseconds
210222
- `latency_min_us`: Minimum latency in microseconds
211223
- `latency_mean_us`: Mean latency in microseconds

main.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func init() {
7474
pflag.Int32Var(&connections, "connections", 10,
7575
fmt.Sprintf("[client mode] Number of concurrent connections to keep (only for '%s')", flavorPersistent))
7676
pflag.Int32Var(&rate, "rate", 100,
77-
fmt.Sprintf("[client mode] New connections throughput (/s) (for '%s') or message roundtrip throughput per connection (/s) (for '%s' and UDP)", flavorEphemeral, flavorPersistent))
77+
fmt.Sprintf("[client mode] Message throughput per connection (/s) (for '%s' and UDP) or new connections throughput (/s) (for '%s'). Total messages (CNT) = rate * duration * connections (for '%s') or rate * duration (for '%s')", flavorPersistent, flavorEphemeral, flavorPersistent, flavorEphemeral))
7878
pflag.DurationVar(&duration, "duration", 10*time.Second, "[client mode] measurement period")
7979
pflag.Int32Var(&messageBytes, "message-bytes", 64, "[client mode] TCP/UDP message size (bytes)")
8080
pflag.BoolVar(&showOnlyResults, "show-only-results", false, "[client mode] print only results of measurement stats")
@@ -167,11 +167,16 @@ func printUsage() {
167167
fmt.Fprintf(os.Stderr, " -s, --server Run in server mode (accept connections)\n\n")
168168
fmt.Fprintf(os.Stderr, "Options:\n")
169169
pflag.PrintDefaults()
170-
fmt.Fprintf(os.Stderr, "\nExamples:\n")
170+
fmt.Fprintf(os.Stderr, "\nOutput Format (Client Mode):\n")
171+
fmt.Fprintf(os.Stderr, " CNT: Total number of messages/requests sent (not connections)\n")
172+
fmt.Fprintf(os.Stderr, " For persistent mode: CNT = rate × duration × connections\n")
173+
fmt.Fprintf(os.Stderr, " For ephemeral mode: CNT = rate × duration\n\n")
174+
fmt.Fprintf(os.Stderr, "Examples:\n")
171175
fmt.Fprintf(os.Stderr, " %s -s # Start server on default port 9100\n", os.Args[0])
172176
fmt.Fprintf(os.Stderr, " %s -s 0.0.0.0:8080 # Start server on port 8080\n", os.Args[0])
173177
fmt.Fprintf(os.Stderr, " %s -c localhost:9100 # Connect to server as client\n", os.Args[0])
174178
fmt.Fprintf(os.Stderr, " %s -c --connections 50 host:port # Connect with 50 connections\n", os.Args[0])
179+
fmt.Fprintf(os.Stderr, " %s -c --connections 1 --rate 1 --duration 1s host:port # Send exactly 1 message\n", os.Args[0])
175180
}
176181

177182
func runServer() error {

0 commit comments

Comments
 (0)