33 if ( $this->hasOption(
'setup' ) ) {
34 $setupCode = $this->getOption(
'setup' ) .
';';
39 if ( $this->hasOption(
'code' ) ) {
40 $code = $this->getOption(
'code' );
41 } elseif ( $this->hasArg( 0 ) ) {
42 $code = file_get_contents( $this->getArg( 0 ) );
43 if ( $code ===
false ) {
44 $this->fatalError(
"Unable to read input file" );
47 fwrite( STDERR,
"Reading from stdin...\n" );
48 $code = stream_get_contents( STDIN );
51 $inner = $this->getOption(
'inner', 1 );
53 $code =
"for ( \$__i = 0; \$__i < $inner; \$__i++ ) { $code }";
55 $code =
"function wfBenchmarkEvalBody () { $code }";
58 $this->bench( [
'eval' => [
'function' =>
'wfBenchmarkEvalBody' ] ] );