| 1 | #!/usr/bin/env perl | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Getopt::Long qw(GetOptions); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use JSON::PP; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Linux::Event; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Linux::Event::IO::Sock::Dgram; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Linux::Event::Loop; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | my $packets = 100_000; | |||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | my $bytes = 64; | |||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | my @modes = qw(connected unconnected); | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | my $repeats = 5; | |||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | my $json_path; | |||||||||||||||||||||||||||||||||||||||||||||
| 19 | my $help; | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | GetOptions( | ||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 'packets=i' => \$packets, | ||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 'bytes=i' => \$bytes, | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | 'modes=s' => sub { @modes = split /,/, $_[1] }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | ▶ | 'repeats=i' => \$repeats, | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 'json=s' => \$json_path, | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 'help' => \$help, | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | ) or usage(1); | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | usage(0) if $help; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | die "packets must be positive\n" if $packets < 1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | ▶ | die "bytes must be between 1 and 65507\n" if $bytes < 1 || $bytes > 65_507; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$bytes < 1 or $bytes > 65507
MC/DC0%0/2
$bytes < 1 or $bytes > 65507
$bytes < 1
$bytes > 65507
Truth table33%1/3
A or B
A= $bytes < 1B= $bytes > 65507
| |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | die "repeats must be positive\n" if $repeats < 1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | die "modes must contain connected and/or unconnected\n" | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | ▶ | if !@modes || grep { $_ ne 'connected' && $_ ne 'unconnected' } @modes; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
not @modes or grep {$_ ne "connected" and $_ ne "unconnected";} @modes
$_ ne 'connected' && $_ ne 'unconnected'
MC/DC0%0/2
not @modes or grep {$_ ne "connected" and $_ ne "unconnected";} @modes
not @modes
grep {$_ ne "connected" and $_ ne "unconnected";} @modes
MC/DC0%0/2
$_ ne 'connected' && $_ ne 'unconnected'
$_ ne 'connected'
$_ ne 'unconnected'
Truth table33%1/3
not(A) or B
A= not @modesB= grep {$_ ne "connected" and $_ ne "unconnected";} @modes
Truth table66%2/3
A && B
A= $_ ne 'connected'B= $_ ne 'unconnected'
| |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | package BenchDatagramServer; | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | ▶ | use parent 'Linux::Event::IO::Sock::Dgram'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 40 | ▶ | sub on_datagram ($socket, $payload, $peer) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_datagram: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 40 | ▶ | $socket->send($payload, to => $peer) | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$socket->send($payload, "to", $peer) // die("server could not echo packet\n")
MC/DC0%0/1
$socket->send($payload, "to", $peer) // die("server could not echo packet\n")
$socket->send($payload, "to", $peer)
Truth table50%1/2
A
A= $socket->send($payload, "to", $peer)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | // die "server could not echo packet\n"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub on_error ($socket, $error) { die "$error\n" } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_error: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | package BenchDatagramClient; | |||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | ▶ | use parent 'Linux::Event::IO::Sock::Dgram'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 2 | ▶ | sub on_ready ($socket) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_ready: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 2 | my $run = $socket->data; | |||||||||||||||||||||||||||||||||||||||||||||
| 54 | 2 | $run->{started} = main::now(); | |||||||||||||||||||||||||||||||||||||||||||||
| 55 | 2 | main::send_next($socket, $run); | |||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 40 | ▶ | sub on_datagram ($socket, $payload, $peer) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_datagram: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 40 | my $run = $socket->data; | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | die "Datagram benchmark received a corrupt payload\n" | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 40 | ▶ | if $payload ne $run->{payload}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 40 | $run->{received}++; | |||||||||||||||||||||||||||||||||||||||||||||
| 63 | 40 | ▶ | if ($run->{received} == $run->{packets}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 2 | $run->{finished} = main::now(); | |||||||||||||||||||||||||||||||||||||||||||||
| 65 | 2 | $run->{loop}->stop; | |||||||||||||||||||||||||||||||||||||||||||||
| 66 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 38 | main::send_next($socket, $run); | |||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub on_error ($socket, $error) { die "$error\n" } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_error: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | ▶ | sub now () { clock_gettime(CLOCK_MONOTONIC) } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
now: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 6 | ▶ | sub median (@value) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
median: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | @value = sort { $a <=> $b } @value; | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | 6 | my $middle = int(@value / 2); | |||||||||||||||||||||||||||||||||||||||||||||
| 79 | 6 | ▶ | return @value % 2 | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | ? $value[$middle] | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | : ($value[$middle - 1] + $value[$middle]) / 2; | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 40 | ▶ | sub send_next ($socket, $run) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_next: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 85 | my $accepted = $run->{mode} eq 'connected' | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | ? $socket->send($run->{payload}) | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 40 | ▶ | : $socket->send($run->{payload}, to => $run->{server_address}); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 40 | ▶ | die "Datagram benchmark output was rejected\n" if !defined $accepted; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 40 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | my @raw; | |||||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | for my $mode (@modes) { | |||||||||||||||||||||||||||||||||||||||||||||
| 94 | 2 | for my $repeat (1 .. $repeats) { | |||||||||||||||||||||||||||||||||||||||||||||
| 95 | 2 | my $loop = Linux::Event::Loop->new; | |||||||||||||||||||||||||||||||||||||||||||||
| 96 | 2 | my $server = $loop->add(BenchDatagramServer->new( | |||||||||||||||||||||||||||||||||||||||||||||
| 97 | host => '127.0.0.1', # required | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | port => 0, # required; select an ephemeral port | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | )); | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 2 | my $run = { | |||||||||||||||||||||||||||||||||||||||||||||
| 101 | loop => $loop, | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | mode => $mode, | ||||||||||||||||||||||||||||||||||||||||||||||
| 103 | packets => $packets, | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | payload => 'x' x $bytes, | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | received => 0, | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | server_address => $server->local, | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 2 | ▶ | my $client = $mode eq 'connected' | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 109 | ? BenchDatagramClient->connect( | ||||||||||||||||||||||||||||||||||||||||||||||
| 110 | host => '127.0.0.1', # required | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | port => $server->local->port, # required | ||||||||||||||||||||||||||||||||||||||||||||||
| 112 | data => $run, # optional | ||||||||||||||||||||||||||||||||||||||||||||||
| 113 | ) | ||||||||||||||||||||||||||||||||||||||||||||||
| 114 | : BenchDatagramClient->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | host => '127.0.0.1', # required | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | port => 0, # required | ||||||||||||||||||||||||||||||||||||||||||||||
| 117 | data => $run, # optional | ||||||||||||||||||||||||||||||||||||||||||||||
| 118 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | $loop->add($client); | |||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | my ($user_start, $system_start) = (times)[0, 1]; | |||||||||||||||||||||||||||||||||||||||||||||
| 121 | 2 | $loop->run; | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | my ($user_end, $system_end) = (times)[0, 1]; | |||||||||||||||||||||||||||||||||||||||||||||
| 123 | 2 | my $elapsed = $run->{finished} - $run->{started}; | |||||||||||||||||||||||||||||||||||||||||||||
| 124 | 2 | my $cpu = ($user_end - $user_start) + ($system_end - $system_start); | |||||||||||||||||||||||||||||||||||||||||||||
| 125 | 2 | $client->close; | |||||||||||||||||||||||||||||||||||||||||||||
| 126 | 2 | $server->close; | |||||||||||||||||||||||||||||||||||||||||||||
| 127 | die "Datagram benchmark received $run->{received} of $packets packets\n" | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 2 | ▶ | if $run->{received} != $packets; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 2 | push @raw, { | |||||||||||||||||||||||||||||||||||||||||||||
| 130 | mode => $mode, | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | repeat => $repeat, | ||||||||||||||||||||||||||||||||||||||||||||||
| 132 | packets => $packets, | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | bytes => $bytes, | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | elapsed_seconds => 0 + $elapsed, | ||||||||||||||||||||||||||||||||||||||||||||||
| 135 | packets_per_second => $packets / $elapsed, | ||||||||||||||||||||||||||||||||||||||||||||||
| 136 | mebibytes_per_second => ($packets * $bytes) / $elapsed / 1_048_576, | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | cpu_us_per_packet => $cpu * 1_000_000 / $packets, | ||||||||||||||||||||||||||||||||||||||||||||||
| 138 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 | my @summary; | |||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | for my $mode (@modes) { | |||||||||||||||||||||||||||||||||||||||||||||
| 144 | 2 | my @row = grep { $_->{mode} eq $mode } @raw; | |||||||||||||||||||||||||||||||||||||||||||||
| 145 | push @summary, { | ||||||||||||||||||||||||||||||||||||||||||||||
| 146 | mode => $mode, | ||||||||||||||||||||||||||||||||||||||||||||||
| 147 | median_packets_per_second => median( | ||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 2 | map { $_->{packets_per_second} } @row, | |||||||||||||||||||||||||||||||||||||||||||||
| 149 | ), | ||||||||||||||||||||||||||||||||||||||||||||||
| 150 | median_mebibytes_per_second => median( | ||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 2 | map { $_->{mebibytes_per_second} } @row, | |||||||||||||||||||||||||||||||||||||||||||||
| 152 | ), | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | median_cpu_us_per_packet => median( | ||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 2 | map { $_->{cpu_us_per_packet} } @row, | |||||||||||||||||||||||||||||||||||||||||||||
| 155 | ), | ||||||||||||||||||||||||||||||||||||||||||||||
| 156 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 1 | printf "Datagram UDP serial echo: packets=%d bytes=%d repeats=%d\n", | |||||||||||||||||||||||||||||||||||||||||||||
| 160 | $packets, $bytes, $repeats; | ||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 1 | printf "%-12s %18s %14s %16s\n", | |||||||||||||||||||||||||||||||||||||||||||||
| 162 | 'mode', 'packets/s', 'MiB/s', 'cpu us/packet'; | ||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | for my $row (@summary) { | |||||||||||||||||||||||||||||||||||||||||||||
| 164 | printf "%-12s %18.1f %14.2f %16.3f\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 165 | $row->{mode}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 166 | $row->{median_packets_per_second}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 167 | $row->{median_mebibytes_per_second}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 2 | $row->{median_cpu_us_per_packet}; | |||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 1 | ▶ | if (defined $json_path) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | my $report = { | |||||||||||||||||||||||||||||||||||||||||||||
| 173 | benchmark => 'linux-event-datagram-microbench', | ||||||||||||||||||||||||||||||||||||||||||||||
| 174 | benchmark_contract_version => 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 175 | linux_event_version => $Linux::Event::VERSION, | ||||||||||||||||||||||||||||||||||||||||||||||
| 176 | workload => 'IPv4 loopback serial UDP echo', | ||||||||||||||||||||||||||||||||||||||||||||||
| 177 | configuration => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 178 | packets => $packets, | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | bytes => $bytes, | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | modes => \@modes, | ||||||||||||||||||||||||||||||||||||||||||||||
| 181 | repeats => $repeats, | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | raw => \@raw, | ||||||||||||||||||||||||||||||||||||||||||||||
| 184 | summary => \@summary, | ||||||||||||||||||||||||||||||||||||||||||||||
| 185 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 1 | ▶ | open my $json, '>', $json_path or die "open $json_path: $!\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 1 | print {$json} JSON::PP->new->canonical->pretty->encode($report); | |||||||||||||||||||||||||||||||||||||||||||||
| 188 | 1 | ▶ | close $json or die "close $json_path: $!\n"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | sub usage ($exit) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
usage: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | print <<'USAGE'; | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | Usage: run-datagram-microbench.pl [options] | ||||||||||||||||||||||||||||||||||||||||||||||
| 194 | --packets=N serial echo round trips per repeat (default: 100000) | ||||||||||||||||||||||||||||||||||||||||||||||
| 195 | --bytes=N payload bytes per packet, 1..65507 (default: 64) | ||||||||||||||||||||||||||||||||||||||||||||||
| 196 | --modes=LIST connected,unconnected (default: both) | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | --repeats=N measured repeats (default: 5) | ||||||||||||||||||||||||||||||||||||||||||||||
| 198 | --json=PATH write a machine-readable report | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | --help show this help | ||||||||||||||||||||||||||||||||||||||||||||||
| 200 | USAGE | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | exit $exit; | |||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||