| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # | 
| 2 |  |  |  |  |  |  | # Autogenerated by Thrift Compiler (0.14.0) | 
| 3 |  |  |  |  |  |  | # | 
| 4 |  |  |  |  |  |  | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING | 
| 5 |  |  |  |  |  |  | # | 
| 6 | 1 |  |  | 1 |  | 532 | use 5.10.0; | 
|  | 1 |  |  |  |  | 4 |  | 
| 7 | 1 |  |  | 1 |  | 6 | use strict; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 34 |  | 
| 8 | 1 |  |  | 1 |  | 6 | use warnings; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 33 |  | 
| 9 | 1 |  |  | 1 |  | 12 | use Thrift::Exception; | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 21 |  | 
| 10 | 1 |  |  | 1 |  | 5 | use Thrift::MessageType; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 26 |  | 
| 11 | 1 |  |  | 1 |  | 5 | use Thrift::Type; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 17 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 1 |  |  | 1 |  | 403 | use Types; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 35 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | # HELPER FUNCTIONS AND STRUCTURES | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | package BenchmarkService_fibonacci_args; | 
| 19 | 1 |  |  | 1 |  | 6 | use base qw(Class::Accessor); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 528 |  | 
| 20 |  |  |  |  |  |  | BenchmarkService_fibonacci_args->mk_accessors( qw( n ) ); | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub new { | 
| 23 | 10 |  |  | 10 |  | 13 | my $classname = shift; | 
| 24 | 10 |  |  |  |  | 14 | my $self      = {}; | 
| 25 | 10 |  | 50 |  |  | 31 | my $vals      = shift || {}; | 
| 26 | 10 |  |  |  |  | 19 | $self->{n} = undef; | 
| 27 | 10 | 50 |  |  |  | 26 | if (UNIVERSAL::isa($vals,'HASH')) { | 
| 28 | 10 | 50 |  |  |  | 20 | if (defined $vals->{n}) { | 
| 29 | 0 |  |  |  |  | 0 | $self->{n} = $vals->{n}; | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  | } | 
| 32 | 10 |  |  |  |  | 20 | return bless ($self, $classname); | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | sub getName { | 
| 36 | 0 |  |  | 0 |  | 0 | return 'BenchmarkService_fibonacci_args'; | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | sub read { | 
| 40 | 5 |  |  | 5 |  | 8 | my ($self, $input) = @_; | 
| 41 | 5 |  |  |  |  | 6 | my $xfer  = 0; | 
| 42 | 5 |  |  |  |  | 5 | my $fname; | 
| 43 | 5 |  |  |  |  | 6 | my $ftype = 0; | 
| 44 | 5 |  |  |  |  | 5 | my $fid   = 0; | 
| 45 | 5 |  |  |  |  | 15 | $xfer += $input->readStructBegin(\$fname); | 
| 46 | 5 |  |  |  |  | 7 | while (1) | 
| 47 |  |  |  |  |  |  | { | 
| 48 | 10 |  |  |  |  | 21 | $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid); | 
| 49 | 10 | 100 |  |  |  | 15 | if ($ftype == Thrift::TType::STOP) { | 
| 50 | 5 |  |  |  |  | 12 | last; | 
| 51 |  |  |  |  |  |  | } | 
| 52 | 5 |  |  |  |  | 11 | SWITCH: for($fid) | 
| 53 |  |  |  |  |  |  | { | 
| 54 | 5 | 50 |  |  |  | 22 | /^1$/ && do{      if ($ftype == Thrift::TType::BYTE) { | 
|  | 5 | 50 |  |  |  | 10 |  | 
| 55 | 5 |  |  |  |  | 17 | $xfer += $input->readByte(\$self->{n}); | 
| 56 |  |  |  |  |  |  | } else { | 
| 57 | 0 |  |  |  |  | 0 | $xfer += $input->skip($ftype); | 
| 58 |  |  |  |  |  |  | } | 
| 59 | 5 |  |  |  |  | 18 | last; }; | 
| 60 | 0 |  |  |  |  | 0 | $xfer += $input->skip($ftype); | 
| 61 |  |  |  |  |  |  | } | 
| 62 | 5 |  |  |  |  | 12 | $xfer += $input->readFieldEnd(); | 
| 63 |  |  |  |  |  |  | } | 
| 64 | 5 |  |  |  |  | 12 | $xfer += $input->readStructEnd(); | 
| 65 | 5 |  |  |  |  | 9 | return $xfer; | 
| 66 |  |  |  |  |  |  | } | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | sub write { | 
| 69 | 5 |  |  | 5 |  | 10 | my ($self, $output) = @_; | 
| 70 | 5 |  |  |  |  | 5 | my $xfer   = 0; | 
| 71 | 5 |  |  |  |  | 9 | $xfer += $output->writeStructBegin('BenchmarkService_fibonacci_args'); | 
| 72 | 5 | 50 |  |  |  | 12 | if (defined $self->{n}) { | 
| 73 | 5 |  |  |  |  | 11 | $xfer += $output->writeFieldBegin('n', Thrift::TType::BYTE, 1); | 
| 74 | 5 |  |  |  |  | 21 | $xfer += $output->writeByte($self->{n}); | 
| 75 | 5 |  |  |  |  | 9 | $xfer += $output->writeFieldEnd(); | 
| 76 |  |  |  |  |  |  | } | 
| 77 | 5 |  |  |  |  | 9 | $xfer += $output->writeFieldStop(); | 
| 78 | 5 |  |  |  |  | 8 | $xfer += $output->writeStructEnd(); | 
| 79 | 5 |  |  |  |  | 6 | return $xfer; | 
| 80 |  |  |  |  |  |  | } | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | package BenchmarkService_fibonacci_result; | 
| 83 | 1 |  |  | 1 |  | 2189 | use base qw(Class::Accessor); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 524 |  | 
| 84 |  |  |  |  |  |  | BenchmarkService_fibonacci_result->mk_accessors( qw( success ) ); | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | sub new { | 
| 87 | 10 |  |  | 10 |  | 29 | my $classname = shift; | 
| 88 | 10 |  |  |  |  | 15 | my $self      = {}; | 
| 89 | 10 |  | 50 |  |  | 32 | my $vals      = shift || {}; | 
| 90 | 10 |  |  |  |  | 20 | $self->{success} = undef; | 
| 91 | 10 | 50 |  |  |  | 24 | if (UNIVERSAL::isa($vals,'HASH')) { | 
| 92 | 10 | 50 |  |  |  | 19 | if (defined $vals->{success}) { | 
| 93 | 0 |  |  |  |  | 0 | $self->{success} = $vals->{success}; | 
| 94 |  |  |  |  |  |  | } | 
| 95 |  |  |  |  |  |  | } | 
| 96 | 10 |  |  |  |  | 24 | return bless ($self, $classname); | 
| 97 |  |  |  |  |  |  | } | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | sub getName { | 
| 100 | 0 |  |  | 0 |  | 0 | return 'BenchmarkService_fibonacci_result'; | 
| 101 |  |  |  |  |  |  | } | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | sub read { | 
| 104 | 5 |  |  | 5 |  | 18 | my ($self, $input) = @_; | 
| 105 | 5 |  |  |  |  | 8 | my $xfer  = 0; | 
| 106 | 5 |  |  |  |  | 5 | my $fname; | 
| 107 | 5 |  |  |  |  | 5 | my $ftype = 0; | 
| 108 | 5 |  |  |  |  | 6 | my $fid   = 0; | 
| 109 | 5 |  |  |  |  | 12 | $xfer += $input->readStructBegin(\$fname); | 
| 110 | 5 |  |  |  |  | 7 | while (1) | 
| 111 |  |  |  |  |  |  | { | 
| 112 | 10 |  |  |  |  | 23 | $xfer += $input->readFieldBegin(\$fname, \$ftype, \$fid); | 
| 113 | 10 | 100 |  |  |  | 20 | if ($ftype == Thrift::TType::STOP) { | 
| 114 | 5 |  |  |  |  | 6 | last; | 
| 115 |  |  |  |  |  |  | } | 
| 116 | 5 |  |  |  |  | 9 | SWITCH: for($fid) | 
| 117 |  |  |  |  |  |  | { | 
| 118 | 5 | 50 |  |  |  | 27 | /^0$/ && do{      if ($ftype == Thrift::TType::I32) { | 
|  | 5 | 50 |  |  |  | 19 |  | 
| 119 | 5 |  |  |  |  | 16 | $xfer += $input->readI32(\$self->{success}); | 
| 120 |  |  |  |  |  |  | } else { | 
| 121 | 0 |  |  |  |  | 0 | $xfer += $input->skip($ftype); | 
| 122 |  |  |  |  |  |  | } | 
| 123 | 5 |  |  |  |  | 8 | last; }; | 
| 124 | 0 |  |  |  |  | 0 | $xfer += $input->skip($ftype); | 
| 125 |  |  |  |  |  |  | } | 
| 126 | 5 |  |  |  |  | 13 | $xfer += $input->readFieldEnd(); | 
| 127 |  |  |  |  |  |  | } | 
| 128 | 5 |  |  |  |  | 11 | $xfer += $input->readStructEnd(); | 
| 129 | 5 |  |  |  |  | 8 | return $xfer; | 
| 130 |  |  |  |  |  |  | } | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | sub write { | 
| 133 | 5 |  |  | 5 |  | 8 | my ($self, $output) = @_; | 
| 134 | 5 |  |  |  |  | 7 | my $xfer   = 0; | 
| 135 | 5 |  |  |  |  | 10 | $xfer += $output->writeStructBegin('BenchmarkService_fibonacci_result'); | 
| 136 | 5 | 50 |  |  |  | 20 | if (defined $self->{success}) { | 
| 137 | 5 |  |  |  |  | 10 | $xfer += $output->writeFieldBegin('success', Thrift::TType::I32, 0); | 
| 138 | 5 |  |  |  |  | 10 | $xfer += $output->writeI32($self->{success}); | 
| 139 | 5 |  |  |  |  | 11 | $xfer += $output->writeFieldEnd(); | 
| 140 |  |  |  |  |  |  | } | 
| 141 | 5 |  |  |  |  | 10 | $xfer += $output->writeFieldStop(); | 
| 142 | 5 |  |  |  |  | 7 | $xfer += $output->writeStructEnd(); | 
| 143 | 5 |  |  |  |  | 9 | return $xfer; | 
| 144 |  |  |  |  |  |  | } | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | package BenchmarkServiceIf; | 
| 147 |  |  |  |  |  |  |  | 
| 148 | 1 |  |  | 1 |  | 8 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 70 |  | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | sub fibonacci{ | 
| 152 | 0 |  |  | 0 |  | 0 | my $self = shift; | 
| 153 | 0 |  |  |  |  | 0 | my $n = shift; | 
| 154 |  |  |  |  |  |  |  | 
| 155 | 0 |  |  |  |  | 0 | die 'implement interface'; | 
| 156 |  |  |  |  |  |  | } | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  | package BenchmarkServiceRest; | 
| 159 |  |  |  |  |  |  |  | 
| 160 | 1 |  |  | 1 |  | 7 | use strict; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 154 |  | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  |  | 
| 163 |  |  |  |  |  |  | sub new { | 
| 164 | 0 |  |  | 0 |  | 0 | my ($classname, $impl) = @_; | 
| 165 | 0 |  |  |  |  | 0 | my $self     ={ impl => $impl }; | 
| 166 |  |  |  |  |  |  |  | 
| 167 | 0 |  |  |  |  | 0 | return bless($self,$classname); | 
| 168 |  |  |  |  |  |  | } | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  | sub fibonacci{ | 
| 171 | 0 |  |  | 0 |  | 0 | my ($self, $request) = @_; | 
| 172 |  |  |  |  |  |  |  | 
| 173 | 0 | 0 |  |  |  | 0 | my $n = ($request->{'n'}) ? $request->{'n'} : undef; | 
| 174 | 0 |  |  |  |  | 0 | return $self->{impl}->fibonacci($n); | 
| 175 |  |  |  |  |  |  | } | 
| 176 |  |  |  |  |  |  |  | 
| 177 |  |  |  |  |  |  | package BenchmarkServiceClient; | 
| 178 |  |  |  |  |  |  |  | 
| 179 |  |  |  |  |  |  |  | 
| 180 | 1 |  |  | 1 |  | 7 | use base qw(BenchmarkServiceIf); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 850 |  | 
| 181 |  |  |  |  |  |  | sub new { | 
| 182 | 1 |  |  | 1 |  | 11 | my ($classname, $input, $output) = @_; | 
| 183 | 1 |  |  |  |  | 3 | my $self      = {}; | 
| 184 | 1 |  |  |  |  | 3 | $self->{input}  = $input; | 
| 185 | 1 | 50 |  |  |  | 3 | $self->{output} = defined $output ? $output : $input; | 
| 186 | 1 |  |  |  |  | 2 | $self->{seqid}  = 0; | 
| 187 | 1 |  |  |  |  | 3 | return bless($self,$classname); | 
| 188 |  |  |  |  |  |  | } | 
| 189 |  |  |  |  |  |  |  | 
| 190 |  |  |  |  |  |  | sub fibonacci{ | 
| 191 | 0 |  |  | 0 |  | 0 | my $self = shift; | 
| 192 | 0 |  |  |  |  | 0 | my $n = shift; | 
| 193 |  |  |  |  |  |  |  | 
| 194 | 0 |  |  |  |  | 0 | $self->send_fibonacci($n); | 
| 195 | 0 |  |  |  |  | 0 | return $self->recv_fibonacci(); | 
| 196 |  |  |  |  |  |  | } | 
| 197 |  |  |  |  |  |  |  | 
| 198 |  |  |  |  |  |  | sub send_fibonacci{ | 
| 199 | 5 |  |  | 5 |  | 27 | my $self = shift; | 
| 200 | 5 |  |  |  |  | 6 | my $n = shift; | 
| 201 |  |  |  |  |  |  |  | 
| 202 | 5 |  |  |  |  | 18 | $self->{output}->writeMessageBegin('fibonacci', Thrift::TMessageType::CALL, $self->{seqid}); | 
| 203 | 5 |  |  |  |  | 16 | my $args = BenchmarkService_fibonacci_args->new(); | 
| 204 | 5 |  |  |  |  | 9 | $args->{n} = $n; | 
| 205 | 5 |  |  |  |  | 13 | $args->write($self->{output}); | 
| 206 | 5 |  |  |  |  | 11 | $self->{output}->writeMessageEnd(); | 
| 207 | 5 |  |  |  |  | 24 | $self->{output}->getTransport()->flush(); | 
| 208 |  |  |  |  |  |  | } | 
| 209 |  |  |  |  |  |  |  | 
| 210 |  |  |  |  |  |  | sub recv_fibonacci{ | 
| 211 | 0 |  |  | 0 |  | 0 | my $self = shift; | 
| 212 |  |  |  |  |  |  |  | 
| 213 | 0 |  |  |  |  | 0 | my $rseqid = 0; | 
| 214 | 0 |  |  |  |  | 0 | my $fname; | 
| 215 | 0 |  |  |  |  | 0 | my $mtype = 0; | 
| 216 |  |  |  |  |  |  |  | 
| 217 | 0 |  |  |  |  | 0 | $self->{input}->readMessageBegin(\$fname, \$mtype, \$rseqid); | 
| 218 | 0 | 0 |  |  |  | 0 | if ($mtype == Thrift::TMessageType::EXCEPTION) { | 
| 219 | 0 |  |  |  |  | 0 | my $x = Thrift::TApplicationException->new(); | 
| 220 | 0 |  |  |  |  | 0 | $x->read($self->{input}); | 
| 221 | 0 |  |  |  |  | 0 | $self->{input}->readMessageEnd(); | 
| 222 | 0 |  |  |  |  | 0 | die $x; | 
| 223 |  |  |  |  |  |  | } | 
| 224 | 0 |  |  |  |  | 0 | my $result = BenchmarkService_fibonacci_result->new(); | 
| 225 | 0 |  |  |  |  | 0 | $result->read($self->{input}); | 
| 226 | 0 |  |  |  |  | 0 | $self->{input}->readMessageEnd(); | 
| 227 |  |  |  |  |  |  |  | 
| 228 | 0 | 0 |  |  |  | 0 | if (defined $result->{success} ) { | 
| 229 | 0 |  |  |  |  | 0 | return $result->{success}; | 
| 230 |  |  |  |  |  |  | } | 
| 231 | 0 |  |  |  |  | 0 | die "fibonacci failed: unknown result"; | 
| 232 |  |  |  |  |  |  | } | 
| 233 |  |  |  |  |  |  | package BenchmarkServiceProcessor; | 
| 234 |  |  |  |  |  |  |  | 
| 235 | 1 |  |  | 1 |  | 9 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 342 |  | 
| 236 |  |  |  |  |  |  |  | 
| 237 |  |  |  |  |  |  |  | 
| 238 |  |  |  |  |  |  | sub new { | 
| 239 | 1 |  |  | 1 |  | 20 | my ($classname, $handler) = @_; | 
| 240 | 1 |  |  |  |  | 3 | my $self      = {}; | 
| 241 | 1 |  |  |  |  | 3 | $self->{handler} = $handler; | 
| 242 | 1 |  |  |  |  | 3 | return bless ($self, $classname); | 
| 243 |  |  |  |  |  |  | } | 
| 244 |  |  |  |  |  |  |  | 
| 245 |  |  |  |  |  |  | sub process { | 
| 246 | 5 |  |  | 5 |  | 9 | my ($self, $input, $output) = @_; | 
| 247 | 5 |  |  |  |  | 6 | my $rseqid = 0; | 
| 248 | 5 |  |  |  |  | 6 | my $fname  = undef; | 
| 249 | 5 |  |  |  |  | 40 | my $mtype  = 0; | 
| 250 |  |  |  |  |  |  |  | 
| 251 | 5 |  |  |  |  | 16 | $input->readMessageBegin(\$fname, \$mtype, \$rseqid); | 
| 252 | 5 |  |  |  |  | 9 | my $methodname = 'process_'.$fname; | 
| 253 | 5 | 50 |  |  |  | 40 | if (!$self->can($methodname)) { | 
| 254 | 0 |  |  |  |  | 0 | $input->skip(Thrift::TType::STRUCT); | 
| 255 | 0 |  |  |  |  | 0 | $input->readMessageEnd(); | 
| 256 | 0 |  |  |  |  | 0 | my $x = Thrift::TApplicationException->new('Function '.$fname.' not implemented.', Thrift::TApplicationException::UNKNOWN_METHOD); | 
| 257 | 0 |  |  |  |  | 0 | $output->writeMessageBegin($fname, Thrift::TMessageType::EXCEPTION, $rseqid); | 
| 258 | 0 |  |  |  |  | 0 | $x->write($output); | 
| 259 | 0 |  |  |  |  | 0 | $output->writeMessageEnd(); | 
| 260 | 0 |  |  |  |  | 0 | $output->getTransport()->flush(); | 
| 261 | 0 |  |  |  |  | 0 | return; | 
| 262 |  |  |  |  |  |  | } | 
| 263 | 5 |  |  |  |  | 16 | $self->$methodname($rseqid, $input, $output); | 
| 264 | 5 |  |  |  |  | 13 | return 1; | 
| 265 |  |  |  |  |  |  | } | 
| 266 |  |  |  |  |  |  |  | 
| 267 |  |  |  |  |  |  | sub process_fibonacci { | 
| 268 | 5 |  |  | 5 |  | 10 | my ($self, $seqid, $input, $output) = @_; | 
| 269 | 5 |  |  |  |  | 11 | my $args = BenchmarkService_fibonacci_args->new(); | 
| 270 | 5 |  |  |  |  | 12 | $args->read($input); | 
| 271 | 5 |  |  |  |  | 11 | $input->readMessageEnd(); | 
| 272 | 5 |  |  |  |  | 13 | my $result = BenchmarkService_fibonacci_result->new(); | 
| 273 | 5 |  |  |  |  | 17 | $result->{success} = $self->{handler}->fibonacci($args->n); | 
| 274 | 5 |  |  |  |  | 145 | $output->writeMessageBegin('fibonacci', Thrift::TMessageType::REPLY, $seqid); | 
| 275 | 5 |  |  |  |  | 13 | $result->write($output); | 
| 276 | 5 |  |  |  |  | 12 | $output->writeMessageEnd(); | 
| 277 | 5 |  |  |  |  | 11 | $output->getTransport()->flush(); | 
| 278 |  |  |  |  |  |  | } | 
| 279 |  |  |  |  |  |  |  | 
| 280 |  |  |  |  |  |  | 1; |