Skip to content

Commit

Permalink
Put standard deviation into its own line for easier parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-roscio committed Mar 13, 2018
1 parent a3651d4 commit d36dafb
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 27 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ Options:

```
# bin/sshping -d cheyenne.example.com
ssh-Login-Time: 1,730,431,639 nsec
Minimum-Latency: 836,491 nsec
Median-Latency: 1,006,323 nsec +/- 165,214 std dev
Average-Latency: 1,026,238 nsec
Maximum-Latency: 4,090,103 nsec
Echo-Count: 1,000 Bytes
Transfer-Size: 8,000,000 Bytes
Upload-Rate: 5,044,247 Bytes/second
ssh-Login-Time: 1,733,748,227 nsec
Minimum-Latency: 847,107 nsec
Median-Latency: 996,029 nsec
Average-Latency: 992,186 nsec
Average-Deviation: 67,079 nsec
Maximum-Latency: 1,289,470 nsec
Echo-Count: 1,000 Bytes
Transfer-Size: 8,000,000 Bytes
Upload-Rate: 5,102,315 Bytes/second
```

## Building
Expand Down
27 changes: 16 additions & 11 deletions doc/sshping.pod
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,17 @@ Median-Latency
not the same as the average; think of this as the "typical"
latency. You probably want this number when you think average.

The standard deviation is also shown. Yes, it can be greater
than the median!

Average-Latency
The average (mean) round-trip time for a character echo,
in nanoseconds.

Average-Deviation
The standard deviation on the average latency. It quantifies
how varied the latency is for each character's echo. A lower
number indicates a tighter grouping of latencies, a
higher number indicates more variation in the latencies.
"One" standard deviation is the average plus or minus this amount.

Maximum-Latency
The slowest (highest) round-trip time for a character echo,
in nanoseconds.
Expand Down Expand Up @@ -144,14 +148,15 @@ Upload-Rate
=head1 EXAMPLES

# bin/sshping -d cheyenne.example.com
ssh-Login-Time: 1,730,431,639 nsec
Minimum-Latency: 836,491 nsec
Median-Latency: 1,006,323 nsec +/- 165,214 std dev
Average-Latency: 1,026,238 nsec
Maximum-Latency: 4,090,103 nsec
Echo-Count: 1,000 Bytes
Transfer-Size: 8,000,000 Bytes
Upload-Rate: 5,044,247 Bytes/second
ssh-Login-Time: 1,733,748,227 nsec
Minimum-Latency: 847,107 nsec
Median-Latency: 996,029 nsec
Average-Latency: 992,186 nsec
Average-Deviation: 67,079 nsec
Maximum-Latency: 1,289,470 nsec
Echo-Count: 1,000 Bytes
Transfer-Size: 8,000,000 Bytes
Upload-Rate: 5,102,315 Bytes/second


=head1 AUTHOR
Expand Down
17 changes: 9 additions & 8 deletions src/sshping.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ ssh_channel login_channel(ssh_session & ses) {
if (verbosity) {
printf("+++ Login shell established\n");
}
printf("ssh-Login-Time: %15s nsec\n", fmtnum(nsec_diff(t0, t1)).c_str());
printf("ssh-Login-Time: %16s nsec\n", fmtnum(nsec_diff(t0, t1)).c_str());

return chn;
}
Expand Down Expand Up @@ -481,11 +481,12 @@ int run_echo_test(ssh_channel & chn) {
med_latency = (latencies[num_sent / 2 - 1] + latencies[(num_sent + 1) / 2 - 1]) / 2;
}
uint64_t stddev = standard_deviation(latencies, avg_latency);
printf("Minimum-Latency: %13s nsec\n", fmtnum(min_latency).c_str());
printf("Median-Latency: %13s nsec +/- %s std dev\n", fmtnum(med_latency).c_str(), fmtnum(stddev).c_str());
printf("Average-Latency: %13s nsec\n", fmtnum(avg_latency).c_str());
printf("Maximum-Latency: %13s nsec\n", fmtnum(max_latency).c_str());
printf("Echo-Count: %13s Bytes\n", fmtnum(num_sent).c_str());
printf("Minimum-Latency: %13s nsec\n", fmtnum(min_latency).c_str());
printf("Median-Latency: %13s nsec\n", fmtnum(med_latency).c_str());
printf("Average-Latency: %13s nsec\n", fmtnum(avg_latency).c_str());
printf("Average-Deviation: %13s nsec\n", fmtnum(stddev).c_str());
printf("Maximum-Latency: %13s nsec\n", fmtnum(max_latency).c_str());
printf("Echo-Count: %13s Bytes\n", fmtnum(num_sent).c_str());

// Terminate the echo responder
// TODO
Expand All @@ -502,7 +503,7 @@ int run_speed_test(ssh_session ses) {
if (verbosity) {
printf("+++ Speed test started\n");
}
printf("Transfer-Size: %13s Bytes\n", fmtnum(size * MEGA).c_str());
printf("Transfer-Size: %13s Bytes\n", fmtnum(size * MEGA).c_str());

ssh_scp scp = ssh_scp_new(ses, SSH_SCP_WRITE, tgt);
if (scp == NULL) {
Expand Down Expand Up @@ -544,7 +545,7 @@ int run_speed_test(ssh_session ses) {
if (duration == 0.0) duration = 0.000001;
uint64_t Bps = double(size * MEGA) / duration;

printf("Upload-Rate: %13s Bytes/second\n", fmtnum(Bps).c_str());
printf("Upload-Rate: %13s Bytes/second\n", fmtnum(Bps).c_str());
if (verbosity) {
printf("+++ Speed test completed\n");
}
Expand Down

0 comments on commit d36dafb

Please sign in to comment.