andy-graprof/graprof — pull request #12 by stefanbeller (2013-09-15 22:21:17+00:00)
Title: Allow tracing and analyzing in one step

As of now the usual way of operating graprof distinguishes between
recording a trace and analyzing that trace by 2 different commands:
# record trace with properly linked and instrumented binary:
GRAPROF_OUT=mytrace a.out --option-for-a-out
# analysis:
graprof a.out mytrace --graprof-options

That way is kept, but another way is added:
graprof --graprof-options -- a.out --option-for-a-out
using a default trace file located at $PWD/graprof.trace

A few notes on this added implementation:
* The -- is usually used as an escape sequence, but here it gets a
slightly different meaning. Once it is there, we will assume the
parsing is done and all the rest of the parameters contain the command
to be used for profiling.
There cannot be any graprof related option behind the first '--'.
* It is assumed that the first argument behind the '--' is the programs
name. This doesn't work:
graprof -C -- LD_DEBUG=bindings,symbols a.out --option-for-a-out
* $PWD/graprof.trace gets overwritten without checking whether this file
already exists.

Signed-off-by: Stefan Beller

Personally I don't like the variable name 'profilee', I'll think about better names.