Add Profiling utility to Halide

This provides a rudimentary Profiling facility for tracking down
performance issues in complex pipelines. By enabling profile mode
(HL_PROFILE=1), generated code is instrumented with
llvm.readcyclecounter (== rdtsc on x86) and timings for each Func
evaluation are emitted to stderr. By saving stderr and processing with
the new util/HalideProf.cpp utility, you can easily get a rough guide
to which Funcs are taking the most CPU time, either cumulatively
(including sub-Funcs) or not (excluding sub-Funcs).

As part of this effort, I added a usec-resolution timer (in addition to
the msec-resolution one), and extended PrintStmt to print 64-bit
int/uint values without truncation to 32 bits (which is what it did
before).

To use:

    export HL_PROFILE=1
    make bin/test_bounds_inference && ./bin/test_bounds_inference 2>
/tmp/foo
    make bin/HalideProf && bin/HalideProf  < /tmp/foo

Caveats:

-- this makes no effort to provide accurate or useful information when
parallelization is scheduled; more work would need to be done to safely
record data from multiple threads

-- this makes no effort to account for overhead from the profiling
instructions inserted; profile-enabled runtimes will be slower, and
inner loops will be more profoundly affected

-- I'm not wild about dumping the profiling info via stderr, but it's
expedient and probably adequate for our short-term purposes.

-- this is my first nontrial change inside Halide, and in particular my
first attempt at adding interesting code generation, so I may have made
hamfisted mistakes. Please be gentle :-)
Fix instrumentation of For loops in HL_PROFILE; disallow instrumentation of parallel For loops; clean up Stmt output of temp profiling instrumentation vars
Add -top flag to HalideProf to allow showing only the top N results (to avoid massive output); default value is 10.
Made images castable to a non-const buffer_t *

The headers generated are now non-const, so this is necessary to still
pass Halide Image objects in.
Check for unistd in compile_to_lowered_stmt
Merge branch 'pr/115'
Changed cast to be more portable.
Add optional name arguments to the helpers in InlineReductions, so that their results in the new Profiler are more easily readable.
Merge pull request #120 from steven-johnson/master

Add optional name arguments to the helpers in InlineReductions, so that ...
Fixed a bug in bounds inference.

We were lifting out Call exprs that were loads from Funcs. You can't move
these around, as their value might change (especially if they're a reduction).

Added an error that previously did not flag as an error, and a test that uses
this to do an argmax.
Allowed one-character Func names.
Typo in build_tests rule resulted in building tutorials when running tests.
Removed aggressive reuse of stack space.

It was buggy and unnecessary.
Avoid hard-coding libpng location.
make clean && make test_apps didn't build Halide.h
Slightly expand tutorial lesson_01
Tutorial ignores
Merge branch 'master' of github.com:halide/Halide
merged