From 119cb7b6e8efa65127ffa9eb8a11a026ddfe7612 Mon Sep 17 00:00:00 2001 From: yuuki Date: Thu, 26 Jun 2025 00:04:17 +0900 Subject: [PATCH 1/2] docs: clarify CNT field meaning in help output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 5369881..4c3c76a 100644 --- a/main.go +++ b/main.go @@ -74,7 +74,7 @@ func init() { pflag.Int32Var(&connections, "connections", 10, fmt.Sprintf("[client mode] Number of concurrent connections to keep (only for '%s')", flavorPersistent)) pflag.Int32Var(&rate, "rate", 100, - fmt.Sprintf("[client mode] New connections throughput (/s) (for '%s') or message roundtrip throughput per connection (/s) (for '%s' and UDP)", flavorEphemeral, flavorPersistent)) + 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)) pflag.DurationVar(&duration, "duration", 10*time.Second, "[client mode] measurement period") pflag.Int32Var(&messageBytes, "message-bytes", 64, "[client mode] TCP/UDP message size (bytes)") pflag.BoolVar(&showOnlyResults, "show-only-results", false, "[client mode] print only results of measurement stats") @@ -167,11 +167,16 @@ func printUsage() { fmt.Fprintf(os.Stderr, " -s, --server Run in server mode (accept connections)\n\n") fmt.Fprintf(os.Stderr, "Options:\n") pflag.PrintDefaults() - fmt.Fprintf(os.Stderr, "\nExamples:\n") + fmt.Fprintf(os.Stderr, "\nOutput Format (Client Mode):\n") + fmt.Fprintf(os.Stderr, " CNT: Total number of messages/requests sent (not connections)\n") + fmt.Fprintf(os.Stderr, " For persistent mode: CNT = rate × duration × connections\n") + fmt.Fprintf(os.Stderr, " For ephemeral mode: CNT = rate × duration\n\n") + fmt.Fprintf(os.Stderr, "Examples:\n") fmt.Fprintf(os.Stderr, " %s -s # Start server on default port 9100\n", os.Args[0]) fmt.Fprintf(os.Stderr, " %s -s 0.0.0.0:8080 # Start server on port 8080\n", os.Args[0]) fmt.Fprintf(os.Stderr, " %s -c localhost:9100 # Connect to server as client\n", os.Args[0]) fmt.Fprintf(os.Stderr, " %s -c --connections 50 host:port # Connect with 50 connections\n", os.Args[0]) + fmt.Fprintf(os.Stderr, " %s -c --connections 1 --rate 1 --duration 1s host:port # Send exactly 1 message\n", os.Args[0]) } func runServer() error { From b598b9561e9a151741e7b1987963d42da228a981 Mon Sep 17 00:00:00 2001 From: yuuki Date: Thu, 26 Jun 2025 00:08:34 +0900 Subject: [PATCH 2/2] docs: update README to clarify CNT field meaning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 30f8a70..8c86b82 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ Options: --duration duration [client mode] measurement period (default 10s) --enable-pprof [client mode] enable pprof profiling --flavor string [client mode] connect behavior type 'persistent' or 'ephemeral' (default "persistent") + -h, --help show help information --interval duration [client mode] interval for printing stats (default 5s) --jsonlines [client mode] output results in JSON Lines format --listen-addrs-file string [server mode] enable to pass a file including a pair of addresses and ports @@ -132,16 +133,22 @@ Options: --pprof-addr string [client mode] pprof listening address:port (default "localhost:6060") --proto string [client mode] protocol (tcp or udp) (default "tcp") --protocol string [server mode] listening protocol ('tcp' or 'udp') (default "all") - --rate int32 [client mode] New connections throughput (/s) (only for 'ephemeral') (default 100) + --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) -s, --server run in server mode --show-only-results [client mode] print only results of measurement stats --version show version information +Output Format (Client Mode): + CNT: Total number of messages/requests sent (not connections) + For persistent mode: CNT = rate × duration × connections + For ephemeral mode: CNT = rate × duration + Examples: tcpulse -s # Start server on default port 9100 tcpulse -s 0.0.0.0:8080 # Start server on port 8080 tcpulse -c localhost:9100 # Connect to server as client tcpulse -c --connections 50 host:port # Connect with 50 connections + tcpulse -c --connections 1 --rate 1 --duration 1s host:port # Send exactly 1 message ``` ## Examples @@ -181,6 +188,11 @@ $ tcpulse -c --jsonlines --rate 1000 --duration 10s 127.0.0.1:9100 #### Standard Output Format +The standard output format includes the following columns: +- `CNT`: Total number of messages/requests sent (not connections) +- For persistent mode: CNT = rate × duration × connections +- For ephemeral mode: CNT = rate × duration + ```shell-session $ tcpulse -c --proto tcp --flavor ephemeral --rate 1000 --duration 15s 10.0.150.2:9200 10.0.150.2:9300 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 The JSON Lines format includes the following fields: - `peer`: Target server address -- `count`: Total number of successful connections/requests +- `count`: Total number of messages/requests sent (CNT in standard output) - `latency_max_us`: Maximum latency in microseconds - `latency_min_us`: Minimum latency in microseconds - `latency_mean_us`: Mean latency in microseconds