t/TEST: add -perfstat option to run tests under linux perf stat

Add a simple way to run each test-script under linux perf stat, via a
-perfstat(=<stuff>)? cmdline option.  To make the option available for
make test and make test_harness, add TEST_OPTS envar, prepend it to
@ARGV, and move early return 1 if $::do_nothing (for subroutine reuse
via require) below cmdline option processing.

With this:

    export TEST_OPTS=-perfstat
    make test

writes a single file, like "t/perf.2012-1020-0848-52-5614" containing
perf reports for each test, each like this:

 Performance counter stats for './perl base/cond.t':

          3.155154 task-clock                #    0.807 CPUs utilized
                 2 context-switches          #    0.634 K/sec
                 1 CPU-migrations            #    0.317 K/sec
               464 page-faults               #    0.147 M/sec
         4,558,961 cycles                    #    1.445 GHz
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
         3,904,114 instructions              #    0.86  insns per cycle         [ 9.00%]
     <not counted> branches
     <not counted> branch-misses

       0.003909833 seconds time elapsed

The perf-reports have lots of info, and it takes very little
extra CPU to run:
				export TEST_OPTS=-perfstat
	time make test		time make test
	--------------		--------------
	real	25m41.122s	real	26m30.719s
	user	18m28.773s	user	18m43.286s
	sys	1m12.705s	sys	1m33.398s

When -perfstat=M is passed, "perf stat --repeat M -- perl test-script"
runs the script M times, and computes standard deviation of each
measurement.  This provides a noise-floor when evaluating the
performance impacts of a change, and demonstrates the limited
suitability of each test-script for use in performance assessment.

 Performance counter stats for './perl -I.. -MTestInit=U1 ../lib/Time/localtime.t' (4 runs):

         59.247079 task-clock                #    0.971 CPUs utilized            ( +-  3.19% )
                14 context-switches          #    0.228 K/sec                    ( +- 13.01% )
                22 CPU-migrations            #    0.367 K/sec                    ( +- 13.05% )
             1,526 page-faults               #    0.026 M/sec
       148,891,976 cycles                    #    2.513 GHz                      ( +-  1.29% ) [49.76%]
        59,864,155 stalled-cycles-frontend   #   40.21% frontend cycles idle     ( +-  2.02% ) [50.16%]
        32,113,905 stalled-cycles-backend    #   21.57% backend  cycles idle     ( +-  2.80% ) [51.17%]
       110,419,248 instructions              #    0.74  insns per cycle
                                             #    0.54  stalled cycles per insn  ( +-  0.69% ) [51.63%]
        24,597,068 branches                  #  415.161 M/sec                    ( +-  1.61% ) [51.04%]
         1,487,542 branch-misses             #    6.05% of all branches          ( +-  1.67% ) [50.45%]

       0.061010337 seconds time elapsed                                          ( +-  3.37% )

export TEST_OPTS="-perfstat=reps=4:rptdir=~/perl/perf:name=newname:tool=perf stat"

This envar value overrides the command wrapper defaults to set repeat
count (so that perf stat computes stddev of its measurements),
report-dir (to a separate data-repo thats not killed by git clean
-dxf), and file-name (to convey branch-name and/or config-info; a
timestamp is appended for uniqueness), and the tool and tool options
to run under.

The command wrapper is semi-generic, but not sufficiently so to fully
support running under valgrind, cachegrind etc; the --repeat M will
probably choke other tools.  This is readily fixable, but there are
other issues; valgrind post-processing is the biggest.
t/TEST: make test loop work for perf stat --repeat 3

Make <$results> processing loop accept repeated output from
test-script if run as "perf stat --repeat X -- test-script".

This boils down to tweaking leader (1..N) handling, by disarming
if ($seen_ok) ... check, allowing "ok N" in X passes after 1st.

TBD - further tweaks needed, get 2 dozen failures now on make test
t/TEST: simplify <$results> processing loop

Old loop is complicated for what it does, and has lots of state vars
which are updated midway thru loop, and affect choices both in that
iteration and in subsequent ones.  Do wholesale replacement (old code
is already using hashes, so theyre fair game)

Change details include (tb merged into previous):
- drop $failure, use @fails (accumulate failures)
- move all err checks together (above Valgrind handling)
- some corrections to err tests
- comment out now unused vars

new loop now works, with:
 TEST_OPTS=-perfstat=reps=4:rptdir=/home/jimc/projects/perl-core/perf
 HARNESS_TIMER=/home/jimc/projects/perl-core/timings (from another branch)

t/re/pat_advanced ............................................. ok     2578 ms  1690 ms   180 ms	# ET: u:440 s:40 cu:0 cs:0 pid:7509  # ET: u:400 s:20 cu:0 cs:0 pid:7515  # ET: u:400 s:20 cu:0 cs:0 pid:7521  # ET: u:380 s:40 cu:0 cs:0 pid:7532
t/TEST: tolerate bare ok, or extra spaces between ok and N

- tolerate bare ok
- allow extra spaces after ok, not just single space
fix VMS RESULTS
t/TEST: ET handling for other branch

test-times branch wants this chunk, but <$results> loop rewrite makes
it easier to do here.