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 bit will probably choke other tools)
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

This is a wholesale =head/=cut and reimplement.  It works, insofar as
tests run with reps=2.  Cleanup needed; drop =head/=cut block,
consolidate $failure vs @fails, move error checks up above =cut block,
move more err checks above valgrind handling (no reason for
separation).  Defer for now, run some tests overnite.
t/TEST: finish <$results> processing simplification

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

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

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

Tested code includes next patch, which fixes uninit warnings enabled
by -w added previously, but untested for -d HARNESS_TIMER case.
t/TEST: tolerate bare ok, or extra spaces between ok and N

- tolerate bare ok
- allow extra spaces after ok, not just single space
drop test_ET from this branch
seen-test check
fixup: rename output file perfrpt.$tstamp, trim perf stat cmdline
drop =cutted code
comment tweaks
fixup: TEST_OPTS split on ;

splitting on /\s+/ broke tool=... overrides that had spaces, so
overriding with the default value would break:

  export TEST_OPTS="-perfstat=reps=4:tool=perf stat:name=foo"

Change split to /;/, which is kinda weird, but almost never used
(never so far).  Note that multiple k=v pairs are separated by ':', as
in example above.

Also change filename key from out=<fname> to name=<fnameroot>, and
append $tstamp to it automatically.  This makes name=<..> more useful
for conveying branch or config-names w/o overwriting previous reports.
fix err msg, --repeat is clearer
drop unused vars
fix VMS RESULTS